Batch: only allow entries with the same length #1087
Labels
Batch and Buffer
Improvements in internal data structures, temporary label
breaking changes
Changes in public interfaces. Includes small changes or changes in keys
refactoring
No change to functionality
Currenly sequences in
Batch
can be of different lengths which can easily lead to problems. E.g.,will lead to
and
list(b)
will result in essentially[Batch(a=1, b=1), Batch(a=2, b=2)]
, silently ignoring the last element of the sequence associated witha
.This issue becomes more severe when noticing that batches can (and often do) contain subbatches, and if these contain sequences, also there the shortest sequence will determine the length and elements of the overall batch.
Since
Batch
is supposed to behave somehow like an array, being sliceable and all, it should only support equal-size sequences.Note that empty subbatches and empty subarrays are treated differently! E.g.,
leads to a batch of length 3, whereas
leads to a batch of length 0
The text was updated successfully, but these errors were encountered: