code: def testAttentionCellWrapperValues(self):
      num_units = 8
      attn_length = 16
      batch_size = 3
      for state_is_tuple in [False, True]:
          with tf.Graph().as_default():
              with self.cached_session() as sess:
                  with tf.variable_scope(
                      "state_is_tuple_" + str(state_is_tuple)
                  ):
                      lstm_cell = rnn_cell.BasicLSTMCell(
                          num_units, state_is_tuple=state_is_tuple
                      )
                      cell = contrib_rnn.AttentionCellWrapper(
                          lstm_cell,
                          attn_length,
                          state_is_tuple=state_is_tuple,
                      )
                      if state_is_tuple:
                          zeros = tf.constant(
                              0.1
                              * np.ones(
                                  [batch_size, num_units],
                                  dtype=np.float32,
                              ),
                              dtype=tf.float32,
                          )
                          attn_state_zeros = tf.constant(
                              0.1
                              * np.ones(
                                  [batch_size, attn_length * num_units],
                                  dtype=np.float32,
                              ),
                              dtype=tf.float32,
                          )
                          zero_state = (
                              (zeros, zeros),
                              zeros,
                              attn_state_zeros,
                          )
                      else:
                          zero_state = tf.constant(
                              0.1
                              * np.ones(
                                  [
                                      batch_size,
                                      num_units * 2
                                      + num_units
                                      + attn_length * num_units,
                                  ],
                                  dtype=np.float32,
                              ),
                              dtype=tf.float32,
                          )
                      inputs = tf.constant(
                          np.array(
                              [
                                  [1.0, 1.0, 1.0, 1.0],
                                  [2.0, 2.0, 2.0, 2.0],
                                  [3.0, 3.0, 3.0, 3.0],
                              ],
                              dtype=np.float32,
                          ),
                          dtype=tf.float32,
                      )
                      output, state = cell(inputs, zero_state)
                      if state_is_tuple:
                          concat_state = tf.concat(
                              [
                                  state[0][0],
                                  state[0][1],
                                  state[1],
                                  state[2],
                              ],
                              1,
                          )
                      else:
                          concat_state = state
                      sess.run(tf.global_variables_initializer())
                      output, state = sess.run([output, concat_state])
                      # Different inputs so different outputs and states
                      for i in range(1, batch_size):
                          self.assertGreater(
                              float(
                                  np.linalg.norm(
                                      (output[0, :] - output[i, :])
                                  )
                              ),
                              1e-6,
                          )
                          self.assertGreater(
                              float(
                                  np.linalg.norm(
                                      (state[0, :] - state[i, :])
                                  )
                              ),
                              1e-6,
                          )
  
imports: import itertools
  from absl.testing import parameterized
  from magenta.contrib import rnn
  import numpy
  import tensorflow.compat.v1
label_desc: Use image node_id 4 for calling the RNNCellTest obj's underlying member method code with example usage: obj.testAttentionCellWrapperValues() without return types