class_docstr: A self attention layer
  
  Input is a list which consists of 2 ndarrays.
  1. Token id ndarray: shape [batch, seqLen] with the word token indices in the vocabulary
  2. Position id ndarray: shape [batch, seqLen] with positions in the sentence.
  Output is a list which contains:
  1. The states of Transformer layer.
  2. The pooled output which processes the hidden state of the last layer with regard to the first
  token of the sequence. This would be useful for segment-level tasks.
  
  # Arguments
  nBlock: block number
  hidden_drop: drop probability off projection
  attn_drop: drop probability of attention
  n_head: head number
  initializer_range: weight initialization range
  bidirectional: whether unidirectional or bidirectional
  output_all_block: whether output all blocks' output
  embedding_layer: embedding layer
  input_shape: input shape
class_docstr_tok: ["A","self","attention","layer","Input","is","a","list","which","consists","of","2","ndarrays",".","1",".","Token","id","ndarray",":","shape","[","batch",",","seqLen","]","with","the","word","token","indices","in","the","vocabulary","2",".","Position","id","ndarray",":","shape","[","batch",",","seqLen","]","with","positions","in","the","sentence",".","Output","is","a","list","which","contains",":","1",".","The","states","of","Transformer","layer",".","2",".","The","pooled","output","which","processes","the","hidden","state","of","the","last","layer","with","regard","to","the","first","token","of","the","sequence",".","This","would","be","useful","for","segment-level","tasks",".","#","Arguments","nBlock",":","block","number","hidden_drop",":","drop","probability","off","projection","attn_drop",":","drop","probability","of","attention","n_head",":","head","number","initializer_range",":","weight","initialization","range","bidirectional",":","whether","unidirectional","or","bidirectional","output_all_block",":","whether","output","all","blocks","'","output","embedding_layer",":","embedding","layer","input_shape",":","input","shape"]
code: def gelu(self, x):
      y = (auto.square(x) * x * 0.044715 + x) * (math.sqrt(2 / math.pi))
      y = Activation("tanh")(y) + 1.0
      y = x * 0.5 * y
      return y
  
imports: import numpy
  import math
  from bigdl.nn.layer import Sum
  from bigdl.nn.layer import Layer
  from zoo.common.utils import callZooFunc
  from zoo.models.common import ZooModel
  from zoo.pipeline.api.keras.engine import ZooKerasLayer
  from zoo.pipeline.api.keras.layers import *
  from zoo.pipeline.api.keras.models import Sequential
  from zoo.pipeline.api.keras.models import Model
  import zoo.pipeline.api.autograd
label_desc: Use image node_id 8 for calling the TransformerLayer obj's underlying member method code with example usage: obj.gelu(x) and returns: y