for i in range(epoch):
time0 = time.time()
loss = self.Train_batch()
if i%self.args.show_interval == 0:
accu_val = self.Cross_validation()
if accu_val > cross_accu:
cross_accu = accu_val
test_accu, prediction, real = self.Prediction()
print('In the {}th epoch, TESTING accuracy is {}%'.format(i, np.round(test_accu, 3)))
test_accu_.append(test_accu)
prediction_.append(prediction)
real_.append(real)
np.save('E:/FC_STGNN/experiment/{}.npy'.format(self.args.save_name),[test_accu_, prediction_, real_])运行到这里报错
发生异常: ValueError
setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (3, 9) + inhomogeneous part.
File "E:\FC_STGNN\main_HAR.py", line 67, in Train_model
np.save('E:/FC_STGNN/experiment/{}.npy'.format(self.args.save_name),[testaccu, prediction, real])
File "E:\FC_STGNN\main_HAR.py", line 167, in
train.Train_model()
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (3, 9) + inhomogeneous part.
def Train_model(self): epoch = self.args.epoch cross_accu = 0 testaccu = [] prediction = [] real = []
发生异常: ValueError setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (3, 9) + inhomogeneous part. File "E:\FC_STGNN\main_HAR.py", line 67, in Train_model np.save('E:/FC_STGNN/experiment/{}.npy'.format(self.args.save_name),[testaccu, prediction, real]) File "E:\FC_STGNN\main_HAR.py", line 167, in
train.Train_model()
ValueError: setting an array element with a sequence. The requested array has an inhomogeneous shape after 2 dimensions. The detected shape was (3, 9) + inhomogeneous part.