def _rollout(env, timestep_limit=None):
 count = 0
 episode_state = 'resetting'
 while True:
  (obs, reward, done, info) = env.step([])
  count += 1
  if (episode_state == 'resetting'):
   if (done is None):
    assert (obs is None)
    continue
   elif (done is False):
    episode_state = 'running'
  if (episode_state == 'running'):
   assert (done is False)
   assert isinstance(reward, float)
   assert isinstance(done, bool), 'Received done=None before done=True'
   if (obs is not None):
    assert (obs['vision'].shape == (768, 1024, 3))
   break
  if ((timestep_limit is not None) and (count >= timestep_limit)):
   assert (episode_state == 'running'), 'Failed to finish resetting in timestep limit'
   break

def _rollout ( env , timestep_limit = None ) : count = 0 episode_state = 'resetting' while True : ( obs , reward , done , info ) = env . step ( [ ] ) count += 1 if ( episode_state == 'resetting' ) : if ( done is None ) : assert ( obs is None ) continue elif ( done is False ) : episode_state = 'running' if ( episode_state == 'running' ) : assert ( done is False ) assert isinstance ( reward , float ) assert isinstance ( done , bool ) , 'Received done=None before done=True' if ( obs is not None ) : assert ( obs [ 'vision' ] . shape == ( 768 , 1024 , 3 ) ) break if ( ( timestep_limit is not None ) and ( count >= timestep_limit ) ) : assert ( episode_state == 'running' ) , 'Failed to finish resetting in timestep limit' break
test that a rollout follows our desired format .