I just realised that I for to add brackets at the end of nn.CrossEntropyLoss for my criterion. Although the error:
RuntimeError: bool value of Tensor with more than one value is ambiguous

seem to be gone, I am now getting this error:
ValueError: Expected input batch_size (785) to match target batch_size (1).