def _select_update(self, y, train_ref, is_train): if train_ref is not None and is_train: # Training wt = train_ref else: # Testing wt = Variable(self._xp.array(UF.argmax(y.data), dtype=np.int32)) return wt
def collect_output(src_col, output, alignment, out): y = UF.argmax(out.y.data) for i in range(len(y)): output[i][src_col] = y[i] a = out.a if a is not None: for i, x in enumerate(a.data): for j, x_a in enumerate(x): alignment[i][src_col][j] = float(x_a)