def _get_test_program_3():
        """An iOS18 program with conv, linear, matmul, and conv_transpose."""

        @mb.program(
            input_specs=[mb.TensorSpec(shape=(1, 30, 10, 10))],
            opset_version=ct.target.iOS18,
        )
        def prog(x):
            # weight
            conv_weight = np.random.rand(90, 30, 2, 2).astype(np.float32)
            linear_weight = np.random.rand(70, 81).astype(np.float32)
            matmul_weight = np.random.rand(2, 1, 70, 35).astype(np.float32)
            conv_transpose_weight = np.random.rand(30, 4, 21, 10).astype(np.float32)

            # graph
            x = mb.conv(x=x, weight=conv_weight, name="conv")
            x = mb.reshape(x=x, shape=(1, 90, 81), name="reshape_1")
            x = mb.linear(x=x, weight=linear_weight, name="linear")
            x = mb.matmul(x=x, y=matmul_weight, transpose_y=False, name="matmul")
            x = mb.reshape(x=x, shape=(1, 30, 21, 10), name="reshape_2")
            x = mb.conv_transpose(x=x, weight=conv_transpose_weight, name="conv_transpose")
            return x

        return prog
An iOS18 program with conv, linear, matmul, and conv_transpose.
coremltools/test/optimize/coreml/test_passes.py