length = len(test_set)
array = np.array
target = array.reshape([1, seq_length, data_dim])
out = model(target)
pre = torch.flatten(out).item()
我收到了这个错误
155 length = len(test_set)
156 array = np.array
--> 157 target = array.reshape([1, seq_length, data_dim])
159 out = model(target)
160 pre = torch.flatten(out).item()
AttributeError: 'builtin_function_or_method' object has no attribute 'reshape'
我知道 np.array 和 reshape 不能一起使用 但我不知道如何更改代码
你还没有真正创建一个数组;
np.array
只是绑定了一个名为 array
的新名称。创建一个实际上包含某些内容的数组。