(self, physics, random_state)
Resets this updater's state.
Resets this updater's state.
Resets this updater s state .
def reset(self, physics, random_state):
    """Resets this updater's state."""

    def make_buffers_dict(observables):
      """Makes observable states in a dict."""
      # Use `type(observables)` so that our output structure respects the
      # original dict subclass (e.g. OrderedDict).
      out_dict = type(observables)()
      for key, value in observables.items():
        if value.enabled:
          out_dict[key] = _EnabledObservable(value, physics, random_state,
                                             self._strip_singleton_buffer_dim,
                                             self._pad_with_initial_value)
      return out_dict

    if self._is_nested:
      self._enabled_structure = type(self._observables)(
          make_buffers_dict(obs_dict) for obs_dict in self._observables)
      self._enabled_list = []
      for enabled_dict in self._enabled_structure:
        self._enabled_list.extend(enabled_dict.values())
    else:
      self._enabled_structure = make_buffers_dict(self._observables)
      self._enabled_list = self._enabled_structure.values()

    self._step_counter = 0
    for enabled in self._enabled_list:
      first_delay = _call_if_callable(enabled.delay)
      enabled.buffer.insert(
          0, first_delay,
          enabled.observation_callable())
def reset ( self , physics , random_state ) : def make_buffers_dict ( observables ) : """Makes observable states in a dict.""" # Use `type(observables)` so that our output structure respects the # original dict subclass (e.g. OrderedDict). out_dict = type ( observables ) ( ) for key , value in observables . items ( ) : if value . enabled : out_dict [ key ] = _EnabledObservable ( value , physics , random_state , self . _strip_singleton_buffer_dim , self . _pad_with_initial_value ) return out_dict if self . _is_nested : self . _enabled_structure = type ( self . _observables ) ( make_buffers_dict ( obs_dict ) for obs_dict in self . _observables ) self . _enabled_list = [ ] for enabled_dict in self . _enabled_structure : self . _enabled_list . extend ( enabled_dict . values ( ) ) else : self . _enabled_structure = make_buffers_dict ( self . _observables ) self . _enabled_list = self . _enabled_structure . values ( ) self . _step_counter = 0 for enabled in self . _enabled_list : first_delay = _call_if_callable ( enabled . delay ) enabled . buffer . insert ( 0 , first_delay , enabled . observation_callable ( ) )