code: def _testDynamicUnrollResetsStateOnReset(self, cell_type):
      cell = cell_type()
      batch_size = 4
      max_time = 7
      inputs = tf.random.uniform((batch_size, max_time, 1))
      reset_mask = tf.random.normal((batch_size, max_time)) > 0
  
      layer = dynamic_unroll_layer.DynamicUnroll(cell, dtype=tf.float32)
      outputs, final_state = layer(inputs, reset_mask=reset_mask)
  
      tf.nest.assert_same_structure(outputs, cell.output_size)
      tf.nest.assert_same_structure(final_state, cell.state_size)
  
      reset_mask, inputs, outputs, final_state = self.evaluate(
          (reset_mask, inputs, outputs, final_state)
      )
  
      self.assertAllClose(outputs[:, -1, :], final_state)
  
      # outputs will contain cumulative sums up until a reset
      expected_outputs = []
      state = np.zeros_like(final_state)
      for i, frame in enumerate(np.transpose(inputs, [1, 0, 2])):
          state = (
              state * np.reshape(~reset_mask[:, i], state.shape) + frame
          )
          expected_outputs.append(np.array(state))
      expected_outputs = np.transpose(expected_outputs, [1, 0, 2])
      self.assertAllClose(outputs, expected_outputs)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from absl.testing import parameterized
  import numpy
  import tensorflow
  from tf_agents.keras_layers import dynamic_unroll_layer
label_desc: Use image node_id 6 for calling the DynamicUnrollTest obj's underlying member method code with example usage: obj._testDynamicUnrollResetsStateOnReset(cell_type) without return types