Additionally pass the observations to Batch objects.
@@ -73,11 +73,12 @@ parent function to set up these fields as a base.
in the batch. these memories are generated by splitting
the input text on newlines, with the last line put in the
text field and the remaining put in this one.
+:field observations: the original observations in the batched order
"""
Batch = namedtuple('Batch', ['text_vec', 'text_lengths', 'label_vec',
'label_lengths', 'labels', 'valid_indices',
'candidates', 'candidate_vecs', 'image',
- 'memory_vecs'])
+ 'memory_vecs', 'observations'])
set_namedtuple_defaults(Batch, default=None)
@@ -673,7 +674,8 @@ class TorchAgent(Agent):
return Batch(text_vec=xs, text_lengths=x_lens, label_vec=ys,
label_lengths=y_lens, labels=labels,
valid_indices=valid_inds, candidates=cands,
- candidate_vecs=cand_vecs, image=imgs, memory_vecs=mems)
+ candidate_vecs=cand_vecs, image=imgs, memory_vecs=mems,
+ observations=exs)
def match_batch(self, batch_reply, valid_inds, output=None):
"""Match sub-batch of predictions to the original batch indices.
