code: def get_pad_with_auto_pad(
      auto_pad: str, pad_shape: Sequence[int]
  ) -> Sequence[int]:
      spatial_dims = len(pad_shape)
      if auto_pad == "SAME_UPPER":
          pads = [pad_shape[i] // 2 for i in range(spatial_dims)] + [
              pad_shape[i] - pad_shape[i] // 2
              for i in range(spatial_dims)
          ]
      elif auto_pad == "SAME_LOWER":
          pads = [
              pad_shape[i] - pad_shape[i] // 2
              for i in range(spatial_dims)
          ] + [pad_shape[i] // 2 for i in range(spatial_dims)]
      else:
          pads = [0] * spatial_dims * 2  # no padding
      return pads
  
file_path: onnx/onnx/reference/ops/op_pool_common.py
imports: import itertools
  import math
  from typing import Sequence, Tuple, Union
  import numpy
  from onnx.reference.op_run import OpRun
label_desc: Use image node_id 2 for calling a global function with example usage: get_pad_with_auto_pad(auto_pad, pad_shape) and returns: pads