Hi Tornike!



 Tornike:

CrossEntropyLoss Returns 2 values in tensor.
…
argmax().item() only returns zeros.
…

tensor([ 4.0784, -4.6333])
tensor([ 3.4433, -3.3892])
tensor([ 2.8473, -2.9989])
…



The problem is not argmax() – some other part of your code is not
giving the values you expect for y_val.  They are not reasonable
results from CrossEntropyLoss (if that’s what you are expecting).
In the examples you printed out the [0] element is positive, and the
[1] element is negative, so the maximum value is the [0] element.
argmax() is correctly returning 0 – the index of the maximum element.
Best.
K. Frank