What are the main reasons for receiving RuntimeError: stack expects a non-empty TensorList error for torch.stack?

I’m not sure how you are loading the images, but it seems that the used library has trouble loading these problematic image files (e.g. PIL or OpenCV).
Based on the error message a None object will be returned which then fails in the torch.stack operation.
Could you try to load the mentioned images using the image lib and check what the output would be?

1 Like