docstr: Args:
      encoder_states: output of the encoder (B x L_enc x H)
      encoder_mask: encoder inputs mask (B x L_enc)
docstr_tok: ["Args",":","encoder_states",":","output","of","the","encoder","(","B","x","L_enc","x","H",")","encoder_mask",":","encoder","inputs","mask","(","B","x","L_enc",")"]
code: def forward(self, encoder_states, encoder_mask):
      """
      Args:
          encoder_states: output of the encoder (B x L_enc x H)
          encoder_mask: encoder inputs mask (B x L_enc)
      """
      # self-attention over input
      if self.hidden_init_method == "enc_shared":
          residual = encoder_states
          hidden_states = self.hidden_enc(
              encoder_states=encoder_states, encoder_mask=encoder_mask
          )
          # residual connection
          hidden_states += residual
      elif self.hidden_init_method == "identity":
          hidden_states = encoder_states
      elif self.hidden_init_method == "enc":
          residual = encoder_states
          hidden_states = self.init_hidden_enc(
              encoder_states=encoder_states, encoder_mask=encoder_mask
          )
          # residual connection
          hidden_states += residual
  
      # project encoder states to a fixed steps hidden using k attention heads
      hidden_states = self.att_bridge(
          hidden=hidden_states, hidden_mask=encoder_mask
      )
  
      # all hidden values are active
      hidden_mask = torch.ones(
          encoder_states.shape[0],
          self._hidden_steps,
          dtype=encoder_mask.dtype,
          device=encoder_mask.device,
      )
  
      # apply self-attention over fixed-size hidden_states
      for block in range(self._hidden_blocks):
          residual = hidden_states
          hidden_states = self.hidden_enc(
              encoder_states=hidden_states, encoder_mask=hidden_mask
          )
          # residual connection
          hidden_states += residual
  
      return hidden_states, hidden_mask
  
file_path: NeMo/nemo/collections/nlp/modules/common/transformer/bridge_encoders.py
imports: import torch
  from nemo.collections.nlp.modules.common.transformer.transformer_encoders import TransformerEncoder
  from nemo.collections.nlp.modules.common.transformer.transformer_modules import AttentionBridge
label_desc: Use image node_id 6 for calling the BridgeEncoder obj's underlying member method code with example usage: obj.forward(encoder_states, encoder_mask) and returns: hidden_states,  hidden_mask