parameters: (self, input_ids: str, layernorm: NodeProto, word_embedding_gather: NodeProto,
                            position_embedding_gather: NodeProto, segment_embedding_gather: Union[None, NodeProto],
                            position_ids: str = None, embedding_sum_output = False)
return_statement: return embed_node
docstring: Create an EmbedLayerNormalization node. Note that segment embedding is optional.
  
          Args:
              input_ids (str): input_ids for word embeddings
              layernorm (NodeProto): LayerNormalization or SkipLayerNormalization node.
              word_embedding_gather (NodeProto): the Gather node for word embedding
              position_embedding_gather (NodeProto): the Gather node for position embedding
              segment_embedding_gather (Union[None, NodeProto]): the Gather node for segment embedding, or None.
  
          Returns:
              NodeProto: the EmbedLayerNormalization node created.
docstring_summary: Create an EmbedLayerNormalization node. Note that segment embedding is optional.
docstring_tokens: Create an EmbedLayerNormalization node . Note that segment embedding is optional .
function: def create_fused_node(self, input_ids: str, layernorm: NodeProto, word_embedding_gather: NodeProto,
                            position_embedding_gather: NodeProto, segment_embedding_gather: Union[None, NodeProto],
                            position_ids: str = None, embedding_sum_output = False):
          """Create an EmbedLayerNormalization node. Note that segment embedding is optional.
  
          Args:
              input_ids (str): input_ids for word embeddings
              layernorm (NodeProto): LayerNormalization or SkipLayerNormalization node.
              word_embedding_gather (NodeProto): the Gather node for word embedding
              position_embedding_gather (NodeProto): the Gather node for position embedding
              segment_embedding_gather (Union[None, NodeProto]): the Gather node for segment embedding, or None.
  
          Returns:
              NodeProto: the EmbedLayerNormalization node created.
          """
          nodes_to_add = []
          input_ids, _ = self.cast_to_int32(input_ids)
  
          node_name = self.model.create_node_name('EmbedLayerNormalization')
  
          if layernorm.op_type == "LayerNormalization":
              gamma = layernorm.input[1]
              beta = layernorm.input[2]
          else:  # SkipLayerNormalization
              gamma = layernorm.input[2]
              beta = layernorm.input[3]
  
          embed_node_inputs = None
          if segment_embedding_gather is not None:
              segment_ids, _ = self.cast_to_int32(segment_embedding_gather.input[1])
  
              embed_node_inputs = [
                  input_ids, segment_ids, word_embedding_gather.input[0], position_embedding_gather.input[0],
                  segment_embedding_gather.input[0], gamma, beta
              ]
          else:  # no segment embedding
              embed_node_inputs = [
                  input_ids, '', word_embedding_gather.input[0], position_embedding_gather.input[0], '', gamma, beta
              ]
  
          if position_ids is not None:
              #Adding an empty input for mask before position_ids
              embed_node_inputs.append('')
              position_ids, _ = self.cast_to_int32(position_ids)
              embed_node_inputs.append(position_ids)
  
          embed_node_outputs = [node_name + "_output", node_name + "_dummy_mask_index"]
          if embedding_sum_output:
              embed_node_outputs.append(node_name + "_embedding_sum")
  
          embed_node = helper.make_node('EmbedLayerNormalization',
                                        embed_node_inputs,
                                        outputs=embed_node_outputs,
                                        name=node_name)
  
          embed_node.domain = "com.microsoft"
  
          # Pass attribute "epsilon" from normalize node to EmbedLayerNormalization.
          for att in layernorm.attribute:
              if att.name == 'epsilon':
                  embed_node.attribute.extend([att])
  
          # Set default value to 1e-12 if no attribute is found.
          # OnnxRuntime 1.2.0 or older has no epsilon attribute. The optimized model can only work for 1.3.0 or later.
          if len(embed_node.attribute) == 0:
              embed_node.attribute.extend([helper.make_attribute("epsilon", 1.0E-12)])
  
          # Make sure new EmbedLayerNormalization node is the last one in self.nodes_to_add.
          nodes_to_add.append(embed_node)
          for node in nodes_to_add:
              self.node_name_to_graph_name[node.name] = self.this_graph_name
          self.nodes_to_add.extend(nodes_to_add)
  
          self.embed_node = embed_node
          return embed_node
function_tokens: def create_fused_node ( self , input_ids : str , layernorm : NodeProto , word_embedding_gather : NodeProto , position_embedding_gather : NodeProto , segment_embedding_gather : Union [ None , NodeProto ] , position_ids : str = None , embedding_sum_output = False ) : nodes_to_add = [ ] input_ids , _ = self . cast_to_int32 ( input_ids ) node_name = self . model . create_node_name ( 'EmbedLayerNormalization' ) if layernorm . op_type == "LayerNormalization" : gamma = layernorm . input [ 1 ] beta = layernorm . input [ 2 ] else : # SkipLayerNormalization gamma = layernorm . input [ 2 ] beta = layernorm . input [ 3 ] embed_node_inputs = None if segment_embedding_gather is not None : segment_ids , _ = self . cast_to_int32 ( segment_embedding_gather . input [ 1 ] ) embed_node_inputs = [ input_ids , segment_ids , word_embedding_gather . input [ 0 ] , position_embedding_gather . input [ 0 ] , segment_embedding_gather . input [ 0 ] , gamma , beta ] else : # no segment embedding embed_node_inputs = [ input_ids , '' , word_embedding_gather . input [ 0 ] , position_embedding_gather . input [ 0 ] , '' , gamma , beta ] if position_ids is not None : #Adding an empty input for mask before position_ids embed_node_inputs . append ( '' ) position_ids , _ = self . cast_to_int32 ( position_ids ) embed_node_inputs . append ( position_ids ) embed_node_outputs = [ node_name + "_output" , node_name + "_dummy_mask_index" ] if embedding_sum_output : embed_node_outputs . append ( node_name + "_embedding_sum" ) embed_node = helper . make_node ( 'EmbedLayerNormalization' , embed_node_inputs , outputs = embed_node_outputs , name = node_name ) embed_node . domain = "com.microsoft" # Pass attribute "epsilon" from normalize node to EmbedLayerNormalization. for att in layernorm . attribute : if att . name == 'epsilon' : embed_node . attribute . extend ( [ att ] ) # Set default value to 1e-12 if no attribute is found. # OnnxRuntime 1.2.0 or older has no epsilon attribute. The optimized model can only work for 1.3.0 or later. if len ( embed_node . attribute ) == 0 : embed_node . attribute . extend ( [ helper . make_attribute ( "epsilon" , 1.0E-12 ) ] ) # Make sure new EmbedLayerNormalization node is the last one in self.nodes_to_add. nodes_to_add . append ( embed_node ) for node in nodes_to_add : self . node_name_to_graph_name [ node . name ] = self . this_graph_name self . nodes_to_add . extend ( nodes_to_add ) self . embed_node = embed_node return embed_node