path_temp = '../m39_data/temp3' #文件目录 file_name = os.path.join(path_temp, "setQ.txt") Q = np.array(iekf.Q.detach().numpy()) # tensor转换成array np.savetxt(file_name, Q)