code: def segment_pool(data, segment_ids, pool_type, name=None):
      """
      Segment Operator.
      """
      pool_type = pool_type.upper()
      if pool_type == "SUM":
          return paddle.geometric.segment_sum(data, segment_ids, name)
      elif pool_type == "MEAN":
          return paddle.geometric.segment_mean(data, segment_ids, name)
      elif pool_type == "MAX":
          return paddle.geometric.segment_max(data, segment_ids, name)
      elif pool_type == "MIN":
          return paddle.geometric.segment_min(data, segment_ids, name)
      else:
          raise ValueError(
              "We only support sum, mean, max, min pool types in segment_pool function."
          )
  
file_path: PGL/pgl/math.py
imports: import paddle
  from pgl.utils.op import get_index_from_counts
label_desc: Use image node_id 1 for calling a global function with example usage: segment_pool(data, segment_ids, pool_type, name) and returns: paddle, paddle, paddle, paddle