code: def testValues(self):
      num_writes = 2
      memory_size = 5
      word_size = 3
  
      # Random memory, address and values (batch_size=1)
      mem = tf.random.uniform([1, memory_size, word_size])
      mem_np = mem.numpy()
      # Non-repeated indices in [0, memory_size)
      indices = np.random.permutation(memory_size)[:num_writes]
      # One-hot representation
      write_address = tf.constant(
          np.expand_dims(np.eye(memory_size)[indices], axis=0),
          dtype=tf.float32,
      )
      write_values = tf.random.uniform([1, num_writes, word_size])
      write_values_np = write_values.numpy()
  
      written_mem = write.additive_write(
          mem, write_address, write_values
      )
      not_written_mem = write.additive_write(
          mem, write_address * 0, write_values
      )
  
      written_mem_np = written_mem.numpy()
      not_written_mem_np = not_written_mem.numpy()
  
      # Check values have been correctly written
      self.assertAllClose(
          written_mem.numpy()[0, indices, :],
          write_values_np[0] + mem_np[0, indices, :],
          atol=2e-3,
      )
      # Check all other values in the memory are still what they started as
      written_mem_copy = written_mem_np.copy()
      written_mem_copy[0, indices, :] -= write_values_np[0]
      self.assertAllClose(written_mem_copy, mem_np, atol=2e-3)
  
      self.assertAllClose(not_written_mem_np, mem_np, atol=2e-3)
  
file_path: sonnet/sonnet/src/nets/dnc/write_test.py
imports: import numpy
  from sonnet.src import test_utils
  from sonnet.src.nets.dnc import write
  import tensorflow
label_desc: Use image node_id 2 for calling the AdditiveWriteTest obj's underlying member method code with example usage: obj.testValues() without return types