Support multi-inputs
- Add
SamplesBatchclass - Utilize
SamplesBatchclass
Reference Issues/PRs
Resolves #161
What does this implement/fix? Explain your changes.
I've added a SamplesBatch class, which holds multiple inputs and single target.
Inputs are stored as a dict(str, np.ndarray). Sequence is stored at inputs_batch['sequence_batch'].
If only sequence is provided as an input, then inputs() getter will return just a sequence.
It also has a function to convert inputs and targets to torch.Tensors. The sequence's tensor is transposed to [batch_size, channels_size, sequnece_length], so we don't need to do transpose it everywhere in the code.
What testing did you do to verify the changes in this PR?
I added unit tests for the SamplesBatch class.
I also ran case2/1_train_with_online_sampler.yml with a validation on every other step. So intervals_sampler, train, and validate do work.
Please let me know if this is sufficient, or may be you have a list of commands you run to check that everything works.
PTAL @jzthree @kathyxchen