dsgiitr / d2l-pytorch

This project reproduces the book Dive Into Deep Learning (https://d2l.ai/), adapting the code from MXNet into PyTorch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError in Chp14_Computer_Vision Single_Shot_Multibox_Detection.ipynb

Alikerin opened this issue · 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)