Example #1
0
    def _normalize_data(self, obs, ret):
        obs_normalized = normalize(obs, self.normalization['obs'][0],
                                   self.normalization['obs'][1])
        ret_normalized = normalize(ret, self.normalization['ret'][0],
                                   self.normalization['ret'][1])

        return obs_normalized, ret_normalized
Example #2
0
    def _normalize_data(self, obs, act, obs_next=None):
        obs_normalized = normalize(obs, self.normalization['obs'][0],
                                   self.normalization['obs'][1])
        actions_normalized = normalize(act, self.normalization['act'][0],
                                       self.normalization['act'][1])

        if obs_next is not None:
            delta = obs_next - obs
            deltas_normalized = normalize(delta,
                                          self.normalization['delta'][0],
                                          self.normalization['delta'][1])
            return obs_normalized, actions_normalized, deltas_normalized
        else:
            return obs_normalized, actions_normalized
Example #3
0
    def _normalize_data(self, obs, act, delta=None):
        assert len(obs) == len(act) == self.num_models
        assert self.normalization is not None
        norm_obses = []
        norm_acts = []
        norm_deltas = []
        for i in range(self.num_models):
            norm_obs = normalize(obs[i], self.normalization[i]['obs'][0], self.normalization[i]['obs'][1])
            norm_act = normalize(act[i], self.normalization[i]['act'][0], self.normalization[i]['act'][1])
            norm_obses.append(norm_obs)
            norm_acts.append(norm_act)
            if delta is not None:
                assert len(delta) == self.num_models
                norm_delta = normalize(delta[i], self.normalization[i]['delta'][0], self.normalization[i]['delta'][1])
                norm_deltas.append(norm_delta)

        if delta is not None:
            return norm_obses, norm_acts, norm_deltas

        return norm_obses, norm_acts