def test_scope_passdown_function_input_var():
        """
        If the old_var is function input var, and then the converter sets some default value for each scope source.
        """
        # Case 1: with no essential scope set, no scope information is passed down
        def get_prog():
            @mb.program(input_specs=[mb.TensorSpec(shape=(2, 4))])
            def prog(x):
                with mb.scope(
                    ScopeInfo(source=ScopeSource.TORCHSCRIPT_MODULE_TYPE, data=["module_1"]),
                ):
                    return mb.sin(x=x)
            return prog

        prog = get_prog()
        block = prog.functions["main"]
        ops = list(block.operations)

        with block:
            with mb.scope(
                ScopeInfo(source=ScopeSource.COREMLTOOLS_GRAPH_PASS, data=["pass_1"]),
            ):
                # This op is created by pass_1
                relu = mb.relu(x=block.inputs["x"], before_op=ops[0])
                block._replace_var(block.inputs["x"], relu)

        assert relu.scopes == {
            ScopeSource.COREMLTOOLS_GRAPH_PASS: ["pass_1"],
        }

        # Case 2: essential scope set to TORCHSCRIPT_MODULE_TYPE
        prog = get_prog()
        prog._add_essential_scope_source(ScopeSource.TORCHSCRIPT_MODULE_TYPE)

        block = prog.functions["main"]
        ops = list(block.operations)

        with block:
            with mb.scope(
                ScopeInfo(source=ScopeSource.COREMLTOOLS_GRAPH_PASS, data=["pass_1"]),
            ):
                # This op is created by pass_1
                relu = mb.relu(x=block.inputs["x"], before_op=ops[0])
                block._replace_var(block.inputs["x"], relu)

        assert relu.scopes == {
            ScopeSource.TORCHSCRIPT_MODULE_TYPE: ["__COREML__::TORCHSCRIPT_PLACEHOLDER"],
            ScopeSource.COREMLTOOLS_GRAPH_PASS: ["pass_1"],
        }

        # Case 3: essential scope set to TORCHSCRIPT_MODULE_NAME
        @mb.program(input_specs=[mb.TensorSpec(shape=(2, 4))])
        def prog(x):
            with mb.scope(
                ScopeInfo(source=ScopeSource.TORCHSCRIPT_MODULE_NAME, data=["module_1"]),
            ):
                return mb.sin(x=x)

        prog._add_essential_scope_source(ScopeSource.TORCHSCRIPT_MODULE_NAME)

        block = prog.functions["main"]
        ops = list(block.operations)

        with block:
            with mb.scope(
                ScopeInfo(source=ScopeSource.COREMLTOOLS_GRAPH_PASS, data=["pass_1"]),
            ):
                # This op is created by pass_1
                relu = mb.relu(x=block.inputs["x"], before_op=ops[0])
                block._replace_var(block.inputs["x"], relu)

        assert relu.scopes == {
            ScopeSource.TORCHSCRIPT_MODULE_NAME: ["__COREML__::TORCHSCRIPT_PLACEHOLDER_x"],
            ScopeSource.COREMLTOOLS_GRAPH_PASS: ["pass_1"],
        }

        # Case 4: essential scope set to EXIR_STACK_TRACE and EXIR_DEBUG_HANDLE
        @mb.program(input_specs=[mb.TensorSpec(shape=(2, 4))])
        def prog(x):
            with mb.scope(
                ScopeInfo(source=ScopeSource.EXIR_STACK_TRACE, data=["torch.sin(x)"]),
                ScopeInfo(source=ScopeSource.EXIR_DEBUG_HANDLE, data=[1]),
            ):
                return mb.sin(x=x)

        prog._add_essential_scope_source(
            [ScopeSource.EXIR_STACK_TRACE, ScopeSource.EXIR_DEBUG_HANDLE]
        )

        block = prog.functions["main"]
        ops = list(block.operations)

        with block:
            with mb.scope(
                ScopeInfo(source=ScopeSource.COREMLTOOLS_GRAPH_PASS, data=["pass_1"]),
            ):
                # This op is created by pass_1
                relu = mb.relu(x=block.inputs["x"], before_op=ops[0])
                block._replace_var(block.inputs["x"], relu)

        assert relu.scopes == {
            ScopeSource.EXIR_STACK_TRACE: [None],
            ScopeSource.EXIR_DEBUG_HANDLE: [None],
            ScopeSource.COREMLTOOLS_GRAPH_PASS: ["pass_1"],
        }

        If the old_var is function input var, and then the converter sets some default value for each scope source.
        
coremltools/converters/mil/mil/tests/test_programs.py