Hi Rylan!



 RylanSchaeffer:

output = F.softmax(self.weights(x), dim=1)
But torch.sum(output[5]) == 1. produces tensor(False).
What am I misusing about softmax such that output probabilities do not sum to 1?


You are testing for exact equality with a floating-point result.
Try looking at  torch.sum(output[5]) - 1.0 and see if you
get numbers that are small, that is, on the order of floating-point
round-off error (about 10^-7, relative).
Best.
K. Frank