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/utils/utils.py
imports: import os
  import pickle
  import numpy
  import SimpleITK
  from copy import deepcopy
  from typing import Union, Tuple
  from tools.preprocess_utils.preprocessing import get_do_separate_z, get_lowres_axis, resample_data_or_seg
label_desc: Use image node_id 3 for calling a global function with example usage: sum_tensor(inp, axes, keepdim) and returns: inp