You can simply use CrossEntropyLoss to do this. CrossEntropyLoss now supports any dimensional input. Your final output should have shape of (N, C, X) where N is batch size C is total classes which is 3 in your  case X is total positions which is 64 in your case. During inference you can do argmax on dim=1 and get indices of classes.