![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
qq_46111795
这个作者很懒,什么都没留下…
展开
-
pytorch in-place运算和反向传播报错之间的关系
pytorch求梯度常见错误分析原创 2022-09-22 11:06:21 · 662 阅读 · 1 评论 -
pytorch Embedding max_norm使用注意事项
在官方文档中,Embedding的max_norm参数给出了一个注意事项:When max_norm is not None, Embedding’s forward method will modify the weight tensor in-place. Since tensors needed for gradient computations cannot be modified in-place, performing a differentiable operation on Embeddin原创 2022-06-30 11:03:57 · 1236 阅读 · 0 评论 -
Python *args参数的作用
用作函数占位符,可以增加扩展性比如在深度学习中,网络和训练函数部分代码如下:class SubNet(nn.Module): ... def forward(self, X, *args): pred = do_something(X, *args) return predclass Net(nn.Module): ... def forward(self, X, *args): do_something() return self.subnet(X, *args)def原创 2022-02-19 18:45:20 · 856 阅读 · 0 评论