          if not (token_ids and is_valid and vectors and scores):
              with gil:
                  PyErr_SetFromErrno(MemoryError)
                  PyErr_CheckSignals()
          cdef float feature
          while not state.is_final():
              state.set_context_tokens(token_ids, nr_feat)
              memset(vectors, 0, nr_hidden * nr_piece * sizeof(float))
              memset(scores, 0, nr_class * sizeof(float))
              sum_state_features(vectors,
                  feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
              for i in range(nr_hidden * nr_piece):
                  vectors[i] += bias[i]
              V = vectors
              W = hW
              for i in range(nr_hidden):
                  if nr_piece == 1:
                      feature = V[0] if V[0] >= 0. else 0.
                  elif nr_piece == 2:
                      feature = V[0] if V[0] >= V[1] else V[1]
                  else:
                      feature = Vec.max(V, nr_piece)
                  for j in range(nr_class):
                      scores[j] += feature * W[j]
                  W += nr_class
                  V += nr_piece
              for i in range(nr_class):
                  scores[i] += hb[i]
              self.moves.set_valid(is_valid, state)
              guess = arg_max_if_valid(scores, is_valid, nr_class)
              action = self.moves.c[guess]
              action.do(state, action.label)
              state.push_hist(guess)
          free(token_ids)
          free(is_valid)
          free(vectors)
          free(scores)
  
 
</s> remove         vectors = <float*>calloc(nr_hidden * nr_piece, sizeof(float))
        scores = <float*>calloc(nr_class, sizeof(float))
 </s> add         vectors = <float*>calloc(nr_hidden * nr_task, sizeof(float))
        unmaxed = <float*>calloc(nr_hidden * nr_piece, sizeof(float))
        scores = <float*>calloc(nr_class*nr_task, sizeof(float)) </s> remove             vectors = state2vec(token_ids[:n_states])
            scores = vec2scores(vectors)
 </s> add             vectors, _ = state2vec.begin_update(token_ids[:n_states], drop)
            scores, _ = vec2scores.begin_update(vectors, drop=drop) </s> remove             for i in range(nr_task):
                self._parseC(states[i],
                    feat_weights, bias, hW, hb,
                    nr_class, nr_hidden, nr_feat, nr_piece)
 </s> add             self._parseC(&states[0], nr_task, feat_weights, bias, hW, hb,
                nr_class, nr_hidden, nr_feat, nr_piece) </s> remove                 if self.limit and i >= self.limit:
 </s> add                 if limit and i >= limit: </s> remove             n += sum([len(s[0][1]) for s in paragraph_tuples])
 </s> add             for sent_tuples, brackets in paragraph_tuples:
                n += len(sent_tuples[1])
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
          if not (token_ids and is_valid and vectors and scores):
              with gil:
                  PyErr_SetFromErrno(MemoryError)
                  PyErr_CheckSignals()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
        cdef int nr_todo = nr_task
        cdef int i, j
        cdef vector[StateC*] unfinished
        while nr_todo >= 1:
            memset(vectors, 0, nr_todo * nr_hidden * sizeof(float))
            memset(scores, 0, nr_todo * nr_class * sizeof(float))
            for i in range(nr_todo):
                state = states[i]
                state.set_context_tokens(token_ids, nr_feat)
                memset(unmaxed, 0, nr_hidden * nr_piece * sizeof(float))
                sum_state_features(unmaxed,
                    feat_weights, token_ids, 1, nr_feat, nr_hidden * nr_piece)
                VecVec.add_i(unmaxed,
                    bias, 1., nr_hidden*nr_piece)
                state_vector = &vectors[i*nr_hidden]
                for j in range(nr_hidden):
                    index = j * nr_piece
                    which = Vec.arg_max(&unmaxed[index], nr_piece)
                    state_vector[j] = unmaxed[index + which]
            # Compute hidden-to-output
            openblas.simple_gemm(scores, nr_todo, nr_class,
                vectors, nr_todo, nr_hidden, hW, nr_hidden, nr_class, 0, 0)
            # Add bias
            for i in range(nr_todo):
                VecVec.add_i(&scores[i*nr_class],
                    hb, 1., nr_class)
            # Validate actions, argmax, take action.
            for i in range(nr_todo):
                state = states[i]
                self.moves.set_valid(is_valid, state)
                guess = arg_max_if_valid(&scores[i*nr_class], is_valid, nr_class)
                action = self.moves.c[guess]
                action.do(state, action.label)
                state.push_hist(guess)
                if not state.is_final():
                    unfinished.push_back(state)
            for i in range(unfinished.size()):
                states[i] = unfinished[i]
            nr_todo = unfinished.size()
            unfinished.clear()
          free(token_ids)
          free(is_valid)
          free(vectors)
          free(scores)
  
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Revert "Merge branch 'develop' of https://github.com/explosion/spaCy into develop"

This reverts commit c9ba3d3c2dc7067cf8bd55f878cec45a8c6d73d4, reversing
changes made to 92c26a35d425d4e8ca1b805ea776ea10f5ded3df. 
spacy/syntax/nn_parser.pyx