class_docstr: Compute relative multi-head attention for XLNet encoder.
  
  This module computes relative multi-head attention as explained in
  `Transformer-XL, (Zihang et. al)` and in `XLNet (Zhiling et. al)`.
  
  Args:
      r_r_bias: A tensor of shape `(num_heads, head_dim)`.
          The bias value added to query head while computing position based
          attention score.
  
      r_w_bias: A tensor of shape `(num_heads, head_dim)`.
          The bias value added to query head while computing content based
          attention score.
  
      r_s_bias (optional): A tensor of shape `(num_heads, head_dim)`.
          The bias value added to query head while computing segment based
          attention score.
  
      segment_embed (optional): A tensor of shape `(2, num_heads, head_dim)`
          if use_segments is True. Otherwise, this is set to None.
  
      hparams (dict or HParams, optional): Hyperparameters. Missing
          hyperparameter will be set to default values. See
          :meth:`default_hparams` for the hyperparameter sturcture
          and default values.
class_docstr_tok: ["Compute","relative","multi-head","attention","for","XLNet","encoder",".","This","module","computes","relative","multi-head","attention","as","explained","in","`","Transformer-XL",",","(","Zihang","et",".","al",")","`","and","in","`","XLNet","(","Zhiling","et",".","al",")","`",".","Args",":","r_r_bias",":","A","tensor","of","shape","`","(","num_heads",",","head_dim",")","`",".","The","bias","value","added","to","query","head","while","computing","position","based","attention","score",".","r_w_bias",":","A","tensor","of","shape","`","(","num_heads",",","head_dim",")","`",".","The","bias","value","added","to","query","head","while","computing","content","based","attention","score",".","r_s_bias","(","optional",")",":","A","tensor","of","shape","`","(","num_heads",",","head_dim",")","`",".","The","bias","value","added","to","query","head","while","computing","segment","based","attention","score",".","segment_embed","(","optional",")",":","A","tensor","of","shape","`","(","2",",","num_heads",",","head_dim",")","`","if","use_segments","is","True",".","Otherwise",",","this","is","set","to","None",".","hparams","(","dict","or","HParams",",","optional",")",":","Hyperparameters",".","Missing","hyperparameter","will","be","set","to","default","values",".","See",":","meth",":","`","default_hparams","`","for","the","hyperparameter","sturcture","and","default","values","."]
code: def _post_attention(self, attn_vec, mode=None):
      is_training = is_train_mode(mode)
      attn_out = tf.einsum(
          "ibnd,hnd->ibh", attn_vec, self.output_projection
      )
      attn_out = self.dropout(attn_out, training=is_training)
      return attn_out
  
imports: import tensorflow
  from texar.tf.core import layers
  from texar.tf.module_base import ModuleBase
  from texar.tf.utils.mode import is_train_mode
label_desc: Use image node_id 5 for calling the RelativeMutiheadAttention obj's underlying member method code with example usage: obj._post_attention(attn_vec, mode) and returns: attn_out