def test_single_pass_without_creating_new_var(self):
        """
        Input:

            x
            -> relu(torch_scope="module_1")
            -> relu(torch_scope="module_2")
            -> relu(torch_scope="module_3")
            -> output

        Output:

            x
            -> relu(torch_scope="module_1")
            -> output

        In the above case, the relu op preserves its original scope information, since the graph pass only reconnects the graph.
        """

        @mb.program(input_specs=[mb.TensorSpec(shape=(1, 2, 3, 4))])
        def prog(x):
            with mb.scope(
                ScopeInfo(source=ScopeSource.TORCHSCRIPT_MODULE_TYPE, data="module_1"),
            ):
                x = mb.relu(x=x)

            with mb.scope(
                ScopeInfo(source=ScopeSource.TORCHSCRIPT_MODULE_TYPE, data="module_2"),
            ):
                x = mb.relu(x=x)

            with mb.scope(
                ScopeInfo(source=ScopeSource.TORCHSCRIPT_MODULE_TYPE, data="module_3"),
            ):
                return mb.relu(x=x)

        prog._add_essential_scope_source(ScopeSource.TORCHSCRIPT_MODULE_TYPE)

        apply_pass_and_basic_check(prog, "common::merge_consecutive_relus")
        assert get_op_types_in_program(prog) == ["relu"]

        # the scope info in the relu op is not affected
        relu_op = prog.find_ops(op_type="relu")[0]
        assert len(relu_op.scopes) == 1
        assert relu_op.scopes[ScopeSource.TORCHSCRIPT_MODULE_TYPE] == ["module_1"]

        Input:

            x
            -> relu(torch_scope="module_1")
            -> relu(torch_scope="module_2")
            -> relu(torch_scope="module_3")
            -> output

        Output:

            x
            -> relu(torch_scope="module_1")
            -> output

        In the above case, the relu op preserves its original scope information, since the graph pass only reconnects the graph.
        
coremltools/converters/mil/mil/passes/tests/test_passes.py