# tf_agents.eval.metric_utils.compute

<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/eval/metric_utils.py#L50-L80) |

Compute metrics using `policy` on the `environment`.

    tf_agents.eval.metric_utils.compute(
        metrics, environment, policy, num_episodes=1
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `metrics` | List of metrics to compute. |
| `environment` | py_environment instance. |
| `policy` | py_policy instance used to step the environment. A tf_policy can be used in_eager_mode. |
| `num_episodes` | Number of episodes to compute the metrics over. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A dictionary of results {metric_name: metric_value} ||

<br />