Beispiel #1
0
    def _unwhiten_and_split(self, tensor_whitened, names):
        lower, upper = self._env_spec.limits(names)
        mean = 0.5 * (lower + upper)
        var = 0.5 * (upper - lower)
        tensor = tensor_whitened * var + mean

        return AttrDict.from_dict({
            k: v
            for k, v in zip(
                names, tf.split(tensor, self._env_spec.dims(names), axis=2))
        })
Beispiel #2
0
    def get_action(self, model, observation, goal):
        assert self._session is not None

        feed_dict = self._get_action_feed_dict(observation, goal)

        get_action_tf = {}
        for name, tensor in self._get_action_outputs.leaf_items():
            get_action_tf[name] = tensor

        get_action_tf_output = self._session.run(get_action_tf,
                                                 feed_dict=feed_dict)

        get_action = AttrDict.from_dict(get_action_tf_output)
        get_action.cost_fn = self._cost_fn

        return get_action