class_docstr: Self-attention layer.
class_docstr_tok: ["Self-attention","layer","."]
code: def forward(self, input_tensor, attention_mask, head_mask=None):
      self_outputs = self.self(input_tensor, attention_mask, head_mask)
      attention_output = self.output(self_outputs[0], input_tensor)
      outputs = (attention_output,) + self_outputs[
          1:
      ]  # add attentions if we output them
      return outputs
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import logging
  import math
  import torch
  from torch import nn
  from towhee.models.layers.activations import swish, gelu
label_desc: Use image node_id 2 for calling the BertAttention obj's underlying member method code with example usage: obj.forward(input_tensor, attention_mask, head_mask) and returns: outputs