Hi,
I would guess that np.save() overrides the file every time and that the last batch from the dataloader is of size 3 (because dataset_len % batch_size = 3) and so you get this.
I am not sure if there is an option to append in np.save but a solution is to accumulate all the values in a Tensor and write it at the end.
Or write to the file yourself and make sure to append to it.