4

鉴于:

self.A = torch.autograd.Variable(random_sparse(n = dim)) 
self.w = torch.autograd.Variable(torch.Tensor(np.random.normal(0,1,(dim,dim))))

目标1:

torch.mm(self.A, self.w)

目标2:

torch.spmm(self.A, self.w)

结果1:

TypeError: Type torch.sparse.FloatTensor doesn't implement stateless method addmm

结果2:

AttributeError: 'module' object has no attribute 'spmm'

我的 PyTorch 版本是 0.1.12_2 - 非常感谢可能的解决方案。

4

1 回答 1

3

spmm已从torch一个模块移到torch.sparse另一个模块。有关官方文档,请查看此链接torch.sparse在模块的文档开头还有一个警告:

此 API 目前处于试验阶段,可能会在不久的将来发生变化。

于 2018-08-30T10:29:53.023 回答