Traceback (most recent call last): File "D:\daima\KalmanNet_TSP-main\main_lor_DT_NLobs.py", line 148, in <module> [MSE_test_linear_arr, MSE_test_linear_avg, MSE_test_dB_avg,knet_out,RunTime] = KalmanNet_Pipeline.NNTest(sys_model, test_input, test_target, path_results) File "D:\daima\KalmanNet_TSP-main\Pipelines\Pipeline_EKF.py", line 308, in NNTest x_out_test[:,:, t] = torch.squeeze(self.model(torch.unsqueeze(test_input[:,:, t],2))) File "C:\Users\adminstor\anaconda3\envs\python39\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "D:\daima\KalmanNet_TSP-main\KNet\KalmanNet_nn.py", line 322, in forward return self.KNet_step(y) File "D:\daima\KalmanNet_TSP-main\KNet\KalmanNet_nn.py", line 229, in KNet_step self.step_KGain_est(y) File "D:\daima\KalmanNet_TSP-main\KNet\KalmanNet_nn.py", line 215, in step_KGain_est KG = self.KGain_step(obs_diff, obs_innov_diff, fw_evol_diff, fw_update_diff) File "D:\daima\KalmanNet_TSP-main\KNet\KalmanNet_nn.py", line 289, in KGain_step out_FC7 = self.FC7(in_FC7) File "C:\Users\adminstor\anaconda3\envs\python39\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "C:\Users\adminstor\anaconda3\envs\python39\lib\site-packages\torch\nn\modules\container.py", line 141, in forward input = module(input) File "C:\Users\adminstor\anaconda3\envs\python39\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "C:\Users\adminstor\anaconda3\envs\python39\lib\site-packages\torch\nn\modules\linear.py", line 103, in forward return F.linear(input, self.weight, self.bias) File "C:\Users\adminstor\anaconda3\envs\python39\lib\site-packages\torch\nn\functional.py", line 1848, in linear return torch._C._nn.linear(input, weight, bias) RuntimeError: mat1 and mat2 shapes cannot be multiplied (200x6 and 2x10)
时间: 2023-08-11 20:06:38 浏览: 145
浅谈Python traceback的优雅处理
这个错误是由于您正在尝试对形状不匹配的张量进行矩阵乘法操作,导致无法完成操作。
在这种情况下,您需要检查代码中涉及到矩阵乘法的部分,并确保输入的张量形状是兼容的。
根据错误消息的提示,问题出现在 `KGain_step()` 方法中的矩阵乘法操作。您需要检查 `KGain_step()` 方法中涉及到的张量的形状,并确保它们可以进行矩阵乘法操作。
在这里,您可以检查 `in_FC7` 张量、`self.FC7` 层的权重张量和偏置张量的形状是否匹配,以及 `out_FC7` 张量的形状是否与后续的矩阵乘法操作兼容。
请注意,根据您的具体情况,可能还需要检查其他涉及到矩阵乘法操作的部分。
希望这可以帮助您解决问题!如果还有其他问题,请随时提问。
阅读全文