code: def aggregated_pad(
      pad_type,
      kernel_shape,
      input_shape=None,
      strides=None,
      dilations=None,
      custom_pad=None,
  ):
      """
      Args
          pad_type: string. Must be one of ('same', 'valid', 'custom')
  
          kernel_shape: [kH, kW, ...]: spatial kernel dims (excluding channels)
  
          input_shape: [iH, iW, ...]: spatial input dims (excluding channels)
              Required iff pad_type == 'same'
  
          strides: [sH, sW, ...]: spatial strides (excluding channels)
              Required iff pad_type == 'same'
  
          dilations: [dH, dW, ...]: dilations (excluding channels)
              If not provided, defaults to [1, 1, ...], effectively no dilation.
  
          custom_pad: Required iff pad_type == 'custom'.
              custom_pad[2*i], custom_pad[2*i+1] are before/after custom padding
              for spatial dim i.
  
  
      Returns:
          A list of total (before + after) padding for each spatial dimension in kernel_shape.
      """
      num_spatial_dims = len(kernel_shape)
      if dilations is None:
          dilations = [1] * num_spatial_dims
      elif len(dilations) != num_spatial_dims:
          raise ValueError(
              "dilations must have same length as kernel_shape ({}, but got {})".format(
                  num_spatial_dims, len(dilations)
              )
          )
      if pad_type == "same":
          if (
              input_shape is None
              or len(input_shape) != num_spatial_dims
          ):
              raise ValueError(
                  "For SAME padding input_shape must not be None and must have "
                  "same length as kernel_shape ({}, but got {})".format(
                      num_spatial_dims,
                      len(input_shape)
                      if input_shape is not None
                      else "None",
                  )
              )
          if strides is None or len(strides) != num_spatial_dims:
              raise ValueError(
                  "For SAME padding strides must not be None and must have "
                  "same length as kernel_shape ({}, but got {})".format(
                      num_spatial_dims,
                      len(strides) if strides is not None else "None",
                  )
              )
          effective_ks = effective_kernel(kernel_shape, dilations)
          return [
              int(
                  max(0, s * math.ceil(float(i) / float(s)) - i + k - s)
              )
              for i, k, s in zip(input_shape, effective_ks, strides)
          ]
      if pad_type == "valid":
          return [0] * num_spatial_dims
      if pad_type == "custom":
          if (
              custom_pad is None
              or len(custom_pad) != 2 * num_spatial_dims
          ):
              raise ValueError("Invalid custom_pad.")
          return [
              custom_pad[2 * d] + custom_pad[2 * d + 1]
              for d in range(num_spatial_dims)
          ]
      raise ValueError('Invalid padding pad_type "{}"'.format(pad_type))
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/mil/ops/defs/_utils.py
imports: import math
  import coremltools.converters
  import sympy
  from coremltools.converters.mil.mil.types.symbolic import is_symbolic
  from ._op_reqs import *
label_desc: Use image node_id 4 for calling a global function with example usage: aggregated_pad(pad_type, kernel_shape, input_shape, strides, dilations, custom_pad) and returns: unknown, unknown, unknown