andreasveit / triplet-network-pytorch

373 stars 96 forks source link

Invalid Index of 0-dim tensor #8

Open soulslicer opened 5 years ago

soulslicer commented 5 years ago
losses.update(loss_triplet.data[0], data1.size(0))

IndexError: invalid index of a 0-dim tensor. Use tensor.item() to convert a 0-dim tensor to a Python number

farazBhatti commented 5 years ago

@soulslicer change 'losses.update(loss_triplet.data[0], data1.size(0))'

to 'losses.update(loss_triplet.data, data1.size(0))' change data[0] to data in all of the code

rafis commented 5 years ago

or to .data.item()