[Pytorch]: 错误汇总
来源:互联网 发布:网络制作软件扑克 编辑:程序博客网 时间:2024/06/04 17:55
关于自定义后向传播错误
Traceback (most recent call last): File "/xxx/xxx/xxx.py", line 217, in <module> output = L.forward(x, label) File "/xxx/xxx/xxx.py", line 201, in forward return xxx()(input, target, self.weight)RuntimeError: save_for_backward can only save input or output tensors, but argument 2 doesn't satisfy this condition
分析:出现这个错误是我在forward中改变了weight这个变量,weight=weight.div(scalar)
,这导致参数不符合save_for_backward
的要求。
解决:在forward中要改变weight的值可以使用就地运算weight.div_(scalar)
。这样即改变也weight的值,又不改变原本的指向。
遇到其它问题会更行,待续…
阅读全文
0 0
- [Pytorch]: 错误汇总
- pytorch 问题汇总
- PyTorch的错误
- PyTorch——错误集锦
- PyTorch
- PyTorch
- PyTorch
- pytorch
- pytorch
- Pytorch
- 深度学习:pytorch常见错误总结
- Pytorch图像分割BUG心得汇总(一)
- 错误汇总
- 错误汇总
- 错误汇总
- 错误汇总
- Pytorch是什么?关于Pytorch
- Struts常见错误汇总
- 荷兰国旗问题
- break和continue区别
- 无关选择
- 游戏game
- es6 Babel
- [Pytorch]: 错误汇总
- 离散化模板(适用于有重复元素的)
- 深入理解c++纯虚函数
- 【Eternallyc】NEFU-119-组合素数
- 一个java状态机样例的代码
- 没有id没有name iframe中获取iframe本身dom元素
- Ubuntu下 嵌入式Qt开发环境的搭建
- 二进制中1的个数及其拓展
- StudyAI上MatConvNet框架课程学习笔记1:CPU编译入门