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.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tf_agents.metrics.tf_metric.TFStepMetric\n\n\u003cbr /\u003e\n\n|--------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L26-L126) |\n\nDefines the interface for TF metrics. \n\n tf_agents.metrics.tf_metric.TFStepMetric(\n name, prefix='Metrics'\n )\n\nMethods\n-------\n\n### `call`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L34-L51) \n\n call(\n *args, **kwargs\n )\n\nAccumulates statistics for the metric. Users should use **call** instead.\n| **Note:** This function is executed as a graph function in graph mode. This means: a) Operations on the same resource are executed in textual order. This should make it easier to do things like add the updated value of a variable to another, for example. b) You don't need to worry about collecting the update ops to execute. All update ops added to the graph by this function will be executed. As a result, code should generally work the same way with graph or eager execution.\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, as passed to `__call__()`. |\n\n\u003cbr /\u003e\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_metric.py#L53-L55) \n\n reset()\n\nResets the values being tracked by the metric.\n\n### `result`\n\n[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L57-L59) \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"]]