code: def test_remove_op2():
      """Test remove ops with multiple identical inputs"""
  
      @mb.program(input_specs=[mb.TensorSpec(shape=(2, 4))])
      def prog(x0):
          x1 = mb.add(x=x0, y=x0)
          return x1
  
      print("before:\n{}".format(prog))
      block = prog.functions["main"]
      x0 = block.inputs["x0"]
      ops = block.find_ops(op_type="add")
      block.set_outputs([x0])
      block.remove_ops(ops)
      print("after:\n{}".format(prog))
      assert len(block.operations) == 0
      assert len(block.inputs) == 1
      assert len(block.outputs) == 1
      assert block.inputs["x0"] == block.outputs[0]
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/mil/tests/test_block.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.testing_utils import get_op_types_in_program, assert_same_output_shapes, assert_same_output_names
  import copy
label_desc: Use image node_id 4 for calling a global function with example usage: test_remove_op2() and returns: x1