def instancenorm_3(x):
        """
        Detect InstanceNorm pattern in TensorFlow-Addons.

        This pattern corresponds to, should be fused as instance_norm.
        All of the following must be satisfy:
        1) Input is rank 4 tensor
        2) Reduce operates on spatial dimensions axes=[-2, -1], or axes=[-3, -2] (a
           channel first to channel last transpose would be inserted in such case)
        3) Gamma and beta are absent. Default values for gamma and beta would be used.

               |-------------------------------------------------------|
               |                                                       |
               |                                                       V
        x --> main_reduce   square --> mean1 --> add_eps --> rsqrt --> mul2 --> mul_sub
        |      |             ^                                |                   |
        |      V             |                                |                   |
        | --> sub -----------|                                |                   |
        |                                                     V                   V
        |--------------------------------------------------> mul1 -------------> add --> ...
        """

        main_reduce = mb.reduce_mean(x=x, axes=[2, 3], keep_dims=True, name="main_reduce")
        sub = mb.sub(x=x, y=main_reduce, name="sub")
        square = mb.square(x=sub, name="square")
        mean1 = mb.reduce_mean(x=square, axes=[2, 3], keep_dims=True, name="mean1")
        add_epsilon = mb.add(x=mean1, y=1e-5, name="add_epsilon")  # epsilon
        rsqrt = mb.rsqrt(x=add_epsilon, name="rsqrt")
        mul1 = mb.mul(x=rsqrt, y=x, name="mul1")
        mul2 = mb.mul(x=main_reduce, y=rsqrt, name="mul2")
        mul_sub = mb.mul(x=mul2, y=-1, name="mul_sub")
        add = mb.add(x=mul1, y=mul_sub, name="add")
        return add

        Detect InstanceNorm pattern in TensorFlow-Addons.

        This pattern corresponds to, should be fused as instance_norm.
        All of the following must be satisfy:
        1) Input is rank 4 tensor
        2) Reduce operates on spatial dimensions axes=[-2, -1], or axes=[-3, -2] (a
           channel first to channel last transpose would be inserted in such case)
        3) Gamma and beta are absent. Default values for gamma and beta would be used.

               |-------------------------------------------------------|
               |                                                       |
               |                                                       V
        x --> main_reduce   square --> mean1 --> add_eps --> rsqrt --> mul2 --> mul_sub
        |      |             ^                                |                   |
        |      V             |                                |                   |
        | --> sub -----------|                                |                   |
        |                                                     V                   V
        |--------------------------------------------------> mul1 -------------> add --> ...
        
coremltools/converters/mil/experimental/passes/generic_layernorm_instancenorm_pattern_fusion.py