赞
踩
详细的警告如下:
UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
feature = torch.tensor( , dtype=torch.float32)
其实就是在将某个变量转成tensor过程中指定变量类型警告!
如果在转为tensor时需要改变变量类型需要用下面的语句
torch.as_tensor(torch.from_numpy(feature), dtype=torch.float32)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。