I’m new to pytorch and is trying to train a model with cross entropy loss.
the output of my model is of size [miniBatchSize, n, m]
and label is of size [miniBatchSize, n]
where M is the number of categories, label elements are ints between 0 and M - 1
my current approach is
labels = torch.eye(m)[labels]
outputs = pointnet(inputs)
outputs = F.log_softmax(outputs, -1)
loss = labels * outputS
loss = loss.sum()
loss.backward()

and I have absolutely no idea if it’s gonna work correctly or not. 
are there any functions that can do the job for me? thx in advance.