code: def _AdjustDims(op_def, arg_map, pads, dim1, dim2):
      n1, c1, h1, w1 = dim1
      n2, c2, h2, w2 = dim2
      assert n1 == n2
      assert c1 == c2
      is_pad = "pad" in arg_map
      if h1 != h2 or w1 != w2:
          if h1 == h2 + 1:
              pads["pad_b"] += 1
          elif h1 != h2:
              raise Exception(
                  "Unexpected dimensions for height:", h1, h2
              )
          if w1 == w2 + 1:
              pads["pad_r"] += 1
          elif w1 != w2:
              raise Exception(
                  "Unexpected dimensions for width:", w1, w2
              )
          if is_pad:
              op_def.arg.remove(arg_map["pad"])
              args = []
              for name in pads.keys():
                  arg = caffe2_pb2.Argument()
                  arg.name = name
                  arg.i = pads[name]
                  args.append(arg)
              op_def.arg.extend(args)
          else:
              for name in pads.keys():
                  arg_map[name].i = pads[name]
  
imports: import argparse
  import copy
  import logging
  import re
  import numpy
  from caffe2.proto import caffe2_pb2, caffe2_legacy_pb2
  from caffe.proto import caffe_pb2
  from caffe2.python import core, utils, workspace
  from google.protobuf import text_format
label_desc: Use image node_id 5 for calling a global function with example usage: _AdjustDims(op_def, arg_map, pads, dim1, dim2) without return types