OmniSafe Normalizer#
|
Calculate normalized raw_data from running mean and std |
Normalizer#
Documentation
- class omnisafe.common.normalizer.Normalizer(shape, clip=1e6)[source]#
Calculate normalized raw_data from running mean and std
References
Title: Updating Formulae and a Pairwise Algorithm for Computing Sample Variances
Author: Tony F. Chan, Gene H. Golub, Randall J. LeVeque
URL: http://i.stanford.edu/pub/cstr/reports/cs/tr/79/773/CS-TR-79-773.pdf
Initialize the normalize.
- _push(raw_data)[source]#
Update the mean and std by the raw_data.
- Parameters:
raw_data (
Tensor
) – raw data to be normalized.- Return type:
None
- load_state_dict(state_dict, strict=True)[source]#
Copies parameters and buffers from
state_dict
into this module and its descendants. Ifstrict
isTrue
, then the keys ofstate_dict
must exactly match the keys returned by this module’sstate_dict()
function.- Parameters:
state_dict (dict) – a dict containing parameters and persistent buffers.
strict (bool, optional) – whether to strictly enforce that the keys in
state_dict
match the keys returned by this module’sstate_dict()
function. Default:True
- Returns:
``NamedTuple`` with ``missing_keys`` and ``unexpected_keys`` fields –
missing_keys is a list of str containing the missing keys
unexpected_keys is a list of str containing the unexpected keys
Note
If a parameter or buffer is registered as
None
and its corresponding key exists instate_dict
,load_state_dict()
will raise aRuntimeError
.
- property mean: Tensor#
Return the mean of the normalize.
- normalize(data)[source]#
Normalize the data.
Hint
If the data is the first data, the data will be used to initialize the mean and std.
If the data is not the first data, the data will be normalized by the mean and std.
Update the mean and std by the data.
- Parameters:
data (
Tensor
) – raw data to be normalized.- Return type:
Tensor
- property shape: Tuple[int, ...]#
Return the shape of the normalize.
- property std: Tensor#
Return the std of the normalize.