本文最后更新于:2024年5月7日 下午
本文记录 pytorch: can’t optimize a non-leaf Tensor 解决方案。
错误
运行优化时报错
1 |
|
- 报错: can’t optimize a non-leaf Tensor
解决方案
需要先把Tensor放入到GPU中,然后再设置Tensor.requires_grad=True。
1 |
|
参考资料
文章链接:
https://www.zywvvd.com/notes/study/deep-learning/pytorch/none-leaf-tensor/none-leaf-tensor/
“觉得不错的话,给点打赏吧 ୧(๑•̀⌄•́๑)૭”

微信支付

支付宝支付
Pytorch can't optimize a non-leaf Tensor
https://www.zywvvd.com/notes/study/deep-learning/pytorch/none-leaf-tensor/none-leaf-tensor/