RuntimeError: only batches of spatial targets supported (3D tensors) but got targets of dimension: 4

It worked! I had to wait for 80 iterations to see some results

I am an undergrad currently learning PyTorch, and I want to build a CNN to classify male and female pictures. The link to my notebook is CNN using Pytorch | Kaggle. My target only has one dimension(0 or 1 symbolizing male and female). Since I only have two classes, I am not sure if I can use one-hot encoding to expand my target to three dimensions. What do I do?