Skip to content

Support multi-inputs #163

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

arlapin
Copy link
Contributor

@arlapin arlapin commented Mar 2, 2021

  • Add SamplesBatch class
  • Utilize SamplesBatch class

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.

@arlapin
Copy link
Contributor Author

arlapin commented Mar 2, 2021

PTAL @jzthree @kathyxchen

@arlapin arlapin force-pushed the arlapin/wrap_to_tensor branch from 9397574 to d464fd7 Compare March 3, 2021 16:02
@arlapin arlapin force-pushed the arlapin/wrap_to_tensor branch from d464fd7 to 32d0c89 Compare March 3, 2021 16:05
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support NN models with multiple inputs
1 participant