编程语言
首页 > 编程语言> > LIBTORCH C++

LIBTORCH C++

作者:互联网

1:Ubuntu18.04 配置 LibTorch_不忘初心~-CSDN博客_ubuntu安装libtorch

2:You need C++14 to compile PyTorch

Ubuntu下C++调用pytorch训练好模型--利用libtorch - 灰信网(软件开发博客聚合)

3:Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same

错误内容大概就是指输入类型是CPU(torch.FloatTensor),而参数类型是GPU(torch.cuda.FloatTensor)。
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
inputs.to(device)
或者
 tensor_image = tensor_image.unsqueeze(0).cuda();

标签:FloatTensor,torch,C++,LIBTORCH,cuda,device,image
来源: https://blog.csdn.net/qq_51609636/article/details/122690949