MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / __init__

Method __init__

dm_control/composer/environment.py:297–363  ·  view source on GitHub ↗

Initializes an instance of `Environment`. Args: task: Instance of `composer.base.Task`. time_limit: (optional) A float, the time limit in seconds beyond which an episode is forced to terminate. random_state: (optional) an int seed or `np.random.RandomState` instance.

(
      self,
      task,
      time_limit=float('inf'),
      random_state=None,
      n_sub_steps=None,
      raise_exception_on_physics_error=True,
      strip_singleton_obs_buffer_dim=False,
      max_reset_attempts=1,
      recompile_mjcf_every_episode=True,
      fixed_initial_state=False,
      delayed_observation_padding=ObservationPadding.ZERO,
      legacy_step: bool = True,
  )

Source from the content-addressed store, hash-verified

295 """Reinforcement learning environment for Composer tasks."""
296
297 def __init__(
298 self,
299 task,
300 time_limit=float('inf'),
301 random_state=None,
302 n_sub_steps=None,
303 raise_exception_on_physics_error=True,
304 strip_singleton_obs_buffer_dim=False,
305 max_reset_attempts=1,
306 recompile_mjcf_every_episode=True,
307 fixed_initial_state=False,
308 delayed_observation_padding=ObservationPadding.ZERO,
309 legacy_step: bool = True,
310 ):
311 """Initializes an instance of `Environment`.
312
313 Args:
314 task: Instance of `composer.base.Task`.
315 time_limit: (optional) A float, the time limit in seconds beyond which an
316 episode is forced to terminate.
317 random_state: (optional) an int seed or `np.random.RandomState` instance.
318 n_sub_steps: (DEPRECATED) An integer, number of physics steps to take per
319 agent control step. New code should instead override the
320 `control_substep` property of the task.
321 raise_exception_on_physics_error: (optional) A boolean, indicating whether
322 `PhysicsError` should be raised as an exception. If `False`, physics
323 errors will result in the current episode being terminated with a
324 warning logged, and a new episode started.
325 strip_singleton_obs_buffer_dim: (optional) A boolean, if `True`, the array
326 shape of observations with `buffer_size == 1` will not have a leading
327 buffer dimension.
328 max_reset_attempts: (optional) Maximum number of times to try resetting
329 the environment. If an `EpisodeInitializationError` is raised during
330 this process, an environment reset is reattempted up to this number of
331 times. If this count is exceeded then the most recent exception will be
332 allowed to propagate. Defaults to 1, i.e. no failure is allowed.
333 recompile_mjcf_every_episode: If True will recompile the mjcf model
334 between episodes. This specifically skips the `initialize_episode_mjcf`
335 and `after_compile` steps. This allows a speedup if no changes are made
336 to the model.
337 fixed_initial_state: If True the starting state of every single episode
338 will be the same. Meaning an identical sequence of action will lead to
339 an identical final state. If False, will randomize the starting state at
340 every episode.
341 delayed_observation_padding: (optional) An `ObservationPadding` enum value
342 specifying the padding behavior of the initial buffers for delayed
343 observables. If `ZERO` then the buffer is initially filled with zeroes.
344 If `INITIAL_VALUE` then the buffer is initially filled with the first
345 observation values.
346 legacy_step: If True, steps the state with up-to-date position and
347 velocity dependent fields.
348 """
349 super().__init__(
350 task=task,
351 time_limit=time_limit,
352 random_state=random_state,
353 n_sub_steps=n_sub_steps,
354 raise_exception_on_physics_error=raise_exception_on_physics_error,

Callers

nothing calls this directly

Calls 2

get_stateMethod · 0.80
__init__Method · 0.45

Tested by

no test coverage detected