code: def erase_and_write(memory, address, reset_weights, values):
      """Module to erase and write in the NTM memory.
  
      Implementation is based on equations (3) and (4) from 'Neural Turing Machines'
      (https://arxiv.org/pdf/1410.5401.pdf) by gravesa@, gregwayne@ and danihelka@:
  
      Erase operation:
        M_t'(i) = M_{t-1}(i) * (1 - w_t(i) * e_t)
  
      Add operation:
        M_t(i) = M_t'(i) + w_t(i) * a_t
  
      where e are the reset_weights, w the write weights and a the values.
  
      Args:
        memory: 3D Tensor [batch_size, memory_size, word_size].
        address: 3D Tensor [batch_size, num_writes, memory_size].
        reset_weights: 3D Tensor [batch_size, num_writes, word_size].
        values: 3D Tensor [batch_size, num_writes, word_size].
  
      Returns:
        3D Tensor [batch_size, num_reads, word_size].
      """
      memory = erase(memory, address, reset_weights)
      memory = additive_write(memory, address, values)
      return memory
  
imports: import tensorflow
label_desc: Use image node_id 4 for calling a global function with example usage: erase_and_write(memory, address, reset_weights, values) and returns: memory