code: def nn_distance(pc1, pc2, l1smooth=False, delta=1.0, l1=False):
      """
      Input:
          pc1: (B,N,C) torch tensor
          pc2: (B,M,C) torch tensor
          l1smooth: bool, whether to use l1smooth loss
          delta: scalar, the delta used in l1smooth loss
      Output:
          dist1: (B,N) torch float32 tensor
          idx1: (B,N) torch int64 tensor
          dist2: (B,M) torch float32 tensor
          idx2: (B,M) torch int64 tensor
      """
      N = pc1.shape[1]
      M = pc2.shape[1]
      pc1_expand_tile = pc1.unsqueeze(2).repeat(1, 1, M, 1)
      pc2_expand_tile = pc2.unsqueeze(1).repeat(1, N, 1, 1)
      pc_diff = pc1_expand_tile - pc2_expand_tile
  
      if l1smooth:
          pc_dist = torch.sum(
              huber_loss(pc_diff, delta), dim=-1
          )  # (B,N,M)
      elif l1:
          pc_dist = torch.sum(torch.abs(pc_diff), dim=-1)  # (B,N,M)
      else:
          pc_dist = torch.sum(pc_diff**2, dim=-1)  # (B,N,M)
      dist1, idx1 = torch.min(pc_dist, dim=2)  # (B,N)
      dist2, idx2 = torch.min(pc_dist, dim=1)  # (B,M)
      return dist1, idx1, dist2, idx2
  
imports: import torch
label_desc: Use image node_id 1 for calling a global function with example usage: nn_distance(pc1, pc2, l1smooth, delta, l1) and returns: dist1,  idx1,  dist2,  idx2