class_docstr: Implements the Memory module.
  
  Based on Neural Turing Machines: arXiv:1410.5401 [cs.NE]
class_docstr_tok: ["Implements","the","Memory","module",".","Based","on","Neural","Turing","Machines",":","arXiv:1410.5401","[","cs.NE","]"]
docstr: Address the memory based on content similarity.
  
  Args:
    x: a tensor in the shape of [batch_size, length, depth].
  Returns:
    the logits for each memory entry [batch_size, length, memory_size].
docstr_tok: ["Address","the","memory","based","on","content","similarity",".","Args",":","x",":","a","tensor","in","the","shape","of","[","batch_size",",","length",",","depth","]",".","Returns",":","the","logits","for","each","memory","entry","[","batch_size",",","length",",","memory_size","]","."]
code: def _address_content(self, x):
      """Address the memory based on content similarity.
  
      Args:
        x: a tensor in the shape of [batch_size, length, depth].
      Returns:
        the logits for each memory entry [batch_size, length, memory_size].
      """
      mem_keys = tf.layers.dense(
          self.mem_vals,
          self.key_depth,
          bias_initializer=tf.constant_initializer(1.0),
          name="mem_key",
      )
      mem_query = tf.layers.dense(
          x,
          self.key_depth,
          bias_initializer=tf.constant_initializer(1.0),
          name="mem_query",
      )
      norm = tf.matmul(
          self._norm(mem_query), self._norm(mem_keys), transpose_b=True
      )
      dot_product = tf.matmul(mem_query, mem_keys, transpose_b=True)
      cos_dist = tf.div(dot_product, norm + 1e-7, name="cos_dist")
      access_logits = self.sharpen_factor * cos_dist
      return access_logits
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from tensor2tensor.layers import common_layers
  import tensorflow.compat.v1
label_desc: Use image node_id 3 for calling the TransformerMemory obj's underlying member method code with example usage: obj._address_content(x) and returns: access_logits