Hi,
F.nll_loss expects input and target to be 2-dimensional and 1-dimensional, respectively or (N, C, d_1, d_2, …, d_K) and (N, d_1, d_2, …, d_K) respectively source code 55.
So, in your case, reshaping input tensor to (5 * 2, 10) and target tensor to (5 * 2) will make it work.