Store given transition in the backend
1776
def store_transition(self, frame, action, reward, done, extra_info=None):
        
        self.current_idx = (self.current_idx + 1) % self.buffer_capacity

        if self.frame_stack_compensation:
            # Compensate for frame stack built into the environment
            idx_range = np.arange(-frame.shape[-1] // self.frame_history, 0)
            frame = np.take(frame, indices=idx_range, axis=-1)

        self.state_buffer[self.current_idx] = frame

        self.action_buffer[self.current_idx] = action
        self.reward_buffer[self.current_idx] = reward
        self.dones_buffer[self.current_idx] = done

        if extra_info is not None:
            for name in extra_info:
                if name not in self.extra_data:
                    assert self.current_size == 0, f"New data {name} encountered in the middle of the training"
                    array = extra_info[name]

                    self.extra_data[name] = np.zeros([self.buffer_capacity] + list(array.shape), dtype=array.dtype)

                self.extra_data[name][self.current_idx] = extra_info[name]

        if self.current_size < self.buffer_capacity:
            self.current_size += 1

        return self.current_idx
1252081
function() {
        if (this.state) {
          forEach(this.state.handlerInfos.slice().reverse(), function(handlerInfo) {
            var handler = handlerInfo.handler;
            callHook(handler, 'exit');
          });
        }

        this.state = new TransitionState();
        this.currentHandlerInfos = null;
      }
450238
function transitionTo(to, params, query) {
        var path = Router.makePath(to, params, query);

        if (pendingTransition) {
          // Replace so pending location does not stay in history.
          location.replace(path);
        } else {
          location.push(path);
        }
      }
206180
function(event) {
        var data, extraArgs, key, transitions = this._transitions
        if (transitions.hasOwnProperty((key = this.currentState)) &&
          transitions[key].hasOwnProperty(event)) {
          data = transitions[key][event]
        } else if (transitions.hasOwnProperty(ANY_STATE) &&
          transitions[ANY_STATE].hasOwnProperty(event)) {
          data = transitions[ANY_STATE][event]
        } else return

        extraArgs = _.toArray(arguments).slice(1)
        this._doTransition.apply(this, [data, event].concat(extraArgs))
      }
679060
def allowed_transitions():
    """"""
    try:
        sdp_state = SDPState()
        return sdp_state.allowed_target_states[sdp_state.current_state]
    except KeyError:
        LOG.error("Key Error")
        return dict(state="KeyError", reason="KeyError")
1183464
function generateTransitionHelpers(currentState, parsedStates) {
  const buildFnBody = state => (...args) => {
    return PossibleStatesContainer({current: state, data: zip(state.data, args), allStates: parsedStates})
  }

  return parsedStates.reduce(
    (transitions, state) => ({...transitions, [buildFnName('to', state.name)]: buildFnBody(state)}),
    {}
  )
}
469904
def _store(self, con):
        """"""
        self._con = con
        self._transaction = False
        self._closed = False
        self._usage = 0
31954
def add_transition(self, qi, u, qj):
        
        if u not in self.S:
            LOG.error("The specified value is invalid, f must be a member of S")
            raise InputError("The specified value is invalid, f must be a member of S")

        try:
            self.transition[qi][u].add(qj)

        except KeyError:
            try:
                self.transition[qi][u] = {qj}
            except KeyError:
                self.transition[qi] = dict()
                self.transition[qi][u] = {qj}
1170106
function State(config) {
  this._ = require('lodash');

  this._name = config.name;
  this._isInitial = config.isInitial;
  this._isTerminal = config.isTerminal;
  this._outgoingTransitions = config.outgoingTransitions;

  this.accept = config.accept;

  this._validateConfig(config);

  // Transform any value-based transition criteria to be a function
  this._.forEach(this._outgoingTransitions, function (transition) {
    var criteria = transition.criteria;

    // Replace the value-based criteria with a simple comparison function
    if (typeof criteria !== 'function') {
      transition.criteria = function (input) {
        return (input === criteria);
      }
    }
  });
}
48341
def _get_transitions(self, probs, indexes, tree_idxs, batch_info, forward_steps=1, discount_factor=1.0):
        
        if forward_steps > 1:
            transition_arrays = self.backend.get_transitions_forward_steps(indexes, forward_steps, discount_factor)
        else:
            transition_arrays = self.backend.get_transitions(indexes)

        priority_weight = self.priority_weight.value(batch_info['progress'])

        # Normalize by sum of all probs
        probs = probs / np.array([s.total() for s in self.backend.segment_trees], dtype=float).reshape(1, -1)
        capacity = self.backend.current_size
        weights = (capacity * probs) ** (-priority_weight)
        weights = weights / weights.max(axis=0, keepdims=True)

        transition_arrays['weights'] = weights
        transition_tensors = {k: torch.from_numpy(v) for k, v in transition_arrays.items()}

        transitions = Trajectories(
            num_steps=indexes.shape[0],
            num_envs=indexes.shape[1],
            environment_information=None,
            transition_tensors=transition_tensors,
            rollout_tensors={},
            extra_data={
                'tree_idxs': tree_idxs
            }
        )

        return transitions.to_transitions()
765883
def transition_to_add(self):
        """"""
        assert self.state in [AQStateMachineStates.init, AQStateMachineStates.add]
        self.state = AQStateMachineStates.add
1017685
def store_transition(self, frame, action, reward, done, extra_info=None):
        
        self.deque.store_transition(frame, action, reward, done, extra_info=extra_info)

        # We add element with max priority to all the trees
        for segment_tree in self.segment_trees:
            segment_tree.append(segment_tree.max)
1001029
def transition!(event_name, *data, &block)
      from_state = current
      to_state   = events_map.move_to(event_name, from_state, *data)

      block.call(from_state, to_state) if block

      if log_transitions
        Logger.report_transition(event_name, from_state, to_state, *data)
      end

      try_trigger(event_name) { transition_to!(to_state) }
    end
111906
function refreshState(){
		self._possibleTransitions = [];
		for(var transitionIndex = 0; transitionIndex < self._states[self._currentState].transitions.length; ++transitionIndex){
			var transition = self._states[self._currentState].transitions[transitionIndex];
			// Initialize the new variable that we'll push() onto _possibleTransitions later.
			var possibleTransition = {
				destination: transition.destination,
				action: transition.action,
				outputEventType: transition.outputEventType,
				remainingEvents: []
			};
			// Populate the list of remaining events that will be subsequently decreased, until it hits a count of zero, at which point this particular transition takes place.
			for(var eventIndex = 0; eventIndex < transition.requiredEvents.length; ++eventIndex){
				// Place the event specification into the list of remaining events.
				var event = transition.requiredEvents[eventIndex];
				possibleTransition.remainingEvents.push(event);
			}
			// Now that the transition specification is complete, add it to the list of transitions possible from the current state.
			self._possibleTransitions.push(possibleTransition);
			// Additionally, if the spec contained an outputEventType (which overrides SagaStateTransitioned for initiating transitions), register a handler for that event type.
			if(possibleTransition.outputEventType){
				// Duplicate handlers are checked, in order to avoid double state refresh (which would result in excessive event handler populations -> memory leak via avalanche effect after a few transitions).
				//  This check is somewhat strange due to EventEmitter's listener function wrapping when using once().
				if(!self.listeners(possibleTransition.outputEventType).some(function(listenerFunction){ return listenerFunction === applyTransition || listenerFunction.listener === applyTransition; })){
					// The listener is not yet present, so add it.
					self.once(possibleTransition.outputEventType, applyTransition);
				}
			}
		}
	}
737100
def _post_transition(self, result, *args, **kwargs):
        """"""
        for hook in self._filter_hooks(HOOK_AFTER, HOOK_ON_ENTER):
            hook(self.instance, result, *args, **kwargs)
1270162
function (oldInfos, newInfos, transition) {
      _emberMetalRun_loop.default.once(this, this.trigger, 'willTransition', transition);

      if (_emberMetalProperty_get.get(this, 'namespace').LOG_TRANSITIONS) {
        _emberMetalLogger.default.log('Preparing to transition from \'' + EmberRouter._routePath(oldInfos) + '\' to \'' + EmberRouter._routePath(newInfos) + '\'');
      }
    }
677651
def add_transition(rel, href, options={})
      new_representor_hash = RepresentorHash.new(deep_dup(@representor_hash.to_h))
      options = symbolize_keys(options)
      options.delete(:method) if options[:method] == Transition::DEFAULT_METHOD
      link_values = options.merge({href: href, rel: rel})

      if options[DATA_KEY]
        link_values[Transition::DESCRIPTORS_KEY] = link_values.delete(DATA_KEY)
      end

      new_representor_hash.transitions.push(link_values)
      RepresentorBuilder.new(new_representor_hash)
    end