tensor利用列表切片出现的神金问题
很神经。。。花俩小时解决了一个切片问题。。。
his_gmap_img_fts = nav_inputs['gmap_img_fts'] # tensor shape(batch_size,num_gmap_len,768)
his_gmap_step_ids = nav_inputs['gmap_step_ids']
his_gmap_pos_fts = nav_inputs['gmap_pos_fts']
if his_gmap_img_fts is not None:
if len(pre_not_done_index) != len(not_done_index): # 有的环境执行完毕
done_index_list=done_index(pre_not_done_index,not_done_index) # 剩余的环境索引列表
# print(f"done_index_list:{done_index_list}")
# ==========错误代码===============
# his_gmap_img_fts = his_gmap_img_fts[done_index_list]
# his_gmap_step_ids = his_gmap_step_ids[done_index_list]
# his_gmap_pos_fts = his_gmap_pos_fts[done_index_list]
# ==========正确代码===============
his_gmap_img_fts = nav_inputs['gmap_img_fts'][done_index_list]
his_gmap_step_ids = nav_inputs['gmap_step_ids'][done_index_list]
his_gmap_pos_fts = nav_inputs['gmap_pos_fts'][done_index_list]
也不知道为什么。。。