code: def test_r2d2(self, store_lstm_state: bool):
      # Create a fake environment to test with.
      # TODO(b/152596848): Allow R2D2 to deal with integer observations.
      environment = fakes.DiscreteEnvironment(
          num_actions=5,
          num_observations=10,
          obs_shape=(10, 4),
          obs_dtype=np.float32,
          episode_length=10,
      )
      spec = specs.make_environment_spec(environment)
  
      # Construct the agent.
      agent = r2d2.R2D2(
          environment_spec=spec,
          network=SimpleNetwork(spec.actions),
          batch_size=10,
          samples_per_insert=2,
          min_replay_size=10,
          store_lstm_state=store_lstm_state,
          burn_in_length=2,
          trace_length=6,
          replay_period=4,
          checkpoint=False,
      )
  
      # Try running the environment loop. We have no assertions here because all
      # we care about is that the agent runs without raising any errors.
      loop = acme.EnvironmentLoop(environment, agent)
      loop.run(num_episodes=5)
  
file_path: acme/acme/agents/tf/r2d2/agent_test.py
imports: import acme
  from acme import specs
  from acme.agents.tf import r2d2
  from acme.testing import fakes
  from acme.tf import networks
  import numpy
  import sonnet
  from absl.testing import absltest
  from absl.testing import parameterized
label_desc: Use image node_id 1 for calling the R2D2Test obj's underlying member method code with example usage: obj.test_r2d2(store_lstm_state) without return types