Softmax Regression Implementation from Scratch

I’m having hard time interpreting the last part of the code.

Why do we use 'wrong = preds.type(y.dtype) != y’ instead of ‘wrong = preds != y’, which generate the exact same result.
And why does the first one work? The y.dtype just generates the type of y.