class_docstr: A self attention layer.
  Input is a list which consists of 4 ndarrays.
  1. Token id ndarray: shape [batch, seqLen] with the word token indices in the vocabulary
  2. Token type id ndarray: shape [batch, seqLen] with the token types in [0, 1].
     0 means `sentence A` and 1 means a `sentence B` (see BERT paper for more details).
  3. Position id ndarray: shape [batch, seqLen] with positions in the sentence.
  4. Attention_mask ndarray: shape [batch, seqLen] with indices in [0, 1].
     It's a mask to be used if the input sequence length is smaller than seqLen in
     the current batch.
  Output is a list which contains:
  1. The states of BERT 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
  n_block: block number
  n_head: head number
  intermediate_size: The size of the "intermediate" (i.e., feed-forward)
  hidden_drop: The dropout probability for all fully connected layers
  attn_drop: drop probability of attention
  initializer_ranger: weight initialization range
  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","4","ndarrays",".","1",".","Token","id","ndarray",":","shape","[","batch",",","seqLen","]","with","the","word","token","indices","in","the","vocabulary","2",".","Token","type","id","ndarray",":","shape","[","batch",",","seqLen","]","with","the","token","types","in","[","0",",","1","]",".","0","means","`","sentence","A","`","and","1","means","a","`","sentence","B","`","(","see","BERT","paper","for","more","details",")",".","3",".","Position","id","ndarray",":","shape","[","batch",",","seqLen","]","with","positions","in","the","sentence",".","4",".","Attention_mask","ndarray",":","shape","[","batch",",","seqLen","]","with","indices","in","[","0",",","1","]",".","It","'s","a","mask","to","be","used","if","the","input","sequence","length","is","smaller","than","seqLen","in","the","current","batch",".","Output","is","a","list","which","contains",":","1",".","The","states","of","BERT","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","n_block",":","block","number","n_head",":","head","number","intermediate_size",":","The","size","of","the","``","intermediate","''","(","i.e.",",","feed-forward",")","hidden_drop",":","The","dropout","probability","for","all","fully","connected","layers","attn_drop",":","drop","probability","of","attention","initializer_ranger",":","weight","initialization","range","output_all_block",":","whether","output","all","blocks","'","output","embedding_layer",":","embedding","layer","input_shape",":","input","shape"]
code: def build_input(self, input_shape):
      if (
          any(
              not isinstance(i, list) and not isinstance(i, tuple)
              for i in input_shape
          )
          and len(input_shape) != 4
      ):
          invalidInputError(
              False,
              "BERT input must be a list of 4 ndarray (consisting of input"
              " sequence, sequence positions, segment id, attention mask)",
          )
      inputs = [Input(list(shape)) for shape in input_shape]
      return (-inputs[-1] + 1.0) * -10000.0, inputs[:-1], inputs
  
imports: import numpy
  import math
  from bigdl.dllib.nn.layer import Sum
  from bigdl.dllib.nn.layer import Layer
  from bigdl.dllib.utils.file_utils import callZooFunc
  from bigdl.dllib.keras.engine import ZooKerasLayer
  from bigdl.dllib.keras.layers import *
  from bigdl.dllib.keras.models import Sequential
  from bigdl.dllib.keras.models import Model
  import bigdl.dllib.keras.autograd
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 3 for calling the BERT obj's underlying member method code with example usage: obj.build_input(input_shape) and returns: unknown,  inputs,  inputs