def compute_v(self, memory_antecedent):
    """Compute value Tensor v.

    Args:
      memory_antecedent: a Tensor with dimensions
        {memory_input_dim} + other_dims
    Returns:
      a Tensor with dimensions
        memory_heads_dims + {value_dim} + other_dims
    """
    if self.shared_kv:
      raise ValueError("compute_v cannot be called with shared_kv")
    ret = mtf.einsum(
        [memory_antecedent, self.wv], reduced_dims=[self.memory_input_dim])
    if self.combine_dims:
      ret = mtf.replace_dimensions(ret, ret.shape.dims[-1], self.v_dims)
    return ret
def compute_v ( self , memory_antecedent ) : if self . shared_kv : raise ValueError ( "compute_v cannot be called with shared_kv" ) ret = mtf . einsum ( [ memory_antecedent , self . wv ] , reduced_dims = [ self . memory_input_dim ] ) if self . combine_dims : ret = mtf . replace_dimensions ( ret , ret . shape . dims [ - 1 ] , self . v_dims ) return ret
Compute value Tensor v.

    Args:
      memory_antecedent: a Tensor with dimensions
        {memory_input_dim} + other_dims
    Returns:
      a Tensor with dimensions
        memory_heads_dims + {value_dim} + other_dims