Conv2d stride error when using custom Dataset with DataLoader

I have created a custom Dataset and when passing it to a DataLoader during training, I am getting

RuntimeError: expected stride to be a single integer value or a list . . .

I have tried to unsqueeze the inputs with no success. This issue does not persist when I instead iterate over the Dataset itself during training (which is obviously inefficient as I am unable to take advantage of batches and workers). The model is resnet50.

What are some steps I can take to overcome this issue?

I was able to fix this by changing my optimization function.