随笔分类 -  pytorch

摘要:official link 函数定义 torch.gather(input, dim, index, *, sparse_grad=False, out=None) → Tensor 沿着dim指定的轴聚集tensor的值。返回的是原数据的复制,修改返回值不会修改原tensor。 参数: input 阅读全文
posted @ 2022-03-23 13:56 Js2Hou 阅读(462) 评论(0) 推荐(1)
摘要:ModuleList是特殊的list,其包含的模块会被自动注册,对所有的Module方法都可见。先给结论:如果要用列表组织模型模块,那么强烈建议使用nn.ModuleList。这有什么好处呢?看下面的例子。 import torch.nn as nn from torchsummary import 阅读全文
posted @ 2022-02-09 12:43 Js2Hou 阅读(1361) 评论(0) 推荐(0)
摘要:问题 在用pytorch跑生成对抗网络的时候,出现错误Runtime Error: one of the variables needed for gradient computation has been modified by an inplace operation,特记录排坑记录。 环境配置 阅读全文
posted @ 2020-11-03 22:39 Js2Hou 阅读(30650) 评论(1) 推荐(10)