code: def test_shards_per_epoch(self):
      def num_ending_with(filenames, suffix):
          return sum(
              1 for filename in filenames if filename.endswith(suffix)
          )
  
      env = gym_env.T2TGymEnv(TEST_ENV_NAME, batch_size=2)
      env.start_new_epoch(0, self.out_dir)
      self.play(env, n_steps=20)
      env.generate_data(self.out_dir)
  
      filenames = os.listdir(self.out_dir)
      num_shards_per_epoch = len(filenames)
      self.assertEqual(
          num_ending_with(filenames, ".0"), num_shards_per_epoch
      )
  
      env.start_new_epoch(1, self.out_dir)
      self.play(env, n_steps=20)
      env.generate_data(self.out_dir)
  
      filenames = os.listdir(self.out_dir)
      self.assertEqual(len(filenames), 2 * num_shards_per_epoch)
      for suffix in (".0", ".1"):
          self.assertEqual(
              num_ending_with(filenames, suffix), num_shards_per_epoch
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import shutil
  import gym
  from gym.spaces import Box
  from gym.spaces import Discrete
  import numpy
  from tensor2tensor.data_generators import gym_env
  from tensor2tensor.data_generators import problem
  from tensor2tensor.rl.gym_utils import make_gym_env
  import tensorflow.compat.v1
label_desc: Use image node_id 8 for calling the GymEnvTest obj's underlying member method code with example usage: obj.test_shards_per_epoch() and returns: sum