buaabai / Ternary-Weights-Network

Ternay-Weights-Network/Pytorch
35 stars 12 forks source link

In Python3 here should be converted into number by tensor.item() #6

Open ShinChoon opened 1 year ago

ShinChoon commented 1 year ago

Just a note for others https://github.com/buaabai/Ternary-Weights-Network/blob/ccc7f94eb325a624fae58ebed38cdd6106612251/main.py#L107

https://github.com/buaabai/Ternary-Weights-Network/blob/ccc7f94eb325a624fae58ebed38cdd6106612251/main.py#L120

loss.data[0] -> loss.item() test_loss += criterion(output, target).data[0] -> test_loss += criterion(output, target).item()