When using the code implemented in #168, I got an error in some cases where the input size is such that len(inputs) % batch_size < offset.right. That means that the last (incomplete) batch is smaller than offset.right. As a result, I get an error on the penultimate batch as the batch_end_idx is larger than input size.
File "/CEBRA-dev/cebra/solver/base.py", line 634, in transform
output = _batched_transform(
^^^^^^^^^^^^^^^^^^^
File "/CEBRA-dev/cebra/solver/base.py", line 248, in _batched_transform
batched_data = _get_batch(inputs=inputs,
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/CEBRA-dev/cebra/solver/base.py", line 153, in _get_batch
_check_indices(indices[0], indices[1], offset, len(inputs))
File "/CEBRA-dev/cebra/solver/base.py", line 81, in _check_indices
raise ValueError(
ValueError: batch_end_idx (20117) cannot exceed the length of inputs (20111).
When using the code implemented in #168, I got an error in some cases where the input size is such that
len(inputs) % batch_size < offset.right
. That means that the last (incomplete) batch is smaller thanoffset.right
. As a result, I get an error on the penultimate batch as thebatch_end_idx
is larger than input size.Code to reproduce (from branch #168):
Error:
I will propose a solution.