If you hadn’t tagged ptrblck, I would have recommended using .reshape before and after the softmax.
Best regards
Thomas
P.S.: More seriously, it’s not recommended to tag people for general questions. You  never know if someone who you didn’t tag would have great advice and is discouraged by not being on your list.