Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SamplesBatch
classSamplesBatch
classReference 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 atinputs_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.Tensor
s. 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.