def test_eliminate_transpose(self, axis):
        """
        Input graph:
            data -> constexpr_affine_dequantize -> transpose

        Output graph:
            new_data -> constexpr_affine_dequantize

        where new_data is the value after applying transpose to data
        """
        SHAPE = (1, 2, 3, 4)
        quantized_data = np.random.randint(0, 256, SHAPE).astype(np.int8)
        if axis is None:
            axis = 0  # although tensor-wise, constexpr_affine_dequantize requires a (dummy) axis
            scale = np.random.rand()
            zero_point = np.random.randint(-127, 128, dtype=np.int8)
        else:
            size = SHAPE[axis]
            scale = np.random.rand(size)
            zero_point = np.random.randint(-127, 128, size, dtype=np.int8)

        @mb.program(input_specs=[], opset_version=ct.target.iOS16)
        def prog():
            res = mb.constexpr_affine_dequantize(
                quantized_data=quantized_data,
                axis=axis,
                scale=scale,
                zero_point=zero_point,
            )
            return mb.transpose(x=res, perm=(2, 0, 1, 3))

        apply_pass_and_basic_check(prog, "common::merge_affine_dequantize_with_consecutive_ops")
        assert get_op_types_in_program(prog) == ["constexpr_affine_dequantize"]

        new_op = prog.find_ops(op_type="constexpr_affine_dequantize", exactly_one=True)[0]
        expected_quantized_data = np.transpose(quantized_data, (2, 0, 1, 3))
        np.testing.assert_array_equal(new_op.quantized_data.val, expected_quantized_data)

        Input graph:
            data -> constexpr_affine_dequantize -> transpose

        Output graph:
            new_data -> constexpr_affine_dequantize

        where new_data is the value after applying transpose to data
        
coremltools/converters/mil/mil/passes/tests/test_quantization_passes.py