can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first

原因分析:数据在cuda() ,需要将 float 型的tensor转化为numpy ,只能在cpu上进行

更改前的样子:

labels_=labels_.numpy().tolist()

 更改后的样子哦

labels_=labels_.cpu().numpy().tolist()

 

你可能感兴趣的:(bug)