class_docstr: A set of parameters used for (multihead) attention.
docstr: Compute output of multihead attention.
  
  Args:
    o: a Tensor with dimensions
       query_heads_dims + {value_dim} + other_dims
    output_shape: an optional Shape
  Returns:
    a Tensor with shape:
       {output_dim} + other_dims
docstr_tok: ["Compute","output","of","multihead","attention",".","Args",":","o",":","a","Tensor","with","dimensions","query_heads_dims","+","{","value_dim","}","+","other_dims","output_shape",":","an","optional","Shape","Returns",":","a","Tensor","with","shape",":","{","output_dim","}","+","other_dims"]
code: def compute_output(self, o, output_shape=None):
      """Compute output of multihead attention.
  
      Args:
        o: a Tensor with dimensions
           query_heads_dims + {value_dim} + other_dims
        output_shape: an optional Shape
      Returns:
        a Tensor with shape:
           {output_dim} + other_dims
      """
      if self.combine_dims:
          o = mtf.transpose(o, o.shape - self.o_dims + self.o_dims)
          o = mtf.replace_dimensions(
              o, self.o_dims, self.wo.shape.dims[-2]
          )
          reduced_dims = [self.wo.shape.dims[-2]]
      else:
          reduced_dims = self.o_dims
  
      if self.keep_query_heads_dims:
          reduced_dims = [self.value_dim]
  
      return mtf.layers.us_einsum(
          [o, self.wo],
          output_shape=output_shape,
          reduced_dims=reduced_dims,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import mesh_tensorflow
  import tensorflow.compat.v1
label_desc: Use image node_id 7 for calling the AttentionParams obj's underlying member method code with example usage: obj.compute_output(o, output_shape) and returns: mtf