当前位置:   article > 正文

Pytorch日常debug记录(二)_pytorch userwarning to copy construct from a tenso

pytorch userwarning to copy construct from a tensor from a tensor it is

1.  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).
解决:如下图所示,将torch.tensor()改成torch.as_tensor() 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/272290
推荐阅读
相关标签
  

闽ICP备14008679号