code: def dirichlet_loss(r, pos, f, batch_idx=None, aggr=torch.mean):
      """Computes the Dirichlet loss (or L2 norm of the gradient) of f
      Arguments:
          r -- Radius for the beighbour search
          pos -- [N,3] (or [B,N,3] for dense format)  location of each point
          f -- [N] (or [B,N] for dense format)  Value of a function at each points
          batch_idx -- [N] Batch id of each point (Only for sparse format)
          aggr -- aggregation function for the final loss value
      """
      if batch_idx is None:
          assert f.dim() == 2 and pos.dim() == 3
          return _dirichlet_dense(r, pos, f, aggr)
      else:
          assert f.dim() == 1 and pos.dim() == 2
          return _dirichlet_sparse(r, pos, f, batch_idx, aggr)
  
file_path: torch-points3d/torch_points3d/core/losses/dirichlet_loss.py
imports: import torch
  import torch_points_kernels
  from torch_cluster import radius
  from torch_scatter import scatter_add
label_desc: Use image node_id 1 for calling a global function with example usage: dirichlet_loss(r, pos, f, batch_idx, aggr) and returns: _dirichlet_dense, _dirichlet_sparse