def _reduce_transposes_block(block):
        """
        Only apply the optimization if the block is flat,
        i.e, it does not contain any op which contains a sub-block.
        TODO:
        Removing transposes and transpose compliments requires re-running
        type inference for the set of ops in between the fused transpose ops,
        which is simpler to do when all the ops in the block are free of sub blocks.
        The case of transpose fusion with sub-block containing ops needs to be handled with more care and test cases.
        """
        for op in block.operations:
            if len(op.blocks) > 0:
                return

        with block:
            opt_transposes = _TransposeOptimization(block)
            opt_transposes.block_traversal()
            opt_transposes.apply_transform()

        Only apply the optimization if the block is flat,
        i.e, it does not contain any op which contains a sub-block.
        TODO:
        Removing transposes and transpose compliments requires re-running
        type inference for the set of ops in between the fused transpose ops,
        which is simpler to do when all the ops in the block are free of sub blocks.
        The case of transpose fusion with sub-block containing ops needs to be handled with more care and test cases.
        
coremltools/converters/mil/mil/passes/defs/optimize_repeat_ops.py