Skip to content

Support multi-inputs#163

Open
arlapin wants to merge 2 commits into
FunctionLab:masterfrom
arlapin:arlapin/wrap_to_tensor
Open

Support multi-inputs#163
arlapin wants to merge 2 commits into
FunctionLab:masterfrom
arlapin:arlapin/wrap_to_tensor

Conversation

@arlapin

@arlapin arlapin commented Mar 2, 2021

Copy link
Copy Markdown
Contributor
  • 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

arlapin commented Mar 2, 2021

Copy link
Copy Markdown
Contributor Author
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant