# tf_agents.metrics.py_metrics.NumpyDeque

<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/py_metrics.py#L34-L90) |

Deque implementation using a numpy array as a circular buffer.

Inherits From: [`NumpyState`](https://www.tensorflow.org/agents/api_docs/python/tf_agents/utils/numpy_storage/NumpyState)

    tf_agents.metrics.py_metrics.NumpyDeque(
        maxlen: https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Int,
        dtype: np.dtype
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `maxlen` | Maximum length of the deque before beginning to evict the oldest entries. If np.inf, deque size is unlimited and the array will grow automatically. |
| `dtype` | Data type of deque elements. |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `last` | <br /> <br /> |

<br />

## Methods

### `add`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/py_metrics.py#L56-L68)

    add(
        value: Any
    )

### `clear`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/py_metrics.py#L52-L54)

    clear()

### `extend`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/py_metrics.py#L70-L72)

    extend(
        values: Iterable[Any]
    )

### `mean`

[View source](https://github.com/tensorflow/agents/blob/v0.19.0/tf_agents/metrics/py_metrics.py#L85-L90)

    mean(
        dtype: Optional[np.dtype] = None
    )

### `__len__`

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

    __len__() -> https://www.tensorflow.org/agents/api_docs/python/tf_agents/typing/types/Int