class_docstr: A single transformer layer.
  
  Transformer layer takes input with size [s, b, h] and returns an
  output of the same size.
      
class_docstr_tok: ["A","single","transformer","layer",".","Transformer","layer","takes","input","with","size","[","s",",","b",",","h","]","and","returns","an","output","of","the","same","size","."]
code: def forward(
      self,
      hidden_states,
      attention_mask,
      context=None,
      context_mask=None,
      rotary_pos_emb=None,
      inference_params=None,
  ):
      # hidden_states: [s, b, h]
  
      # Residual connection.
      residual = hidden_states
  
      mlp_ln_output = None
      if self.new_decoder_architecture:
          mlp_ln_output = self.pre_mlp_layernorm(hidden_states)
  
      input_layernorm_output = self.input_layernorm(hidden_states)
  
      input_mlp_ln = input_layernorm_output
  
      # Self attention.
      attention_output_with_bias = self.self_attention(
          input_layernorm_output,
          attention_mask=attention_mask,
          inference_params=inference_params,
          rotary_pos_emb=rotary_pos_emb,
      )
  
      with self.bias_dropout_add_exec_handler():
          hidden_states = self.self_attn_bda(
              self.training, self.config.bias_dropout_fusion
          )(
              attention_output_with_bias,
              residual,
              self.config.hidden_dropout,
          )
  
      if not self.new_decoder_architecture:
          if self.parallel_attention:
              layernorm_output = input_mlp_ln
          else:
              residual = hidden_states
              layernorm_output = self.post_self_attn_layernorm(
                  hidden_states
              )
  
      else:
          layernorm_output = mlp_ln_output
  
      mlp_output_with_bias = self.mlp(layernorm_output)
  
      # falcon specific:
      if self.new_decoder_architecture or self.parallel_attention:
          mlp_output = mlp_output_with_bias[0]
          attn_output = attention_output_with_bias[0]
          mlp_output_without_bias = mlp_output + attn_output
          mlp_output_with_bias = (mlp_output_without_bias, None)
  
      with self.bias_dropout_add_exec_handler():
          hidden_states = self.mlp_bda(
              self.training, self.config.bias_dropout_fusion
          )(mlp_output_with_bias, residual, self.config.hidden_dropout)
  
      output = make_viewless_tensor(
          inp=hidden_states,
          requires_grad=hidden_states.requires_grad,
          keep_graph=True,
      )
  
      return output, context
  
imports: from nemo.collections.nlp.modules.common.megatron.utils import ApexGuardDefaults
label_desc: Use image node_id 2 for calling the FalconTransformerLayer obj's underlying member method code with example usage: obj.forward(hidden_states, attention_mask, context, context_mask, rotary_pos_emb, inference_params) and returns: output,  context