code: def test_residual_with_unmaterialized_output(self):
      @mb.program(input_specs=[mb.TensorSpec(shape=(2, 5))])
      def prog(x):
          x1 = mb.transpose(x=x, perm=[1, 0])
          t1 = mb.transpose(x=x1, perm=[1, 0])
          x2 = mb.reduce_mean(x=t1, axes=[1], keep_dims=True)
          t2 = mb.transpose(x=x2, perm=[1, 0])
          return mb.add(x=x1, y=t2)
  
      prev_prog, prev_block, block = apply_pass_and_basic_check(
          prog, "common::reduce_transposes"
      )
      self.assertEqual(
          get_op_types_in_program(prev_prog),
          ["transpose", "transpose", "reduce_mean", "transpose", "add"],
      )
      self.assertEqual(
          get_op_types_in_program(prog),
          ["reduce_mean", "add", "transpose"],
      )
  
      assert_model_is_valid(
          prog,
          {"x": (2, 5)},
          expected_output_shapes={block.outputs[0].name: (5, 2)},
      )
  
imports: from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.testing_utils import assert_op_count_match, assert_model_is_valid, get_op_types_in_program, apply_pass_and_basic_check
  import unittest
  import pytest
  import numpy
label_desc: Use image node_id 30 for calling the TransposeOptimizationPass obj's underlying member method code with example usage: obj.test_residual_with_unmaterialized_output() and returns: mb