class_docstr: Topologically re-orders the list of operations in a program by places each operation closer to its
  first use, or at the end if it's not consumed by any other operation.
  
  Currently, This pass re-orders only Transpose and Cast operations.
  
  .. code-block::
  
      # Example: input program
      main(x: (2, 4, fp32)) {
          x = mb.cast(x=x, dtype="fp16")
          x1 = mb.square(x=x)
          x1_t = mb.transpose(x=x1, perm=[1, 0])
          x2 = mb.cast(x=x1_t, dtype="fp32")
          x3 = mb.log(x=x)
          x3_t = mb.transpose(x=x3, perm=[1, 0])
          x4 = mb.cast(x=x3_t, dtype="fp32")
          x5 = mb.relu(x=x)
          x6 = mb.cast(x=x5, dtype="fp32")
          x7 = mb.relu(x=x6)
          x8 = mb.relu(x=x)
      } -> x2, x4, x7, x8
  
      # After moving `cast` ops becomes
      main(x: (2, 4, fp32)) {
          x = mb.cast(x=x, dtype="fp16")
          x1 = mb.square(x=x)
          x1_t = mb.transpose(x=x1, perm=[1, 0])
          x3 = mb.log(x=x)
          x3_t = mb.transpose(x=x3, perm=[1, 0])
          x5 = mb.relu(x=x)
          x6 = mb.cast(x=x5, dtype="fp32")
          x7 = mb.relu(x=x6)
          x8 = mb.relu(x=x)
          x4 = mb.cast(x=x3_t, dtype="fp32")
          x2 = mb.cast(x=x1_t, dtype="fp32")
      } -> x2, x4, x7, x8
  
      # After moving `transpose` ops becomes
      main(x: (2, 4, fp32)) {
          x = mb.cast(x=x, dtype="fp16")
          x1 = mb.square(x=x)
          x3 = mb.log(x=x)
          x5 = mb.relu(x=x)
          x6 = mb.cast(x=x5, dtype="fp32")
          x7 = mb.relu(x=x6)
          x8 = mb.relu(x=x)
          x3_t = mb.transpose(x=x3, perm=[1, 0])
          x4 = mb.cast(x=x3_t, dtype="fp32")
          x1_t = mb.transpose(x=x1, perm=[1, 0])
          x2 = mb.cast(x=x1_t, dtype="fp32")
      } -> x2, x4, x7, x8
code: def apply(self, prog):
      for f_name, f in prog.functions.items():
          self._move_operations_to_the_end_block(
              f, ["cast", "transpose"]
          )
  
file_path: coremltools/coremltools/converters/mil/mil/passes/defs/cleanup/topological_reorder.py
imports: from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil.passes.graph_pass import AbstractGraphPass
  from coremltools.converters.mil.mil.passes.helper import block_context_manager
  from coremltools.converters.mil.mil.passes.pass_registry import register_pass
label_desc: Use image node_id 1 for calling the topological_reorder obj's underlying member method code with example usage: obj.apply(prog) without return types