didn't match because some of the arguments have invalid types: (Tensor, !Tensor!)
## Calculate the output of this network using matrix multiplication
d = torch.mm(features,weights.view(5,1))
print(type(d))
print(type(bias))
out = torch.sum(d,bias)
<class 'torch.Tensor'>
<class 'torch.Tensor'>
解决办法 sum ------>add 问题解决
## Calculate the output of this network using matrix multiplication
d = torch.mm(features,weights.view(5,1))
print(type(d))
print(type(bias))
out = torch.add(d,bias)
print(out)
print(d)
print(bias)
本文探讨了使用PyTorch进行矩阵乘法和张量操作的方法,包括如何利用torch.mm进行特征和权重的乘法运算,并正确地使用torch.add将偏置加入到结果中,解决了因类型不匹配导致的错误。
4768

被折叠的 条评论
为什么被折叠?



