def test_builder_eval_sparse_per_block(self):
        """
        Test per-block de-quantization on sparse tensor with block size 2.

        data_mask = [[1, 1, 0, 0], [1, 1, 1, 0], [0, 0, 1, 1], [1, 1, 0, 1]]  # shape [4, 4]
        nonzero_data = [10, 11, 3, 4, 5, 6, 7, 8, 9, 2]
        scale = [[0.1, 0.2], [0.3, 0.4], [0.5, 0.6], [0.7, 0.8]]  # shape [4, 2] because block size is [1, 2]
        offset = [[1, 2], [3, 4], [5, 6], [7, 8]]
        The sparse tensor in the dense layout would look like:
         10   11
          3    4    5
                    6    7
          8    9         2

        The input `nonzero_data` would be dequantized per-column as in the dense layout, and the
        output sparse tensor in the dense layout would be:
         (10-1)*0.1   (11-1)*0.1
          (3-3)*0.3    (4-3)*0.3    (5-4)*0.4
                                    (6-6)*0.6    (7-6)*0.6
          (8-7)*0.7    (9-7)*0.7                 (2-8)*0.8

        The first output would be the same as the `data_mask`,
        The second output would be [0.9, 1.0, 0.0, 0.3, 0.4, 0.0, 0.6, 0.7, 1.4, -4.8]
        """

        @mb.program(input_specs=[], opset_version=_IOS18_TARGET)
        def prog():
            return mb.constexpr_sparse_blockwise_shift_scale(
                data_mask=np.array([[1, 1, 0, 0], [1, 1, 1, 0], [0, 0, 1, 1], [1, 1, 0, 1]]).astype(
                    types.np_uint1_dtype
                ),
                nonzero_data=np.array([10, 11, 3, 4, 5, 6, 7, 8, 9, 2]).astype(np.int8),
                scale=np.array([[0.1, 0.2], [0.3, 0.4], [0.5, 0.6], [0.7, 0.8]]),
                offset=np.array([[1, 2], [3, 4], [5, 6], [7, 8]]).astype(np.int8),
            )

        constexpr_sparse_blockwise_shift_scale_op = prog.functions["main"].find_ops(
            op_type="constexpr_sparse_blockwise_shift_scale"
        )[0]
        expected_output_mask = np.array([[1, 1, 0, 0], [1, 1, 1, 0], [0, 0, 1, 1], [1, 1, 0, 1]])
        expected_output_nonzero_data = np.array([0.9, 1.0, 0.0, 0.3, 0.4, 0.0, 0.6, 0.7, 1.4, -4.8])
        output_mask, output_nonzero_data = constexpr_sparse_blockwise_shift_scale_op.outputs[
            0
        ].op.materialized_val_inference()
        np.testing.assert_allclose(output_mask, expected_output_mask)
        np.testing.assert_allclose(output_nonzero_data, expected_output_nonzero_data)

        Test per-block de-quantization on sparse tensor with block size 2.

        data_mask = [[1, 1, 0, 0], [1, 1, 1, 0], [0, 0, 1, 1], [1, 1, 0, 1]]  # shape [4, 4]
        nonzero_data = [10, 11, 3, 4, 5, 6, 7, 8, 9, 2]
        scale = [[0.1, 0.2], [0.3, 0.4], [0.5, 0.6], [0.7, 0.8]]  # shape [4, 2] because block size is [1, 2]
        offset = [[1, 2], [3, 4], [5, 6], [7, 8]]
        The sparse tensor in the dense layout would look like:
         10   11
          3    4    5
                    6    7
          8    9         2

        The input `nonzero_data` would be dequantized per-column as in the dense layout, and the
        output sparse tensor in the dense layout would be:
         (10-1)*0.1   (11-1)*0.1
          (3-3)*0.3    (4-3)*0.3    (5-4)*0.4
                                    (6-6)*0.6    (7-6)*0.6
          (8-7)*0.7    (9-7)*0.7                 (2-8)*0.8

        The first output would be the same as the `data_mask`,
        The second output would be [0.9, 1.0, 0.0, 0.3, 0.4, 0.0, 0.6, 0.7, 1.4, -4.8]
        
coremltools/converters/mil/mil/ops/tests/iOS18/test_compression.py