def initialize_conditional_volumes(self, dense_volume_lod0, dense_volume_mask_lod0,
                                       sparse_volume_lod0=None, sparse_coords_lod0=None):
        """

        :param dense_volume_lod0: [1,C,dX,dY,dZ]
        :param dense_volume_mask_lod0: [1,1,dX,dY,dZ]
        :param dense_volume_lod1:
        :param dense_volume_mask_lod1:
        :return:
        """

        if sparse_volume_lod0 is None:
            device = dense_volume_lod0.device
            _, C, dX, dY, dZ = dense_volume_lod0.shape

            dense_volume_lod0 = dense_volume_lod0.view(C, dX * dY * dZ).permute(1, 0).contiguous()
            mask_lod0 = dense_volume_mask_lod0.view(dX * dY * dZ) > 0

            self.sparse_volume_lod0 = SdfVolume(dense_volume_lod0[mask_lod0], type='sparse')

            coords = generate_grid(self.vol_dims, 1)[0]  # [3, dX, dY, dZ]
            coords = coords.view(3, dX * dY * dZ).permute(1, 0).to(device)
            self.sparse_coords_lod0 = torch.nn.Parameter(coords[mask_lod0], requires_grad=False)
        else:
            self.sparse_volume_lod0 = SdfVolume(sparse_volume_lod0, type='sparse')
            self.sparse_coords_lod0 = torch.nn.Parameter(sparse_coords_lod0, requires_grad=False)


        :param dense_volume_lod0: [1,C,dX,dY,dZ]
        :param dense_volume_mask_lod0: [1,1,dX,dY,dZ]
        :param dense_volume_lod1:
        :param dense_volume_mask_lod1:
        :return:
        
mv-diffusion/One-2-3-45-by-view/reconstruction/models/sparse_sdf_network.py