tf_agents.metrics.tf_metrics.AverageEpisodeLengthMetric
Stay organized with collections
Save and categorize content based on your preferences.
Metric to compute the average episode length.
Inherits From: TFStepMetric
tf_agents.metrics.tf_metrics.AverageEpisodeLengthMetric(
name='AverageEpisodeLength',
prefix='Metrics',
dtype=tf.float32,
batch_size=1,
buffer_size=10
)
Methods
call
View source
call(
trajectory
)
init_variables
View source
init_variables()
Initializes this Metric's variables.
Should be called after variables are created in the first execution
of __call__()
. If using graph execution, the return value should be
run()
in a session before running the op returned by __call__()
.
(See example above.)
Returns |
If using graph execution, this returns an op to perform the
initialization. Under eager execution, the variables are reset to their
initial values as a side effect and this function returns None.
|
reset
View source
reset()
result
View source
result()
Computes and returns a final value for the metric.
tf_summaries
View source
tf_summaries(
train_step=None, step_metrics=()
)
Generates summaries against train_step and all step_metrics.
Args |
train_step
|
(Optional) Step counter for training iterations. If None, no
metric is generated against the global step.
|
step_metrics
|
(Optional) Iterable of step metrics to generate summaries
against.
|
Returns |
A list of summaries.
|
__call__
View source
__call__(
*args, **kwargs
)
Returns op to execute to update this metric for these inputs.
Returns None if eager execution is enabled.
Returns a graph-mode function if graph execution is enabled.
Args |
*args
|
|
**kwargs
|
A mini-batch of inputs to the Metric, passed on to call() .
|
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.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf_agents.metrics.tf_metrics.AverageEpisodeLengthMetric\n\n\u003cbr /\u003e\n\n|----------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metrics.py#L311-L365) |\n\nMetric to compute the average episode length.\n\nInherits From: [`TFStepMetric`](../../../tf_agents/metrics/tf_metric/TFStepMetric) \n\n tf_agents.metrics.tf_metrics.AverageEpisodeLengthMetric(\n name='AverageEpisodeLength',\n prefix='Metrics',\n dtype=tf.float32,\n batch_size=1,\n buffer_size=10\n )\n\nMethods\n-------\n\n### `call`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metrics.py#L330-L357) \n\n call(\n trajectory\n )\n\n### `init_variables`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L61-L75) \n\n init_variables()\n\nInitializes this Metric's variables.\n\nShould be called after variables are created in the first execution\nof `__call__()`. If using graph execution, the return value should be\n`run()` in a session before running the op returned by `__call__()`.\n(See example above.)\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| If using graph execution, this returns an op to perform the initialization. Under eager execution, the variables are reset to their initial values as a side effect and this function returns None. ||\n\n\u003cbr /\u003e\n\n### `reset`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metrics.py#L362-L365) \n\n reset()\n\n### `result`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metrics.py#L359-L360) \n\n result()\n\nComputes and returns a final value for the metric.\n\n### `tf_summaries`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L94-L126) \n\n tf_summaries(\n train_step=None, step_metrics=()\n )\n\nGenerates summaries against train_step and all step_metrics.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|----------------|-----------------------------------------------------------------------------------------------------------|\n| `train_step` | (Optional) Step counter for training iterations. If None, no metric is generated against the global step. |\n| `step_metrics` | (Optional) Iterable of step metrics to generate summaries against. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| A list of summaries. ||\n\n\u003cbr /\u003e\n\n### `__call__`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L82-L92) \n\n __call__(\n *args, **kwargs\n )\n\nReturns op to execute to update this metric for these inputs.\n\nReturns None if eager execution is enabled.\nReturns a graph-mode function if graph execution is enabled.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|------------|--------------------------------------------------------------|\n| `*args` | \u003cbr /\u003e \u003cbr /\u003e |\n| `**kwargs` | A mini-batch of inputs to the Metric, passed on to `call()`. |\n\n\u003cbr /\u003e"]]