def test_binary_op_with_constant_input(self):
        """
        Input graph:
                                                                const (shape=(4,3))
                                                                     |
        input (shape=(1,4,3,2)) --> transpose (shape=(1,2,4,3)) --> add --> transpose --> relu

        Output graph:

                             const (shape=(1,4,3,1))
                                     |
        input (shape=(1,4,3,2)) --> add --> relu
        """

        @mb.program(input_specs=[mb.TensorSpec(shape=(1, 4, 3, 2))])
        def prog(x):
            x = mb.transpose(x=x, perm=[0, 3, 1, 2])
            x = mb.add(x=x, y=np.array(np.ones(shape=(4, 3))))
            x = mb.transpose(x=x, perm=[0, 2, 3, 1])
            x = mb.relu(x=x)
            return x

        prev_prog, prev_block, block = apply_pass_and_basic_check(prog, "common::reduce_transposes")
        self.assertEqual(
            get_op_types_in_program(prev_prog),
            ["transpose", "add", "transpose", "relu"],
        )
        self.assertEqual(get_op_types_in_program(prog), ["add", "relu"])
        assert_model_is_valid(
            prog,
            {"x": (1, 4, 3, 2)},
            expected_output_shapes={block.outputs[0].name: (1, 4, 3, 2)},
        )

        Input graph:
                                                                const (shape=(4,3))
                                                                     |
        input (shape=(1,4,3,2)) --> transpose (shape=(1,2,4,3)) --> add --> transpose --> relu

        Output graph:

                             const (shape=(1,4,3,1))
                                     |
        input (shape=(1,4,3,2)) --> add --> relu
        
coremltools/converters/mil/mil/passes/tests/test_reduce_transposes_pass.py