TypeError:变量数据必须是张量,但有memoryview

时间:2019-05-24 20:00:56

标签: python pytorch

我正在尝试在训练期间为张量分配值,但出现如下类型错误。

TypeError Traceback (most recent call last)
<ipython-input-41-bf0ca201865c> in <module>
     12         actual_state = truck.step(ϕ_unnormalized)
     13         for i in range(6):
---> 14             x[i].data = actual_state[i].data
     15     end_state = torch.tensor(truck.get_state(0,0,0,0), dtype = torch.float, requires_grad = True)
     16     end_state = (end_state-mean[1:])/std[1:]

TypeError: Variable data has to be a tensor, but got memoryview

0 个答案:

没有答案