def test_sub_byte_immediate_value():
        """
        Test the sub-byte immediate value tensor is exported as packed bytes.

        The sub-byte file value is tested in `coremltools/test/blob/test_weights.py` which
        is not in the scope of this test.
        """

        @mb.program(input_specs=[], opset_version=ct.target.iOS18)
        def prog():
            return mb.constexpr_blockwise_shift_scale(
                data=np.array([-8, 7]).reshape((1, 2, 1)).astype(types.np_int4_dtype),
                scale=np.array([4]).reshape((1, 1, 1)).astype(np.float16),
                offset=np.array([4]).reshape((1, 1, 1)).astype(types.np_int4_dtype),
            )

        mlmodel = ct.convert(
            prog,
            convert_to="mlprogram",
            minimum_deployment_target=ct.target.iOS18,
        )

        mil = mlmodel.get_spec().mlProgram
        for function in mil.functions.values():
            for block in function.block_specializations.values():
                for op in block.operations:
                    if op.type == "constexpr_blockwise_shift_scale":
                        bytes_val = (
                            op.inputs["data"].arguments[0].value.immediateValue.tensor.bytes.values
                        )
                        # The two 4-bit values should be packed into a single byte.
                        assert len(bytes_val) == 1

        Test the sub-byte immediate value tensor is exported as packed bytes.

        The sub-byte file value is tested in `coremltools/test/blob/test_weights.py` which
        is not in the scope of this test.
        
coremltools/converters/mil/backend/mil/test_load.py