class_docstr: Fixed (5 lines):
      Add Allreduce operation
class_docstr_tok: ["Fixed","(","5","lines",")",":","Add","Allreduce","operation"]
docstr: Post-attention processing.
docstr_tok: ["Post-attention","processing","."]
code: def post_attention(self, h, attn_vec, residual=True):
      """Post-attention processing."""
      # post-attention projection (back to `d_model`)
      attn_out = torch.einsum("ibnd,hnd->ibh", attn_vec, self.o)
  
      if (
          self.mp_group is not None
          and dist.get_world_size(group=self.mp_group) > 1
      ):
          dist.all_reduce(
              attn_out,
              group=self.mp_group,
          )
  
      attn_out = self.dropout(attn_out)
      if residual:
          attn_out = attn_out + h
      output = self.layer_norm(attn_out)
  
      return output
  
imports: import torch
  from torch import distributed
  from transformers.models.xlnet.modeling_xlnet import XLNetRelativeAttention
label_desc: Use image node_id 1 for calling the XLNetRelativeAttention_ obj's underlying member method code with example usage: obj.post_attention(h, attn_vec, residual) and returns: output