class_docstr: Computes attention for two modalities, based on
  [ViLBERT: Pretraining Task-Agnostic Visiolinguistic Representations
  for Vision-and-Language Tasks (Lu et al, 2019)]
  (https://api.semanticscholar.org/CorpusID:199453025).
  
  From the paper:
  
  "The keys and values from each modality are passed as input to the
  other modality’s multi-headed attention block. Consequentially, the
  attention block produces attention-pooled features for each modality
  conditioned on the other."
  
  For example, considering the case when the first modality is image,
  and the second modality is language, the module performs
  "image-conditioned language attention in the visual stream and
  language-conditioned image attention in the linguistic stream."
  
  # Parameters
  
  hidden_size1 : `int`
      The input hidden dim for the first modality.
  hidden_size2 : `int`
      The input hidden dim for the second modality.
  combined_hidden_size : `int`
      The output hidden dim for both modalities; it should be a multiple
      of `num_attention_heads`.
  num_attention_heads : `int`
      The number of attention heads.
  dropout1 : `float` (default = `0.0`)
      The dropout probability for the first modality stream.
  dropout2 : `float` (default = `0.0`)
      The dropout probability for the second modality stream.
  scoring_func1 : `str` (default = `scaled_dot_product`)
      The name of the attention-calculating function to be used for the first modality.
  scoring_func2 : `str` (default = `scaled_dot_product`)
      The name of the attention-calculating function to be used for the second modality.
      Eg. `dot_product`, `linear`, etc. For a complete list, please check
      :mod:`allennlp.modules.matrix_attention`.
code: def _transpose_for_scores(self, x):
      new_x_shape = x.size()[:-1] + (
          self.num_attention_heads,
          self.attention_head_size,
      )
      x = x.view(*new_x_shape)
      return x.permute(0, 2, 1, 3)
  
file_path: allennlp/allennlp/modules/transformer/bimodal_attention.py
imports: import torch
  from allennlp.common import FromParams
  from allennlp.modules.matrix_attention.matrix_attention import MatrixAttention
  from allennlp.modules.transformer.transformer_module import TransformerModule
  from allennlp.modules.transformer.util import apply_mask
label_desc: Use image node_id 2 for calling the BiModalAttention obj's underlying member method code with example usage: obj._transpose_for_scores(x) and returns: x