class_docstr: A modified version of the `BertLayer` class from the
  `transformers.models.bert.modeling_bert` module.
  
  Args:
      config (:class:`~transformers.BertConfig`):
          The configuration object that
          contains various parameters for the model.
      clamp_min_for_underflow (bool, optional):
          Whether to clamp the minimum value of the hidden states
           to prevent underflow. Defaults to `False`.
      clamp_max_for_overflow (bool, optional):
          Whether to clamp the maximum value of the hidden states
          to prevent overflow. Defaults to `False`.
class_docstr_tok: ["A","modified","version","of","the","`","BertLayer","`","class","from","the","`","transformers.models.bert.modeling_bert","`","module",".","Args",":","config","(",":","class",":","`","~transformers.BertConfig","`",")",":","The","configuration","object","that","contains","various","parameters","for","the","model",".","clamp_min_for_underflow","(","bool",",","optional",")",":","Whether","to","clamp","the","minimum","value","of","the","hidden","states","to","prevent","underflow",".","Defaults","to","`","False","`",".","clamp_max_for_overflow","(","bool",",","optional",")",":","Whether","to","clamp","the","maximum","value","of","the","hidden","states","to","prevent","overflow",".","Defaults","to","`","False","`","."]
docstr: Applies the BertEncoderLayer to the input features.
docstr_tok: ["Applies","the","BertEncoderLayer","to","the","input","features","."]
code: def forward(
      self, inputs: Dict[str, Dict[str, torch.Tensor]]
  ) -> Dict[str, Dict[str, torch.Tensor]]:
      """Applies the BertEncoderLayer to the input features."""
      language_dict_features = inputs["lang"]
      hidden_states = language_dict_features["hidden"]
      attention_mask = language_dict_features["masks"]
  
      device = hidden_states.device
      input_shape = hidden_states.size()[:-1]
      extended_attention_mask = self.get_extended_attention_mask(
          attention_mask, input_shape, device
      )
  
      self_attention_outputs = self.attention(
          hidden_states,
          extended_attention_mask,
          None,
          output_attentions=False,
          past_key_value=None,
      )
      attention_output = self_attention_outputs[0]
      outputs = self_attention_outputs[1:]
      layer_output = apply_chunking_to_forward(
          self.feed_forward_chunk,
          self.chunk_size_feed_forward,
          self.seq_len_dim,
          attention_output,
      )
      outputs = (layer_output,) + outputs
      hidden_states = outputs[0]
  
      language_dict_features["hidden"] = hidden_states
  
      features_dict = {
          "visual": inputs["visual"],
          "lang": language_dict_features,
      }
  
      return features_dict
  
imports: import math
  from typing import Dict, Optional, Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils.checkpoint
  from mmcv.cnn.bricks import DropPath
  from torch import Tensor
label_desc: Use image node_id 2 for calling the BertEncoderLayer obj's underlying member method code with example usage: obj.forward(inputs) and returns: features_dict