code: def test_gelu_tanh_approximation():
      """
      Detect gelu tanh approx pattern, found in the TF bert model.
      y = ( tanh((.0447)x^3 + x ) * (sqrt(2/pi)) + 1 ) * 0.5 * x
      """
  
      @mb.program(input_specs=[mb.TensorSpec(shape=(3, 5, 6))])
      def prog(x):
          x1 = mb.pow(x=x, y=3)
          x1 = mb.mul(x=0.044715, y=x1)
          x1 = mb.add(x=x1, y=x)
          x1 = mb.mul(x=x1, y=np.sqrt(2 / np.pi))
          x1 = mb.tanh(x=x1)
          x1 = mb.add(x=1, y=x1)
          x1 = mb.mul(x=0.5, y=x1)
          x1 = mb.mul(x=x, y=x1)
          return x1
  
      prev_prog, prev_block, block = apply_pass_and_basic_check(
          prog, "common::fuse_gelu_tanh_approximation"
      )
      assert get_op_types_in_program(prev_prog) == [
          "pow",
          "mul",
          "add",
          "mul",
          "tanh",
          "add",
          "mul",
          "mul",
      ]
      assert get_op_types_in_program(prog) == ["gelu"]
      assert_model_is_valid(
          prog,
          {"x": (3, 5, 6)},
          expected_output_shapes={block.outputs[0].name: (3, 5, 6)},
      )
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/mil/passes/test_passes.py
imports: from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.testing_utils import assert_op_count_match, assert_model_is_valid, assert_same_output_names, get_op_types_in_program, apply_pass_and_basic_check
  from coremltools.converters.mil.mil import Symbol, types
  from coremltools.converters.mil.mil.passes.pass_registry import PASS_REGISTRY
  import copy
  import pytest
  import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: test_gelu_tanh_approximation() and returns: x1