facenet_pytorch
facenet_pytorch copied to clipboard
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
out_selected_a = Variable(torch.from_numpy(out_a.cpu().data.numpy()[hard_triplets]).cuda()) out_selected_p = Variable(torch.from_numpy(out_p.cpu().data.numpy()[hard_triplets]).cuda()) out_selected_n = Variable(torch.from_numpy(out_n.cpu().data.numpy()[hard_triplets]).cuda())
will lead to
RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
why not use:
out_selected_a = out_a[hard_triplets] out_selected_p = out_p[hard_triplets] out_selected_n = out_n[hard_triplets]