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/", line 162, in collate_tensor_fn
(RayTrainWorker pid=916350)     out =, *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(, augment(
        return dict(aug1=aug1, aug2=aug2,, 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 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?