This is a misleading error message, which is thrown if your data is missing a batch dimension.
It should be fixed on master. Here 3 is the github issue.
Your data for prediction might be a single image with dimensions: [channels, height, width].
Just add a batch dimension at dim0 and your code should run again:
x = torch.randn(3, 24, 24) # your image
x.unsqueeze_(0)
print(x.shape)
> torch.Size([1, 3, 24, 24])