code: def sum_tensor(inp, axes, keepdim=False):
      axes = np.unique(axes).astype(int)
      if keepdim:
          for ax in axes:
              inp = inp.sum(int(ax), keepdim=True)
      else:
          for ax in sorted(axes, reverse=True):
              inp = inp.sum(int(ax))
      return inp
  
file_path: PaddleSeg/contrib/MedicalSeg/nnunet/losses/dice_and_ce_loss.py
imports: import numpy
  import paddle
  from paddle import nn
  import paddle.nn.functional
  from medicalseg.cvlibs import manager
label_desc: Use image node_id 2 for calling a global function with example usage: sum_tensor(inp, axes, keepdim) and returns: inp