How to debug "trying to resize storage that is not resizable" error?

I’m getting the following error:

(RayTrainWorker pid=916350)   File "/home/ray/anaconda3/lib/python3.8/site-packages/torch/utils/data/_utils/collate.py", line 162, in collate_tensor_fn
(RayTrainWorker pid=916350)     out = elem.new(storage).resize_(len(batch), *list(elem.size()))
(RayTrainWorker pid=916350) RuntimeError: Trying to resize storage that is not resizable

Roughly, I have the following function in a torchdata pipeline:

    def make_augmentations(x):
        aug1, aug2 = augment(x.data), augment(x.data)
        return dict(aug1=aug1, aug2=aug2, og=x.data, url=x.url, index=x.Index)

the dict later gets passed into pytorch’s collate function. I get the above error if I include the og=x.data line in the return statement.

I’m not sure what to do here. I tried deep copying the tensor, but that did not help. I also tried to convert to/from a numpy array, and that did not help either.

What might be going on here?