
pytorch
文章平均质量分 81
agrichron
这个作者很懒,什么都没留下…
展开
-
pytorch中的scatter讲解
本文借从label获得one hot编码的例子来说明scatter的使用。scatter的初步认识首先我们来看看scatter的函数声明。其函数声明如下tensor.scatter_(dim, index, src)scatter函数涉及4个对象,分别是tensor,dim,index,src。该函数的主要作用是将src中的值根据dim和index填充到tensor中。这里有两个关键部分,1)将src中的值填充到tensor中;2)dim和index指定的位置,一个是src中的位置,另一个是ten原创 2022-05-28 10:30:28 · 620 阅读 · 0 评论 -
RuntimeError: There were no tensor arguments to this function (e.g., you passed an empty list of Ten
问题:RuntimeError: There were no tensor arguments to this function (e.g., you passed an empty list of Tensors), but no fallback function i [CUDATensorId, CPUTensorId, VariableTensorId]出问题处的函数栈如下图。从函数栈中可以看出最后一个函数是torch.cat([...]),所以问题出现在这个函数中。此外这个函数也是原创 2020-05-17 22:27:48 · 8095 阅读 · 2 评论