Solved by vmirly1 in post #5 
              
              
                I have a simple example for this: 
>>> model = nn.Linear(4, 2)
>>> x = torch.randn(10, 4)
>>> y = torch.LongTensor([1, 0, 1, 1, 0, 1, 0, 1, 1, 1])
>>> optimizer = torch.optim.SGD(model.parameters(), lr=0.1, momentum=0.9)
>>> # compute the output
>>> out = F.log_softmax(model(x), dim=1)
>>> pre = lis…