Shape-related error when loading custom gluon dataset

I created a custom gluon Dataset where records are sequences of 6 pictures, and trying to feed it to a data loader.
What works:

  • I can get Dataset records fine using Dataset.__getitem__()
  • I can get batches out of the DataLoader when using batch_size = 1

What doesn’t work:

  • when I use batch_size > 1, eg 2 or more, I have this error:

raise MXNetError(py_str(_LIB.MXGetLastError())) mxnet.base.MXNetError: [15:08:51] include/mxnet/././tensor_blob.h:290: Check failed: this->shape_.Size() == shape.Size() (903168 vs. 752640) TBlob.get_with_shape: new and old shape do not match total elements

mx 1.4.1 on AWS SageMaker EC2 P3.2xl

all good, turns out out of 100 records, 99 were of shape (6,3,224,224) and one was shape (5,3,224,224). Added some padding and things work fine now!