马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
pre = torch.nn.functional.softmax(torch.tensor(np.array(pre_valid).flatten(),dtype=torch.float32),dim=-1)
result = np.argmax(pre,axis=1)
上述代码报错---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[112], line 1
----> 1 pre = torch.nn.functional.softmax(torch.tensor(np.array(pre_valid).flatten(),dtype=torch.float32),dim=-1)
2 result = np.argmax(pre,axis=1)
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (229,) + inhomogeneous part.
其中pre_valid是形状为(229,2)的列表 |