sweep_lidar_depth = sweep_lidar_depth.reshape(batch_size * num_cams, *sweep_lidar_depth.shape[2:])

*sweep_lidar_depth.shape[2:] 它的作用是:把一个列表或元组的每个元素解开,作为多个参数传入函数或方法中。

        batch_size, num_sweeps, num_cams, num_channels, img_height, \
            img_width = sweep_imgs.shape #[b, 1, 6, 3, 256, 704]
        img_feats = self.get_cam_feats(sweep_imgs)  #img_feats[2, 1, 6, 512, 16, 44]   <-- sweep_imgs[2, 1, 6, 3, 256, 704]
        sweep_lidar_depth = sweep_lidar_depth.reshape(
            batch_size * num_cams, *sweep_lidar_depth.shape[2:])

举个简单的例子:

shape = (1, 256, 704)
some_tensor.reshape(12, *shape)

等价于:

some_tensor.reshape(12, 1, 256, 704)

也就是说:*shape 把 (1, 256, 704) 解包为 1, 256, 704。

posted @ 2025-04-16 20:29  无左无右  阅读(9)  评论(0)    收藏  举报