def denormalize(self, arr): """ denormalize the input :param arr: (numpy Number) the normalized input :return: (numpy Number) original input """ mean = reshape_for_broadcasting(self.mean, arr) std = reshape_for_broadcasting(self.std, arr) return mean + arr * std
def normalize(self, arr, clip_range=None): """ normalize the input :param arr: (numpy Number) the input :param clip_range: (float) the range to clip to [-clip_range, clip_range] :return: (numpy Number) normalized input """ if clip_range is None: clip_range = self.default_clip_range mean = reshape_for_broadcasting(self.mean, arr) std = reshape_for_broadcasting(self.std, arr) return tf.clip_by_value((arr - mean) / std, -clip_range, clip_range)
def denormalize(self, v): mean = reshape_for_broadcasting(self.mean, v) std = reshape_for_broadcasting(self.std, v) return mean + v * std
def normalize(self, v, clip_range=None): if clip_range is None: clip_range = self.default_clip_range mean = reshape_for_broadcasting(self.mean, v) std = reshape_for_broadcasting(self.std, v) return tf.clip_by_value((v - mean) / std, -clip_range, clip_range)
def denormalize(self, v): mean = reshape_for_broadcasting(self.mean, v) std = reshape_for_broadcasting(self.std, v) return mean + v * std
def normalize(self, v, clip_range=None): if clip_range is None: clip_range = self.default_clip_range mean = reshape_for_broadcasting(self.mean, v) std = reshape_for_broadcasting(self.std, v) return tf.clip_by_value((v - mean) / std, -clip_range, clip_range)