Kla:

when I use nn.CrossEntrypyLoss(), is it necessary to define the nn.Softmax as the last Layer by Forward or is it in CrossEntropyLoss included?


nn.Softmax is not required in this case. Your second example should work fine.