Thank you for your answer. I followed your solution, but now I ended up with a different error:
1only batches of spatial targets supported (3D tensors) but got targets of size: : [64, 1, 33, 33]
I am trying to perform image reconstruction, not classification. So perhaps I should use a different loss function?