class_docstr: Identify a reflection padding layer composed out of `slices` and `concats`.
  
  .. code-block::
  
      Input graph:
  
              ------------------------------------------------------------------------------------- |
              |                                                                                     v
      input(1, 2, 6, 8) ------> slice_by_index(begin=[0, 0, 0, 1], end=[0, 0, 0, 2]) -----> concat(axis=3) ---> out(1, 2, 6, 10)
              |                                                                                     ^
              ----------------> slice_by_index(begin=[0, 0, 0, -2], end=[0, 0, 0, -1]) -------------|
  
  
      Output graph:
  
      input(1, 2, 6, 8) -----0> pad(mode=reflect, size=[0, 0, 1, 1]) -----> out(1, 2, 6, 10)
class_docstr_tok: ["Identify","a","reflection","padding","layer","composed","out","of","`","slices","`","and","`","concats","`",".","..","code-block",":",":","Input","graph",":","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","--","-","|","|","v","input","(","1",",","2",",","6",",","8",")","--","--","--",">","slice_by_index","(","begin=","[","0",",","0",",","0",",","1","]",",","end=","[","0",",","0",",","0",",","2","]",")","--","--","-",">","concat","(","axis=3",")","--","-",">","out","(","1",",","2",",","6",",","10",")","|","^","--","--","--","--","--","--","--","--",">","slice_by_index","(","begin=","[","0",",","0",",","0",",","-2","]",",","end=","[","0",",","0",",","0",",","-1","]",")","--","--","--","--","--","--","-|","Output","graph",":","input","(","1",",","2",",","6",",","8",")","--","--","-0",">","pad","(","mode=reflect",",","size=","[","0",",","0",",","1",",","1","]",")","--","--","-",">","out","(","1",",","2",",","6",",","10",")"]
code: def _replace_ops(block, concat_op, slice_ops, axis):
      pad_size = len(slice_ops) // 2
      if axis == -1:
          pad = [pad_size, pad_size]
      elif axis == -2:
          pad = [pad_size, pad_size, 0, 0]
      else:
          return False
  
      x = mb.pad(
          x=slice_ops[0].inputs["x"],
          pad=pad,
          mode="reflect",
          before_op=concat_op,
      )
      concat_op.enclosing_block.replace_uses_of_var_after_op(
          anchor_op=concat_op, old_var=concat_op.outputs[0], new_var=x
      )
  
      block.remove_ops([concat_op] + slice_ops)
      return True
  
imports: import numpy
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget
  from coremltools.converters.mil.frontend._utils import value_at
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil.block import is_current_opset_version_compatible_with
  from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass
  from coremltools.converters.mil.mil.passes.helper import _check_child_op_type, _check_var_scalar_value, block_context_manager
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
  from coremltools.converters.mil.mil.types.symbolic import any_symbolic
label_desc: Use image node_id 3 for calling the use_reflection_padding obj's underlying member method code with example usage: obj._replace_ops(block, concat_op, slice_ops, axis) and returns: True, False