摘要:
A.scatter_(dim, index, B) # 基本用法, tensor A 被就地scatter到 tensor B 如果dim = 0,意思就是在保持行索引不变的情况下,针对每一行,把每个原色的列索引转换为index里面的数值。 可以用于生成one - hot embedding 参考: 阅读全文
摘要:
autocast op reference Op Eligibility Ops that run in float64 or non-floating-point dtypes are not eligible, and will run in these types whether or not 阅读全文
摘要:
有时候我们会需要克隆对象。 如果每个子对象都实现Clone方法,显得冗余。 可以用CRTP实现,省去每个继承对象实现Clone方法的步骤。 // Base class has a pure virtual function for cloning class AbstractShape { publ 阅读全文