# tf.contrib.data.Counter

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/data/python/ops/counter.py#L25-L48) |

Creates a `Dataset` that counts from `start` in steps of size `step`. (deprecated)

    tf.contrib.data.Counter(
        start=0, step=1, dtype=tf.dtypes.int64
    )

> [!WARNING]
> **Warning:** THIS FUNCTION IS DEPRECATED. It will be removed in a future version. Instructions for updating: Use [`tf.data.experimental.Counter(...)`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/data/experimental/Counter).

#### For example:

    Dataset.count() == [0, 1, 2, ...)
    Dataset.count(2) == [2, 3, ...)
    Dataset.count(2, 5) == [2, 7, 12, ...)
    Dataset.count(0, -1) == [0, -1, -2, ...)
    Dataset.count(10, -1) == [10, 9, ...)

<br />

<br />

<br />

| ## Args ||
|---|---|
| `start` | (Optional.) The starting value for the counter. Defaults to 0. |
| `step` | (Optional.) The step size for the counter. Defaults to 1. |
| `dtype` | (Optional.) The data type for counter elements. Defaults to [`tf.int64`](https://www.tensorflow.org/versions/r1.15/api_docs/python/tf#int64). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `Dataset` of scalar `dtype` elements. ||

<br />