code: def dead_code_elimination(program):
      """
      Eliminate unused ops in program.
  
      Parameters
      ----------
      program: Program SSA Program before graph pass
  
      Returns
      -------
      program: Program SSA Program after graph pass
  
      Example
      -------
  
          Given:
          main(%x: (2, 4, fp32)) {
            block0() {
              %const_2: (4, 2, fp32)* = const(val=[...])
              %const_3: (4, fp32)* = const(val=[...])
              %tx_0: (bool)* = const(val=False)
              %ty_0: (bool)* = const(val=False)
              %matmul_0: (2, 2, fp32) = matmul(x=%x, y=%const_2, transpose_x=%tx_0, transpose_y=%ty_0)
              %linear_0: (2, 4, fp32) = linear(x=%x, weight=%const_2, bias=%const_3)
            } -> (%linear_0)
          }
  
          Result:
          main(%x: (2, 4, fp32)) {
            block0() {
              %const_2: (4, 2, fp32)* = const(val=[...])
              %const_3: (4, fp32)* = const(val=[...])
              %linear_0: (2, 4, fp32) = linear(x=%x, weight=%const_2, bias=%const_3)
            } -> (%linear_0)
          }
  
      Ops whose outputs are not contributed to final outputs will be deleted.
      In this example, %matmul_0 is an op that's not used in the computation,
      this op and its input ops (%tx_0 and %ty_0) are eliminated in this pass.
      """
  
      for name, f in program.functions.items():
          dead_code_elimination_block(f)
  
imports: from coremltools.converters.mil.mil.passes.pass_registry import register_pass
  import logging
label_desc: Use image node_id 2 for calling a global function with example usage: dead_code_elimination(program) without return types