code: def _testStackBidirectionalDynamicRNN(
      self, use_gpu, use_shape, use_state_tuple
  ):
      with self.session(use_gpu=use_gpu, graph=tf.Graph()) as sess:
          (
              input_value,
              inputs,
              outputs,
              state_fw,
              state_bw,
              sequence_length,
          ) = self._createStackBidirectionalDynamicRNN(
              use_gpu, use_shape, use_state_tuple
          )
          tf.global_variables_initializer().run()
          # Run with pre-specified sequence length of 2, 3
          out, s_fw, s_bw = sess.run(
              [outputs, state_fw, state_bw],
              feed_dict={
                  inputs[0]: input_value,
                  sequence_length: [2, 3],
              },
          )
  
          # Since the forward and backward LSTM cells were initialized with the
          # same parameters, the forward and backward states of the first layer has
          # to be the same.
          # For the next layers, since the input is a concat of forward and backward
          # outputs of the previous layers the symmetry is broken and the following
          # states and outputs differ.
          # We cannot access the intermediate values between layers but we can
          # check that the forward and backward states of the first layer match.
  
          self.assertAllClose(s_fw[0], s_bw[0])
          out = np.swapaxes(out, 0, 1)
          # If outputs are not concat between layers the output of the forward
          # and backward would be the same but symmetric.
          # Check that is not the case.
          # Due to depth concatenation (as num_units=3 for both RNNs):
          # - forward output:  out[][][depth] for 0 <= depth < 3
          # - backward output: out[][][depth] for 4 <= depth < 6
          # First sequence in batch is length=2
          # Check that the time=0 forward output is not equal to time=1 backward.
          self.assertNotEqual(out[0][0][0], out[1][0][3])
          self.assertNotEqual(out[0][0][1], out[1][0][4])
          self.assertNotEqual(out[0][0][2], out[1][0][5])
          # Check that the time=1 forward output is not equal to time=0 backward.
          self.assertNotEqual(out[1][0][0], out[0][0][3])
          self.assertNotEqual(out[1][0][1], out[0][0][4])
          self.assertNotEqual(out[1][0][2], out[0][0][5])
  
          # Second sequence in batch is length=3
          # Check that the time=0 forward output is not equal to time=2 backward.
          self.assertNotEqual(out[0][1][0], out[2][1][3])
          self.assertNotEqual(out[0][1][1], out[2][1][4])
          self.assertNotEqual(out[0][1][2], out[2][1][5])
          # Check that the time=1 forward output is not equal to time=1 backward.
          self.assertNotEqual(out[1][1][0], out[1][1][3])
          self.assertNotEqual(out[1][1][1], out[1][1][4])
          self.assertNotEqual(out[1][1][2], out[1][1][5])
          # Check that the time=2 forward output is not equal to time=0 backward.
          self.assertNotEqual(out[2][1][0], out[0][1][3])
          self.assertNotEqual(out[2][1][1], out[0][1][4])
          self.assertNotEqual(out[2][1][2], out[0][1][5])
  
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 3 for calling the StackBidirectionalRNNTest obj's underlying member method code with example usage: obj._testStackBidirectionalDynamicRNN(use_gpu, use_shape, use_state_tuple) without return types