d2l-pytorch icon indicating copy to clipboard operation
d2l-pytorch copied to clipboard

TypeError in Chp14_Computer_Vision Single_Shot_Multibox_Detection.ipynb

Open Alikerin opened this issue 5 years ago • 0 comments

In Chp14_Computer_Vision Single_Shot_Multibox_Detection.ipynb in the implementation of Define Loss and Evaluation Functions there is a missing .long() on line 61. A TypeError was raised: "Expected Long but got Float"

I solved it by changing class_true_i[0, j] to class_true_i[0, j].long() because class_target is a tensor with dtype long as shown on line 54 class_target = torch.zeros(class_hat_i.shape[0]).long().to(self.device)

Alikerin avatar Feb 07 '20 04:02 Alikerin