Variable "_" incomprehensibility

I don’t understand the purpose of the simbol “_” on line 4 (which I can only find there).

count = 0
for x, y in, batch_size=1):
    z = model(x)
    _, yhat = torch.max(z, 1)
    if yhat != y:
        show_data((x, y))
        print("yhat: ",yhat)
        count += 1
    if count >= 5:

thanks for your help.

It’s nothing special, just a variable name. However, it is conventional to use _ to mean “I don’t care about this value”


thanks Alice,I wasn’t sure.

1 Like