如何在PyTorch中使用变量和张量执行元素乘法?两个张量工作正常。用变量和标量运行正常。但是,试图用一个变量和张量进行逐元素相乘,当我得到: XXXXXXXXXXX in mul
assert not torch.is_tensor(other)
AssertionError
例如,在运行时执行以下操作: import torch
x_tensor = torch.Tenso
的点积 我使用的GPU计算神经网络输出和torch.cuda.FloatTensor(两者都存储在GPU)的点积,但得到一个错误说: TypeError: dot received an invalid combination of arguments - got (torch.cuda.FloatTensor) but expected (torch.FloatTensor tensor).