
    BVh                        d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl	m
Z
 ddlmZ  edg 	       e
j                  d
d      ddej                  fd              Z edg	       e
j                  d
d      ddej                  fd              Zej                   e_          ej"                         reanead Z ej(                  e       y
)zThe Counter Dataset.    )tf2)	v2_compat)dataset_ops)dtypes)deprecation)	tf_exportzdata.experimental.Counter)v1Nz+Use `tf.data.Dataset.counter(...)` instead.   c                 D    t         j                  j                  | ||      S )a  Creates a `Dataset` that counts from `start` in steps of size `step`.

  Unlike `tf.data.Dataset.range` which will stop at some ending number,
  `Counter` will produce elements indefinitely.

  >>> dataset = tf.data.experimental.Counter().take(5)
  >>> [a.item() for a in dataset.as_numpy_iterator()]
  [0, 1, 2, 3, 4]
  >>> dataset.element_spec
  TensorSpec(shape=(), dtype=tf.int64, name=None)
  >>> dataset = tf.data.experimental.Counter(dtype=tf.int32)
  >>> dataset.element_spec
  TensorSpec(shape=(), dtype=tf.int32, name=None)
  >>> dataset = tf.data.experimental.Counter(start=2).take(5)
  >>> [a.item() for a in dataset.as_numpy_iterator()]
  [2, 3, 4, 5, 6]
  >>> dataset = tf.data.experimental.Counter(start=2, step=5).take(5)
  >>> [a.item() for a in dataset.as_numpy_iterator()]
  [2, 7, 12, 17, 22]
  >>> dataset = tf.data.experimental.Counter(start=10, step=-1).take(5)
  >>> [a.item() for a in dataset.as_numpy_iterator()]
  [10, 9, 8, 7, 6]

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

  Returns:
    A `Dataset` of scalar `dtype` elements.
  )r   Datasetcounterstartstepdtypes      _/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/data/experimental/ops/counter.py	CounterV2r      s     F 
			$	$UD%	88    c                 B    t        j                  t        | ||            S N)r   DatasetV1Adapterr   r   s      r   	CounterV1r   >   s     
	%	%itU&C	DDr   c                  F    t        j                         rt        ay t        ay r   )r   enabledr   Counterr    r   r   _tf2_callbackr   L   s    [[]GGr   )__doc__tensorflow.pythonr   tensorflow.python.compatr   tensorflow.python.data.opsr   tensorflow.python.frameworkr   tensorflow.python.utilr    tensorflow.python.util.tf_exportr   
deprecatedint64r   r   r   r   r   register_data_v2_callbackr   r   r   <module>r(      s     ! . 2 . . 6 &2.KLAV\\ !9 M /!9H *+,KLAV\\ E M -E %%	 3;;='' $	 # #M 2r   