tf_agents.utils.tensor_normalizer.StreamingTensorNormalizer
Stay organized with collections
Save and categorize content based on your preferences.
Normalizes mean & variance based on full history of tensor values.
Inherits From: TensorNormalizer
tf_agents.utils.tensor_normalizer.StreamingTensorNormalizer(
tensor_spec, scope='normalize_tensor'
)
Args |
tensor_spec
|
The specs of the tensors to normalize.
|
scope
|
Scope for the tf.Module .
|
Methods
map_dtype
View source
map_dtype(
dtype
)
normalize
View source
normalize(
tensor, clip_value=5.0, center_mean=True, variance_epsilon=0.001
)
Applies normalization to tensor.
Args |
tensor
|
Tensor to normalize.
|
clip_value
|
Clips normalized observations between +/- this value if
clip_value > 0, otherwise does not apply clipping.
|
center_mean
|
If true, subtracts off mean from normalized tensor.
|
variance_epsilon
|
Epsilon to avoid division by zero in normalization.
|
Returns |
normalized_tensor
|
Tensor after applying normalization.
|
reset
View source
reset()
Reset the count, mean and variance to its initial state.
update
View source
update(
tensor, outer_dims=(0,)
)
Updates tensor normalizer variables.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[],null,["# tf_agents.utils.tensor_normalizer.StreamingTensorNormalizer\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/utils/tensor_normalizer.py#L288-L394) |\n\nNormalizes mean \\& variance based on full history of tensor values.\n\nInherits From: [`TensorNormalizer`](../../../tf_agents/utils/tensor_normalizer/TensorNormalizer) \n\n tf_agents.utils.tensor_normalizer.StreamingTensorNormalizer(\n tensor_spec, scope='normalize_tensor'\n )\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------|------------------------------------------------------------------------------------|\n| `tensor_spec` | The specs of the tensors to normalize. |\n| `scope` | Scope for the [`tf.Module`](https://www.tensorflow.org/api_docs/python/tf/Module). |\n\n\u003cbr /\u003e\n\nMethods\n-------\n\n### `map_dtype`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/utils/tensor_normalizer.py#L89-L91) \n\n map_dtype(\n dtype\n )\n\n### `normalize`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/utils/tensor_normalizer.py#L134-L205) \n\n normalize(\n tensor, clip_value=5.0, center_mean=True, variance_epsilon=0.001\n )\n\nApplies normalization to tensor.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|--------------------|-------------------------------------------------------------------------------------------------------------|\n| `tensor` | Tensor to normalize. |\n| `clip_value` | Clips normalized observations between +/- this value if clip_value \\\u003e 0, otherwise does not apply clipping. |\n| `center_mean` | If true, subtracts off mean from normalized tensor. |\n| `variance_epsilon` | Epsilon to avoid division by zero in normalization. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---------------------|--------------------------------------|\n| `normalized_tensor` | Tensor after applying normalization. |\n\n\u003cbr /\u003e\n\n### `reset`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/utils/tensor_normalizer.py#L383-L394) \n\n reset()\n\nReset the count, mean and variance to its initial state.\n\n### `update`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/utils/tensor_normalizer.py#L119-L132) \n\n update(\n tensor, outer_dims=(0,)\n )\n\nUpdates tensor normalizer variables."]]