# tf_agents.metrics.tf_metric.TFHistogramStepMetric

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L129-L168) |

A metric class for metrics that emit multiple values.

Inherits From: [`TFStepMetric`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/metrics/tf_metric/TFStepMetric)

    tf_agents.metrics.tf_metric.TFHistogramStepMetric(
        name, prefix='Metrics'
    )

The only difference between `TFSTepMetric` and `TFHistogramStepMetric` is that
the latter uses histogram summaries instead of scalar summaries.

## Methods

### `call`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L34-L51)

    call(
        *args, **kwargs
    )

Accumulates statistics for the metric. Users should use **call** instead.

> [!NOTE]
> **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.

<br />

<br />

<br />

| Args ||
|---|---|
| `*args` | <br /> <br /> |
| `**kwargs` | A mini-batch of inputs to the Metric, as passed to `__call__()`. |

<br />

### `init_variables`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L61-L75)

    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.)

<br />

<br />

<br />

| 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. ||

<br />

### `reset`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L53-L55)

    reset()

Resets the values being tracked by the metric.

### `result`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L57-L59)

    result()

Computes and returns a final value for the metric.

### `tf_summaries`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L136-L168)

    tf_summaries(
        train_step=None, step_metrics=()
    )

Generates histogram summaries against train_step and all step_metrics.

<br />

<br />

<br />

| 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. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| A list of histogram summaries. ||

<br />

### `__call__`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/tf_metric.py#L82-L92)

    __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.

<br />

<br />

<br />

| Args ||
|---|---|
| `*args` | <br /> <br /> |
| `**kwargs` | A mini-batch of inputs to the Metric, passed on to `call()`. |

<br />