code: def voxel_to_point(x, z, nearest=False):
      if (
          z.idx_query is None
          or z.weights is None
          or z.idx_query.get(x.s) is None
          or z.weights.get(x.s) is None
      ):
          kr = KernelRegion(2, x.s, 1)
          off = kr.get_kernel_offset().to(z.F.device)
          # old_hash = kernel_hash_gpu(torch.floor(z.C).int(), off)
          old_hash = spf.sphash(
              torch.cat(
                  [
                      torch.floor(z.C[:, :3] / x.s).int() * x.s,
                      z.C[:, -1].int().view(-1, 1),
                  ],
                  1,
              ),
              off,
          )
          pc_hash = spf.sphash(x.C.to(z.F.device))
          idx_query = spf.sphashquery(old_hash, pc_hash)
          weights = (
              spf.calc_ti_weights(z.C, idx_query, scale=x.s)
              .transpose(0, 1)
              .contiguous()
          )
          idx_query = idx_query.transpose(0, 1).contiguous()
          if nearest:
              weights[:, 1:] = 0.0
              idx_query[:, 1:] = -1
          new_feat = spf.spdevoxelize(x.F, idx_query, weights)
          new_tensor = PointTensor(
              new_feat, z.C, idx_query=z.idx_query, weights=z.weights
          )
          new_tensor.additional_features = z.additional_features
          new_tensor.idx_query[x.s] = idx_query
          new_tensor.weights[x.s] = weights
          z.idx_query[x.s] = idx_query
          z.weights[x.s] = weights
  
      else:
          new_feat = spf.spdevoxelize(
              x.F, z.idx_query.get(x.s), z.weights.get(x.s)
          )
          new_tensor = PointTensor(
              new_feat, z.C, idx_query=z.idx_query, weights=z.weights
          )
          new_tensor.additional_features = z.additional_features
  
      return new_tensor
  
file_path: torch-points3d/torch_points3d/modules/PVCNN/utils.py
imports: import torchsparse
  import torchsparse.nn
  import torchsparse.nn.functional
  from torchsparse.sparse_tensor import SparseTensor
  from torchsparse.point_tensor import PointTensor
  from torchsparse.utils.kernel_region import *
  from torchsparse.utils.helpers import *
label_desc: Use image node_id 3 for calling a global function with example usage: voxel_to_point(x, z, nearest) and returns: new_tensor