Hello all,
Is this a proper place for asking questions about 2018 Lesson 9?
I am confused about first cell in section Train
Why is cpu() assigned here?
def one_hot_embedding(labels, num_classes):
return torch.eye(num_classes)[labels.data.cpu()]
Later I see cell like this:
for i,o in enumerate(y): y[i] = o.cpu()
learn.model.cpu()
What role does cpu() play here?
I have not yet finished Lesson 9 fully yet so not sure if this gets explained some place.
Thank you for all the gr8 teaching!
@apil.tamang suggestion was to remove .cpu() from all the notebook. That got me past the cell which gave me hard time. Hpowever a new error occurred:
After defining the Focal_Loss class, running ssd_loss(batch, y, True) results in an error:
TypeError: Performing basic indexing on a tensor and encountered an error indexing dim 0 with an object of type torch.cuda.LongTensor. The only supported types are integers, slices, numpy scalars, or if indexing with a torch.LongTensor or torch.ByteTensor only a single Tensor may be passed.