class_docstr: A set of parameters used for (multihead) attention.
docstr: Compute query Tensor q.
  
  Args:
    query_antecedent: a Tensor with dimensions
       {query_input_dim} + other_dims
  Returns:
    a Tensor with dimensions
       query_heads_dims + {key_dim} + other_dims
docstr_tok: ["Compute","query","Tensor","q.","Args",":","query_antecedent",":","a","Tensor","with","dimensions","{","query_input_dim","}","+","other_dims","Returns",":","a","Tensor","with","dimensions","query_heads_dims","+","{","key_dim","}","+","other_dims"]
code: def compute_q(self, query_antecedent):
      """Compute query Tensor q.
  
      Args:
        query_antecedent: a Tensor with dimensions
           {query_input_dim} + other_dims
      Returns:
        a Tensor with dimensions
           query_heads_dims + {key_dim} + other_dims
      """
      ret = mtf.layers.us_einsum(
          [query_antecedent, self.wq],
          reduced_dims=[self.query_input_dim],
      )
      if self.combine_dims:
          ret = mtf.replace_dimensions(
              ret, ret.shape.dims[-1], self.q_dims
          )
      if not self.fold_scaling_into_initializer:
          ret *= self.key_dim.size**-0.5
      return ret
  
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 3 for calling the AttentionParams obj's underlying member method code with example usage: obj.compute_q(query_antecedent) and returns: ret