o
    ?e                    @   s-  d Z ddl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 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 ddlmZm Z  d&dej!ej" fddZ#ede$e#Z%dej!ej" fddZ&e'dddgZ(d&ddZ)ede$e)Z*dd Z+d&dej!ej" fddZ,ed e$e,Z-dej!ej" fd!d"Z.e'd#ddgZ/d&d$d%Z0ed&e$e0Z1d'd( Z2e'd)ddgZ3d&d*d+Z4ed,e$e4Z5d-d. Z6d&dej!ej" fd/d0Z7ed1e$e7Z8dej!ej" fd2d3Z9e'd4ddgZ:d&d5ej!ej; d6ej!ej; fd7d8Z<ed9e$e<Z=d5ej!ej; d6ej!ej; fd:d;Z>e'd<ddgZ?d&d5ej!ej; d6ej!ej; d=ej!ej@ fd>d?ZAed@e$eAZBd5ej!ej; d6ej!ej; d=ej!ej@ fdAdBZCd'dDej!ejD dEej!ej; dFeEdej!ejD fdGdHZFedIe$eFZGdDej!ejD dEej!ej; dFeEdej!ejD fdJdKZHd(dDej!ejD dEej!ej; dMej!ej@ dNeIdFeEdej!ejD fdOdPZJedQe$eJZKdDej!ejD dEej!ej; dMej!ej@ dNeIdFeEdej!ejD fdRdSZLd'dDej!ejD dTej!ejM dFeEdej!ejD fdUdVZNedWe$eNZOdDej!ejD dTej!ejM dFeEdej!ejD fdXdYZPd'dDej!ejD dTej!ejM dZej!ej" dFeEdej!ejD f
d[d\ZQed]e$eQZRdDej!ejD dTej!ejM dZej!ej" dFeEdej!ejD f
d^d_ZSd'dDej!ejD d`ej!ejD dFeEdej!ejD fdadbZTedce$eTZUdDej!ejD d`ej!ejD dFeEdej!ejD fdddeZVd'dDej!ejD dfeEdej!ej; fdgdhZWedie$eWZXdDej!ejD dfeEdej!ej; fdjdkZYg dLdLdfdDej!ejD dleIdmeIdej!ejM fdndoZZedpe$eZZ[dDej!ejD dleIdmeIdej!ejM fdqdrZ\d)dDej!ejD dse]dmeIdej!ejM fdtduZ^edve$e^Z_dDej!ejD dse]dmeIdej!ejM fdwdxZ`d'dyej!ejD dFeEfdzd{Zaed|e$eaZbdyej!ejD dFeEfd}d~Zcd&dej!ej" dej!ejD fddZdede$edZedej!ej" dej!ejD fddZfd&dej!ej" dej!ejD fddZgede$egZhdej!ej" dej!ejD fddZid&dej!ej" de ej!ej"  dej!ejD fddZjede$ejZkdej!ej" de ej!ej"  dej!ejD fddZld&dej!ej" dej!ejD fddZmede$emZndej!ej" dej!ejD fddZod&dej!ej" dej!ejD fddZpede$epZqdej!ej" dej!ejD fddZrd&dej!ej" dej!ejD fddZsede$esZtdej!ej" dej!ejD fddZud&dej!ej" fddZvede$evZwdej!ej" fddZxd&dej!ej" fddZyede$eyZzdej!ej" fddZ{d&dDej!ejD dej!ejD fddZ|ede$e|Z}dDej!ejD dej!ejD fddZ~d'dDej!ejD dFeEdej!ejD fddZede$eZdDej!ejD dFeEdej!ejD fddZd*dDej!ejD deIdej!ejD fddZede$eZdDej!ejD deIdej!ejD fddZd'dej!ejM dej!ej; dej!ej; dej!ej; dej!ej; dFeEdej!ejD fddZede$eZdej!ejM dej!ej; dej!ej; dej!ej; dej!ej; dFeEdej!ejD fddĄZd'dej!ejM dej!ej; dej!ej; dej!ej; dej!ej; dej!ejM dFeEdej!ejD fddǄZedȃe$eZdej!ejM dej!ej; dej!ej; dej!ej; dej!ej; dej!ejM dFeEdej!ejD fddʄZd'dDej!ejD dFeEdej!ejD fdd̄Zed̓e$eZdDej!ejD dFeEdej!ejD fddτZd'dFeEdej!ejD fddфZed҃e$eZdFeEdej!ejD fddԄZd&dDej!ejD dej!ejM fddքZed׃e$eZdDej!ejD dej!ejM fddلZd'dDej!ejD dej!ej; dej!ej; dFeEdej!ejD f
dd݄Zedރe$eZdDej!ejD dej!ej; dej!ej; dFeEdej!ejD f
ddZd&deEdeEdej!ej" fddZede$eZdeEdeEdej!ej" fddZg g dfdej!ejM dej!ej" fddZede$eZdej!ejM dej!ej" fddZg g dfdej!ejM dej!ej" fddZede$eZdej!ejM dej!ej" fddZd&dej!ej" fddZede$eZdej!ej" fddZd&dej!ej" dej!ejD fddZede$eZdej!ej" dej!ejD fddZd&dej!ej" fddZede$eZdej!ej" fd dZd&dej!ej" dej!ejM fddZede$eZdej!ej" dej!ejM fddZd&deEdeEdej!ej" fddZed	e$eZdeEdeEdej!ej" fd
dZd&dyej!ejD dej!ej" fddZede$eZdyej!ejD dej!ej" fddZd+dDej!ejD deIdeIdFeEdej!ejD f
ddZede$eZdDej!ejD deIdeIdFeEdej!ejD f
ddZd,de]fddZede$eZde]fddZd-dDej!ejD d e]d!e]d"e]dej!ejD f
d#d$Zed%e$eZdDej!ejD d e]d!e]d"e]dej!ejD f
d&d'Zd&deEdeEdej!ej" fd(dZed)e$eZdeEdeEdej!ej" fd*d+Zg g dfdej!ejM dej!ej" fd,d-Zed.e$eZdej!ejM dej!ej" fd/d0Zd&dej!ej" d1ej!ej d2ej!ej; fd3d4Zed5e$e¡Zdej!ej" d1ej!ej d2ej!ej; fd6d7ZĐd&dyej!ejD dej!ej" d8ej!ej; dej!ej; fd9d:Zed;e$ešZdyej!ejD dej!ej" d8ej!ej; dej!ej; fd<d=Zǐd&dej!ej" dej!ejM fd>d?Zed@e$eȡZdej!ej" dej!ejM fdAdBZʐd.deEdeEdej!ej" fdCdDZedEe$eˡZdeEdeEdej!ej" fdFdGZg dfdDej!ejD dHej!ejM dej!ejD fdIdJZedKe$eΡZdDej!ejD dHej!ejM dej!ejD fdLdMZg dfdDej!ejD dNej!ejM dOej!ejM dPej!ejM dej!ejD f
dQdRZedSe$eѡZdDej!ejD dNej!ejM dOej!ejM dPej!ejM dej!ejD f
dTdUZӐd'dDej!ejD dVeEdFeEdej!ejD fdWdXZedYe$eԡZdDej!ejD dVeEdFeEdej!ejD fdZd[Z֐d'dDej!ejD dEej!ej; d\e ej!ej;  dFeEdej!ejD f
d]d^Zed_e$eסZdDej!ejD dEej!ej; d\e ej!ej;  dFeEdej!ejD f
d`daZِd(dDej!ejD dEej!ej; d\e ej!ej;  dMej!ej@ dNeIdFeEdej!ejD fdbdcZedde$eڡZdDej!ejD dEej!ej; d\e ej!ej;  dMej!ej@ dNeIdFeEdej!ejD fdedfZܐd/dDej!ejD dEej!ej; dhej!ej; dMej!ej@ dNeIdieEdFeEdej!ejD fdjdkZedle$eݡZdDej!ejD dEej!ej; dhej!ej; dMej!ej@ dNeIdieEdFeEdej!ejD fdmdnZߐd0dDej!ejD dhej!ej; dieEdFeEdej!ejD f
dodpZedqe$eZdDej!ejD dhej!ej; dieEdFeEdej!ejD f
drdsZd(dDej!ejD dej!ej; dej!ej; dhej!ej; dteIdFeEdej!ejD fdudvZedwe$eZdDej!ejD dej!ej; dej!ej; dhej!ej; dteIdFeEdej!ejD fdxdyZd0dDej!ejD dej!ej; dej!ej; dhej!ej; dieEdFeEdej!ejD fdzd{Zed|e$eZdDej!ejD dej!ej; dej!ej; dhej!ej; dieEdFeEdej!ejD fd}d~Zd0dDej!ejD dej!ej; dej!ej; dej!ej; dej!ej; dhej!ej; dieEdFeEdej!ejD fddZede$eZdDej!ejD dej!ej; dej!ej; dej!ej; dej!ej; dhej!ej; dieEdFeEdej!ejD fddZd1dDej!ejD dhej!ej deIdteIdeIdFeEdej!ejD fddZede$eZdDej!ejD dhej!ej deIdteIdeIdFeEdej!ejD fddZd2dDej!ejD dhej!ej; deIdieEdeIdFeEdej!ejD fddZede$eZdDej!ejD dhej!ej; deIdieEdeIdFeEdej!ejD fddZd3dDej!ejD dej!ej; de]deIde]dFeEdej!ejD fddZede$eZdDej!ejD dej!ej; de]deIde]dFeEdej!ejD fddZd4dej!ej; dej!ej; dej!ej; dFeEdeIdej!ejD fddZede$eZdej!ej; dej!ej; dej!ej; dFeEdeIdej!ejD fddZd5dDej!ejD deIdFeEfddZede$eZdDej!ejD deIdFeEfddZd'dDej!ejD dej!ej; dFeEdej!ejD fddZede$eZdDej!ejD dej!ej; dFeEdej!ejD fddZd&dDej!ejD dej!ejM dej!ejD fddZede$eZdDej!ejD dej!ejM dej!ejD fddZ d6dej!ej" dse]dej!ejD fddZede$eZdej!ej" dse]dej!ejD fddZd(dDej!ejD dej!ej; dej!ej; deIdFeEdej!ejD fddZede$eZdDej!ejD dej!ej; dej!ej; deIdFeEdej!ejD fddZd5dDej!ejD dej!ej; d5ej!ej; d6ej!ej; dej!ej; deIdFeEdej!ejD fddZede$eZdDej!ejD dej!ej; d5ej!ej; d6ej!ej; dej!ej; deIdFeEdej!ejD fdÐdĄZ	d5dDej!ejD dej!ej; d5ej!ej; d6ej!ej; dej!ej; dej!ej" deIdFeEdej!ejD fdƐdǄZ
edȃe$e
ZdDej!ejD dej!ej; d5ej!ej; d6ej!ej; dej!ej; dej!ej" deIdFeEdej!ejD fdɐdʄZd5dDej!ejD dej!ej; d5ej!ej; d6ej!ej; deIdFeEdej!ejD fdːd̄Zed̓e$eZdDej!ejD dej!ej; d5ej!ej; d6ej!ej; deIdFeEdej!ejD fdΐdτZd'dDej!ejD dej!ej; dej!ej" dFeEdej!ejD f
dАdфZed҃e$eZdDej!ejD dej!ej; dej!ej" dFeEdej!ejD f
dӐdԄZd5dDej!ejD dej!ej; d5ej!ej; d6ej!ej; dej!ej" deIdFeEdej!ejD fdՐdքZed׃e$eZdDej!ejD dej!ej; d5ej!ej; d6ej!ej; dej!ej" deIdFeEdej!ejD fdؐdلZd'dDej!ejD dej!ej; dFeEdej!ejD fdڐdۄZed܃e$eZdDej!ejD dej!ej; dFeEdej!ejD fdݐdބZedejej@ejejejejejejej ejej;ej!ej"ej#ej$ej%ej&ej"ejMej'ej(ej)ej*ejDZ+d&dej!ej; dej!e+ dej!ej; dej!ejD fddZ,ede$e,Z-dej!ej; dej!e+ dej!ej; dej!ejD fddZ.d'dej!ejM dej!ejM dej!ej; dFeEdej!ejD f
ddZ/ede$e/Z0dej!ejM dej!ejM dej!ej; dFeEdej!ejD f
ddZ1d'dej!ejM dej!ejM dej!ej; dej!ej; dFeEdej!ejD fddZ2ede$e2Z3dej!ejM dej!ejM dej!ej; dej!ej; dFeEdej!ejD fddZ4d'dDej!ejD dej!ej; dFeEdej!ejD fddZ5ede$e5Z6dDej!ejD dej!ej; dFeEdej!ejD fddZ7d'dFeEdej!ejD fddZ8ede$e8Z9dFeEdej!ejD fddZ:d7deIdFeEdeIdej!ejD fddZ;ed e$e;Z<deIdFeEdeIdej!ejD fddZ=d'dej!ejM dej!ejM dej!ej; dFeEdej!ejD f
ddZ>ede$e>Z?dej!ejM dej!ejM dej!ej; dFeEdej!ejD f
ddZ@d&dej!ejD dej!ejD fd	d
ZAede$eAZBdej!ejD dej!ejD fddZCd'dDej!ejD dej!ej; dej!ej; dej!ej; dMej!ej@ dFeEdej!ejD fddZDede$eDZEdDej!ejD dej!ej; dej!ej; dej!ej; dMej!ej@ dFeEdej!ejD fddZFd&dej!ejD fddZGede$eGZHdej!ejD fddZId&dej!ejD dej!ejD fddZJede$eJZKdej!ejD dej!ejD fddZLd'd e ej!ejD  dFeEdej!ejD fd!d"ZMed#e$eMZNd e ej!ejD  dFeEdej!ejD fd$d%ZOdS (8  zUPython wrappers around TensorFlow ops.

This file is MACHINE GENERATED! Do not edit.
    N)
pywrap_tfe)context)core)execute)dtypes)annotation_types)op_def_registry)ops)op_def_library)deprecated_endpoints)dispatch)	tf_export)TypeVarListreturnc              
   C   Z  t j pt  }|j}|jrRzt|d|d| d|}|W S  tjy4 } zt	|| W Y d}~nd}~w tj
y=   Y nw z	t| |||dW S  tjyQ   Y nw t| ttfs_td|  dd | D } t|ttfsstd	| d
d |D }tjd| ||d\}}}}	|	dd }t rd|dd|df}
|j}td||
| |\}|S )7  A container for an iterator resource.

  Args:
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `resource`.
  AnonymousIteratoroutput_typesoutput_shapesNr   r   namectxMExpected list for 'output_types' argument to 'anonymous_iterator' Op, not %r.c                 S      g | ]}t |d qS r   _executeZ	make_type.0Z_t r    f/home/www/facesmatcher.com/pyenv/lib/python3.10/site-packages/tensorflow/python/ops/gen_dataset_ops.py
<listcomp>:       z&anonymous_iterator.<locals>.<listcomp>NExpected list for 'output_shapes' argument to 'anonymous_iterator' Op, not %r.c                 S   r   r   r   Z
make_shaper   Z_sr    r    r!   r"   ?   r#   r   r   r   )_contextr   _thread_local_datais_eagerr   TFE_Py_FastPathExecute_core_NotOkStatusException_opsraise_from_not_ok_status_FallbackException!anonymous_iterator_eager_fallback_SymbolicException
isinstancelisttuple	TypeError_op_def_library_apply_op_helperr   must_record_gradientget_attrinputsrecord_gradientr   r   r   _ctxtld_resulte__op_outputs_attrs_inputs_flatr    r    r!   anonymous_iterator   h   
rH   zraw_ops.AnonymousIteratorc                 C      t | ttfstd|  dd | D } t |ttfs!td| dd |D }g }d| d|f}tjdd	||||d
}t rGtd||| |\}|S )Nr   c                 S   r   r   r   r   r    r    r!   r"   U   r#   z5anonymous_iterator_eager_fallback.<locals>.<listcomp>r$   c                 S   r   r%   r&   r'   r    r    r!   r"   Z   r#   r   r   s   AnonymousIterator   r<   attrsr   r   r   r4   r5   r6   r7   r   r   r:   r=   r   r   r   r   rG   rF   rA   r    r    r!   r2   P   2   
r2   AnonymousIteratorV2handledeleterc              
   C   sh  t j pt  }|j}|jrWzt|d|d| d|}t|}|W S  tj	y9 } zt
|| W Y d}~nd}~w tjyB   Y nw z	t| |||dW S  tjyV   Y nw t| ttfsdtd|  dd | D } t|ttfsxtd	| d
d |D }tjd| ||d\}}}}	|	dd }t rd|dd|df}
|j}td||
| t|}|S )a  A container for an iterator resource.

  Args:
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (handle, deleter).

    handle: A `Tensor` of type `resource`.
    deleter: A `Tensor` of type `variant`.
  rQ   r   r   Nr   PExpected list for 'output_types' argument to 'anonymous_iterator_v2' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"      r#   z)anonymous_iterator_v2.<locals>.<listcomp>QExpected list for 'output_shapes' argument to 'anonymous_iterator_v2' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"      r#   r(   )r)   r   r*   r+   r   r,   _AnonymousIteratorV2Output_maker-   r.   r/   r0   r1   $anonymous_iterator_v2_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   r>   r    r    r!   anonymous_iterator_v2j   sj   


rY   zraw_ops.AnonymousIteratorV2c                 C   s   t | ttfstd|  dd | D } t |ttfs!td| dd |D }g }d| d|f}tjdd	||||d
}t rGtd||| t	|}|S )NrT   c                 S   r   r   r   r   r    r    r!   r"      r#   z8anonymous_iterator_v2_eager_fallback.<locals>.<listcomp>rU   c                 S   r   r%   r&   r'   r    r    r!   r"      r#   r   r   s   AnonymousIteratorV2   rL   rQ   )
r4   r5   r6   r7   r   r   r:   r=   rV   rW   rO   r    r    r!   rX      s2   

rX   c              
   C   r   )r   AnonymousIteratorV3r   r   Nr   PExpected list for 'output_types' argument to 'anonymous_iterator_v3' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"      r#   z)anonymous_iterator_v3.<locals>.<listcomp>QExpected list for 'output_shapes' argument to 'anonymous_iterator_v3' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"      r#   r(   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   $anonymous_iterator_v3_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   r>   r    r    r!   anonymous_iterator_v3   rI   r_   zraw_ops.AnonymousIteratorV3c                 C   rJ   )Nr\   c                 S   r   r   r   r   r    r    r!   r"      r#   z8anonymous_iterator_v3_eager_fallback.<locals>.<listcomp>r]   c                 S   r   r%   r&   r'   r    r    r!   r"      r#   r   r   s   AnonymousIteratorV3rK   rL   r[   rN   rO   r    r    r!   r^      rP   r^   AnonymousMemoryCachec           
   
   C   s   t j pt  }|j}|jrQzt|d| }t|}|W S  tj	y5 } zt
||  W Y d}~nd}~w tjy>   Y nw zt| |dW S  tjyP   Y nw tjd| d\}}}}|dd }t rsd}|j}	td|	|| t|}|S )zTODO: add doc.

  Args:
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (handle, deleter).

    handle: A `Tensor` of type `resource`.
    deleter: A `Tensor` of type `variant`.
  r`   Nr   r   r   r    )r)   r   r*   r+   r   r,   _AnonymousMemoryCacheOutputrW   r-   r.   r/   r0   r1   %anonymous_memory_cache_eager_fallbackr3   r8   r9   r   r:   r<   r=   
r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   anonymous_memory_cache  sD   

rf   zraw_ops.AnonymousMemoryCachec                 C   sD   g }d }t jdd|||| d}t  rt d||| t|}|S )Ns   AnonymousMemoryCacherZ   rL   r`   )r   r   r:   r=   rc   rW   r   r   rG   rF   rA   r    r    r!   rd   :  s   

rd   AnonymousMultiDeviceIteratorc                 C   s  t j pt  }|j}|jrZzt|d|d| d|d|	}t|}|W S  tj	y; } zt
|| W Y d}~nd}~w tjyD   Y nw z
t| ||||dW S  tjyY   Y nw t| ttfsgtd|  dd	 | D } t|ttfs{td
| dd	 |D }t|ttfstd| dd	 |D }tjd| |||d\}}}	}
|
dd }t rd|	dd|	dd|	df}|	j}td||| t|}|S )a  A container for a multi device iterator resource.

  Args:
    devices: A list of `strings` that has length `>= 1`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (handle, deleter).

    handle: A `Tensor` of type `resource`.
    deleter: A `Tensor` of type `variant`.
  rh   devicesr   r   Nri   r   r   r   r   UExpected list for 'devices' argument to 'anonymous_multi_device_iterator' Op, not %r.c                 S   r   ri   r   make_strr'   r    r    r!   r"   q  r#   z3anonymous_multi_device_iterator.<locals>.<listcomp>ZExpected list for 'output_types' argument to 'anonymous_multi_device_iterator' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   v  r#   [Expected list for 'output_shapes' argument to 'anonymous_multi_device_iterator' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   {  r#   ri   r   r   r   )r)   r   r*   r+   r   r,   #_AnonymousMultiDeviceIteratorOutputrW   r-   r.   r/   r0   r1   .anonymous_multi_device_iterator_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   ri   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   anonymous_multi_device_iteratorJ  s~   



ru   z$raw_ops.AnonymousMultiDeviceIteratorc                 C   s   t | ttfstd|  dd | D } t |ttfs!td| dd |D }t |ttfs5td| dd |D }g }d| d	|d
|f}tjdd||||d}t r]td||| t	|}|S )Nrk   c                 S   r   rl   rm   r'   r    r    r!   r"     r#   zBanonymous_multi_device_iterator_eager_fallback.<locals>.<listcomp>ro   c                 S   r   r   r   r   r    r    r!   r"     r#   rp   c                 S   r   r%   r&   r'   r    r    r!   r"     r#   ri   r   r   s   AnonymousMultiDeviceIteratorrZ   rL   rh   )
r4   r5   r6   r7   r   r   r:   r=   rr   rW   ri   r   r   r   r   rG   rF   rA   r    r    r!   rs     sF   

rs   c                 C   s  t j pt  }|j}|jrUzt|d|d| d|d|	}|W S  tjy6 } zt	|| W Y d}~nd}~w tj
y?   Y nw z
t| ||||dW S  tjyT   Y nw t| ttfsbtd|  dd	 | D } t|ttfsvtd
| dd	 |D }t|ttfstd| dd	 |D }tjd| |||d\}}}	}
|
dd }t rd|	dd|	dd|	df}|	j}td||| |\}|S )a|  A container for a multi device iterator resource.

  Args:
    devices: A list of `strings` that has length `>= 1`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `resource`.
  AnonymousMultiDeviceIteratorV3ri   r   r   Nrj   XExpected list for 'devices' argument to 'anonymous_multi_device_iterator_v3' Op, not %r.c                 S   r   rl   rm   r'   r    r    r!   r"     r#   z6anonymous_multi_device_iterator_v3.<locals>.<listcomp>]Expected list for 'output_types' argument to 'anonymous_multi_device_iterator_v3' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   ^Expected list for 'output_shapes' argument to 'anonymous_multi_device_iterator_v3' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   rq   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   1anonymous_multi_device_iterator_v3_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   rt   r    r    r!   "anonymous_multi_device_iterator_v3  s|   

r|   z&raw_ops.AnonymousMultiDeviceIteratorV3c                 C   s   t | ttfstd|  dd | D } t |ttfs!td| dd |D }t |ttfs5td| dd |D }g }d| d	|d
|f}tjdd||||d}t r]td||| |\}|S )Nrx   c                 S   r   rl   rm   r'   r    r    r!   r"     r#   zEanonymous_multi_device_iterator_v3_eager_fallback.<locals>.<listcomp>ry   c                 S   r   r   r   r   r    r    r!   r"     r#   rz   c                 S   r   r%   r&   r'   r    r    r!   r"     r#   ri   r   r   s   AnonymousMultiDeviceIteratorV3rK   rL   rw   rN   rv   r    r    r!   r{     sF   
r{   AnonymousRandomSeedGeneratorseedseed2c              
   C   s   t j pt  }|j}|jrUzt|d|| |}t|}|W S  tj	y7 } zt
|| W Y d}~nd}~w tjy@   Y nw z	t| |||dW S  tjyT   Y nw tjd| ||d\}}}}	|	dd }t ryd}
|j}td||
| t|}|S )a,  TODO: add doc.

  Args:
    seed: A `Tensor` of type `int64`.
    seed2: A `Tensor` of type `int64`.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (handle, deleter).

    handle: A `Tensor` of type `resource`.
    deleter: A `Tensor` of type `variant`.
  r}   Nra   )r~   r   r   r    )r)   r   r*   r+   r   r,   #_AnonymousRandomSeedGeneratorOutputrW   r-   r.   r/   r0   r1   .anonymous_random_seed_generator_eager_fallbackr3   r8   r9   r   r:   r<   r=   )r~   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   anonymous_random_seed_generator  sD   


r   z$raw_ops.AnonymousRandomSeedGeneratorc                 C   sd   t | tj} t |tj}| |g}d }tjdd||||d}t r+td||| t	|}|S )Ns   AnonymousRandomSeedGeneratorrZ   rL   r}   )
r/   convert_to_tensor_dtypesint64r   r   r:   r=   r   rW   )r~   r   r   r   rG   rF   rA   r    r    r!   r   <  s   
r   AnonymousSeedGenerator	reshufflec              
   C   s  t j pt  }|j}|jrWzt|d|| ||}t|}|W S  tj	y8 } zt
|| W Y d}~nd}~w tjyA   Y nw z
t| ||||dW S  tjyV   Y nw tjd| |||d\}}}	}
|
dd }t r|d}|	j}td||| t|}|S )aV  TODO: add doc.

  Args:
    seed: A `Tensor` of type `int64`.
    seed2: A `Tensor` of type `int64`.
    reshuffle: A `Tensor` of type `bool`.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (handle, deleter).

    handle: A `Tensor` of type `resource`.
    deleter: A `Tensor` of type `variant`.
  r   Nra   )r~   r   r   r   r    )r)   r   r*   r+   r   r,   _AnonymousSeedGeneratorOutputrW   r-   r.   r/   r0   r1   'anonymous_seed_generator_eager_fallbackr3   r8   r9   r   r:   r<   r=   )r~   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   anonymous_seed_generatorO  sF   


r   zraw_ops.AnonymousSeedGeneratorc                 C   st   t | tj} t |tj}t |tj}| ||g}d }tjdd||||d}t r3td||| t	
|}|S )Ns   AnonymousSeedGeneratorrZ   rL   r   )r/   r   r   r   boolr   r   r:   r=   r   rW   )r~   r   r   r   r   rG   rF   rA   r    r    r!   r     s   

r    input_dataset
batch_sizemetadatac                 C     t j pt  }|j}|jrYzt|d|| |d|d|d|}|W S  tjy8 }	 zt	|	| W Y d}	~	nd}	~	w tj
yA   Y nw zt| ||||||dW S  tjyX   Y nw t|ttfsftd| dd	 |D }t|ttfsztd
| dd	 |D }|du rd}t|d}tjd| |||||d\}
}
}}|dd }t rd|dd|dd|df}|j}td||| |\}|S )aA  Creates a dataset that batches `batch_size` elements from `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    batch_size: A `Tensor` of type `int64`.
      A scalar representing the number of elements to accumulate in a
      batch.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  BatchDatasetr   r   r   Nr   r   r   r   r   HExpected list for 'output_types' argument to 'batch_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z!batch_dataset.<locals>.<listcomp>IExpected list for 'output_shapes' argument to 'batch_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   )r   r   r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   batch_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r   r   r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   batch_dataset  t   

r   zraw_ops.BatchDatasetc           
      C      t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}t| tj	} t|tj
}| |g}d|d	|d|f}tjd
d||||d}	t retd|||	 |	\}	|	S )Nr   c                 S   r   r   r   r   r    r    r!   r"     r#   z0batch_dataset_eager_fallback.<locals>.<listcomp>r   c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   r   r   s   BatchDatasetrK   rL   r   r4   r5   r6   r7   r   rn   r/   r   r   variantr   r   r:   r=   )
r   r   r   r   r   r   r   rG   rF   rA   r    r    r!   r     @   
r   Fdrop_remainderparallel_copyc                 C     t j pt  }|j}	|	jr^zt|d|| ||d|d|d|d|}
|
W S  tjy; } zt	|| W Y d}~nd}~w tj
yD   Y nw zt| ||||||||d	W S  tjy]   Y nw t|ttfsktd| d	d
 |D }t|ttfstd| dd
 |D }|du rd}t|d}|du rd}t|d}tjd| |||||||d	\}}}}|dd }
t rd|dd|dd|dd|df}|j}td|||
 |
\}
|
S )a  Creates a dataset that batches `batch_size` elements from `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    batch_size: A `Tensor` of type `int64`.
      A scalar representing the number of elements to accumulate in a batch.
    drop_remainder: A `Tensor` of type `bool`.
      A scalar representing whether the last batch should be dropped in case its size
      is smaller than desired.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    parallel_copy: An optional `bool`. Defaults to `False`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  BatchDatasetV2r   r   r   r   N)r   r   r   r   r   r   KExpected list for 'output_types' argument to 'batch_dataset_v2' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z$batch_dataset_v2.<locals>.<listcomp>LExpected list for 'output_shapes' argument to 'batch_dataset_v2' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   Fr   )r   r   r   r   r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   batch_dataset_v2_eager_fallbackr3   r4   r5   r6   r7   r   	make_boolrn   r8   r9   r:   _get_attr_boolr;   r<   r=   )r   r   r   r   r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   batch_dataset_v2  s   



r   zraw_ops.BatchDatasetV2c	                 C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d	}t| t	j
} t|t	j}t|t	j}| ||g}	d|d
|d|d	|f}
tjdd|	|
||d}t r{td|	|
| |\}|S )Nr   c                 S   r   r   r   r   r    r    r!   r"   A  r#   z3batch_dataset_v2_eager_fallback.<locals>.<listcomp>r   c                 S   r   r%   r&   r'   r    r    r!   r"   F  r#   Fr   r   r   r   r   s   BatchDatasetV2rK   rL   r   r4   r5   r6   r7   r   r   rn   r/   r   r   r   r   r   r   r:   r=   )r   r   r   r   r   r   r   r   r   rG   rF   rA   r    r    r!   r   <  H   

r   filenamec                 C   r   )aU  Creates a dataset that caches elements from `input_dataset`.

  A CacheDataset will iterate over the input_dataset, and store tensors. If the
  cache already exists, the cache will be used. If the cache is inappropriate
  (e.g. cannot be opened, contains tensors of the wrong shape / size), an error
  will the returned when used.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    filename: A `Tensor` of type `string`.
      A path on the filesystem where we should cache the dataset. Note: this
      will be a directory.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  CacheDatasetr   r   r   Nr   HExpected list for 'output_types' argument to 'cache_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z!cache_dataset.<locals>.<listcomp>IExpected list for 'output_shapes' argument to 'cache_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   )r   r   r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   cache_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r   r   r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   cache_dataset\  st   

r   zraw_ops.CacheDatasetc           
      C   r   )Nr   c                 S   r   r   r   r   r    r    r!   r"     r#   z0cache_dataset_eager_fallback.<locals>.<listcomp>r   c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   r   r   s   CacheDatasetrK   rL   r   )r4   r5   r6   r7   r   rn   r/   r   r   r   stringr   r:   r=   )
r   r   r   r   r   r   r   rG   rF   rA   r    r    r!   r     r   r   cachec                 C     t j pt  }|j}|jr[zt|d|| ||d|d|d|}	|	W S  tjy9 }
 zt	|
| W Y d}
~
nd}
~
w tj
yB   Y nw zt| |||||||dW S  tjyZ   Y nw t|ttfshtd| dd	 |D }t|ttfs|td
| dd	 |D }|du rd}t|d}tjd| ||||||d\}}}}|dd }	t rd|dd|dd|df}|j}td|||	 |	\}	|	S )a  TODO: add doc.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    filename: A `Tensor` of type `string`.
    cache: A `Tensor` of type `resource`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  CacheDatasetV2r   r   r   Nr   KExpected list for 'output_types' argument to 'cache_dataset_v2' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z$cache_dataset_v2.<locals>.<listcomp>LExpected list for 'output_shapes' argument to 'cache_dataset_v2' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   )r   r   r   r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   cache_dataset_v2_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r   r   r   r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   cache_dataset_v2  sv   
r   zraw_ops.CacheDatasetV2c                 C      t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}t| tj	} t|tj
}t|tj}| ||g}d|d	|d|f}	tjd
d||	||d}
t rmtd||	|
 |
\}
|
S )Nr   c                 S   r   r   r   r   r    r    r!   r"     r#   z3cache_dataset_v2_eager_fallback.<locals>.<listcomp>r   c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   r   r   s   CacheDatasetV2rK   rL   r   )r4   r5   r6   r7   r   rn   r/   r   r   r   r   resourcer   r:   r=   )r   r   r   r   r   r   r   r   rG   rF   rA   r    r    r!   r     B   

r   another_datasetc                 C   r   )a  Creates a dataset that concatenates `input_dataset` with `another_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    another_dataset: A `Tensor` of type `variant`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ConcatenateDatasetr   r   r   Nr   NExpected list for 'output_types' argument to 'concatenate_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   F  r#   z'concatenate_dataset.<locals>.<listcomp>OExpected list for 'output_shapes' argument to 'concatenate_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   K  r#   r   )r   r   r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   "concatenate_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r   r   r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   concatenate_dataset   sx   

r   zraw_ops.ConcatenateDatasetc           
      C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}t| tj	} t|tj	}| |g}d|d	|d|f}tj
d
d||||d}	t retd|||	 |	\}	|	S )Nr   c                 S   r   r   r   r   r    r    r!   r"   h  r#   z6concatenate_dataset_eager_fallback.<locals>.<listcomp>r   c                 S   r   r%   r&   r'   r    r    r!   r"   m  r#   r   r   r   r   s   ConcatenateDatasetrK   rL   r   )r4   r5   r6   r7   r   rn   r/   r   r   r   r   r:   r=   )
r   r   r   r   r   r   r   rG   rF   rA   r    r    r!   r   c  r   r   cardinality_optionsc              
   C     t j pt  }|j}|jrQzt|d|| d|}|W S  tjy3 } zt	|| W Y d}~nd}~w tj
y<   Y nw z	t| |||dW S  tjyP   Y nw |du rWd}t|d}tjd| ||d\}}}}	|	dd }t rd|df}
|j}td||
| |\}|S )a~  Returns the cardinality of `input_dataset`.

  Returns the cardinality of `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
      A variant tensor representing the dataset to return cardinality for.
    cardinality_options: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `int64`.
  DatasetCardinalityr   N)r   r   r   r   )r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   "dataset_cardinality_eager_fallbackr3   r   rn   r8   r9   r:   r;   r<   r=   )r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   dataset_cardinality  sP   r   zraw_ops.DatasetCardinalityc                 C   l   |d u rd}t |d}t| tj} | g}d|f}t jdd||||d}t  r1t d||| |\}|S )Nr   r   s   DatasetCardinalityrK   rL   r   )	r   rn   r/   r   r   r   r   r:   r=   )r   r   r   r   rG   rF   rA   r    r    r!   r        
r   allow_statefulstrip_device_assignmentc                 C   s  t j pt  }|j}|jrWzt|d|| d|d|d|
}|W S  tjy7 } zt	|| W Y d}~nd}~w tj
y@   Y nw zt| |||||dW S  tjyV   Y nw |du r]g }t|ttfsjtd| dd	 |D }|du rwd
}t|d}|du rd
}t|d}tjd| ||||d\}	}	}
}|dd }t rd|
dd|
dd|
df}|
j}td||| |\}|S )a/  Returns a serialized GraphDef representing `input_dataset`.

  Returns a graph representation for `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
      A variant tensor representing the dataset to return the graph representation for.
    stateful_whitelist: An optional list of `strings`. Defaults to `[]`.
    allow_stateful: An optional `bool`. Defaults to `False`.
    strip_device_assignment: An optional `bool`. Defaults to `False`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `string`.
  DatasetToGraphstateful_whitelistr   r   N)r   r   r   r   r   QExpected list for 'stateful_whitelist' argument to 'dataset_to_graph' Op, not %r.c                 S   r   r   rm   r'   r    r    r!   r"     r#   z$dataset_to_graph.<locals>.<listcomp>F)r   r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   dataset_to_graph_eager_fallbackr3   r4   r5   r6   r7   r   r   r8   r9   r:   r;   r   r<   r=   )r   r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   dataset_to_graph  sz   


r   zraw_ops.DatasetToGraphc           	      C   s   |d u rg }t |ttfstd| dd |D }|d u r d}t|d}|d u r,d}t|d}t| tj	} | g}d|d|d|f}tj
dd	||||d
}t r[td||| |\}|S )Nr   c                 S   r   r   rm   r'   r    r    r!   r"     r#   z3dataset_to_graph_eager_fallback.<locals>.<listcomp>Fr   r   r   s   DatasetToGraphrK   rL   r   r4   r5   r6   r7   r   r   r/   r   r   r   r   r:   r=   )	r   r   r   r   r   r   rG   rF   rA   r    r    r!   r     s:   
r   external_state_policyc              
   C   s@  t j pt  }|j}|jrTzt|d|| d|d|}|W S  tjy5 } zt	|| W Y d}~nd}~w tj
y>   Y nw z
t| ||||dW S  tjyS   Y nw |du rZd}t|d}|du rfd}t|d}tjd| |||d\}}}	}
|
dd }t rd|	dd|	df}|	j}td||| |\}|S )	a  Returns a serialized GraphDef representing `input_dataset`.

  Returns a graph representation for `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
      A variant tensor representing the dataset to return the graph representation for.
    external_state_policy: An optional `int`. Defaults to `0`.
    strip_device_assignment: An optional `bool`. Defaults to `False`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `string`.
  DatasetToGraphV2r   r   N)r   r   r   r   r   F)r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   "dataset_to_graph_v2_eager_fallbackr3   r   make_intr   r8   r9   r:   _get_attr_intr   r<   r=   )r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   dataset_to_graph_v2&  sd   r   zraw_ops.DatasetToGraphV2c                 C   s   |d u rd}t |d}|d u rd}t |d}t| tj} | g}d|d|f}t jdd||||d}t  r?t 	d||| |\}|S )	Nr   r   Fr   s   DatasetToGraphV2rK   rL   r   )
r   r   r   r/   r   r   r   r   r:   r=   )r   r   r   r   r   rG   rF   rA   r    r    r!   r   d  s(   
r   datasetc                 C   s  t j pt  }|j}|jrWzt|d|| d|d|d|
}|W S  tjy7 } zt	|| W Y d}~nd}~w tj
y@   Y nw zt| |||||dW S  tjyV   Y nw t|ttfsdtd| dd	 |D }t|ttfsxtd
| dd	 |D }|du rd}t|d}tjd| ||||d\}	}	}
}|dd }|s|
S t rd|
dd|
dd|
df}|
j}td||| |S )a  Outputs the single element from the given dataset.

  Args:
    dataset: A `Tensor` of type `variant`.
      A handle to a dataset that contains a single element.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A list of `Tensor` objects of type `output_types`.
  DatasetToSingleElementr   r   r   Nr   TExpected list for 'output_types' argument to 'dataset_to_single_element' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z-dataset_to_single_element.<locals>.<listcomp>UExpected list for 'output_shapes' argument to 'dataset_to_single_element' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   )r   r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   (dataset_to_single_element_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r   r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   dataset_to_single_elementx  st   


r   zraw_ops.DatasetToSingleElementc           	      C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}t| tj	} | g}d|d	|d|f}tj
d
t|||||d}t r_td||| |S )Nr   c                 S   r   r   r   r   r    r    r!   r"     r#   z<dataset_to_single_element_eager_fallback.<locals>.<listcomp>r   c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   r   r   s   DatasetToSingleElementrL   r   )r4   r5   r6   r7   r   rn   r/   r   r   r   r   lenr:   r=   )	r   r   r   r   r   r   rG   rF   rA   r    r    r!   r     s>   r   c           
   
   C      t j pt  }|j}|jrPzt|d|| |}|W S  tjy2 } zt	|| W Y d}~nd}~w tj
y;   Y nw z	t| |||dW S  tjyO   Y nw tjd| ||d\}}}}	|S )a  A container for an iterator resource.

  Args:
    handle: A `Tensor` of type `resource`. A handle to the iterator to delete.
    deleter: A `Tensor` of type `variant`. A variant deleter.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  DeleteIteratorNra   rR   rS   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   delete_iterator_eager_fallbackr3   r8   r9   
rR   rS   r   r?   r@   rA   rB   rC   rD   rE   r    r    r!   delete_iterator  2   
r   zraw_ops.DeleteIteratorc                 C   F   t | tj} t |tj}| |g}d }tjdd||||d}d }|S )Ns   DeleteIteratorr   rL   r/   r   r   r   r   r   r   rR   rS   r   r   rG   rF   rA   r    r    r!   r        
r   c           
   
   C   r   )TODO: add doc.

  Args:
    handle: A `Tensor` of type `resource`.
    deleter: A `Tensor` of type `variant`.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  DeleteMemoryCacheNra   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   "delete_memory_cache_eager_fallbackr3   r8   r9   r   r    r    r!   delete_memory_cache  r   r   zraw_ops.DeleteMemoryCachec                 C   r   )Ns   DeleteMemoryCacher   rL   r   r   r    r    r!   r   #  r   r   multi_device_iterator	iteratorsc              
   C   s   t j pt  }|j}|jrRzt|d|| ||}|W S  tjy3 } zt	|| W Y d}~nd}~w tj
y<   Y nw z
t| ||||dW S  tjyQ   Y nw t|ttfs_td| t|}tjd| |||d\}	}	}
}|
S )a@  A container for an iterator resource.

  Args:
    multi_device_iterator: A `Tensor` of type `resource`.
      A handle to the multi device iterator to delete.
    iterators: A list of `Tensor` objects with type `resource`.
      A list of iterator handles (unused). This is added so that automatic control dependencies get added during function tracing that ensure this op runs after all the dependent iterators are deleted.
    deleter: A `Tensor` of type `variant`. A variant deleter.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  DeleteMultiDeviceIteratorNra   TExpected list for 'iterators' argument to 'delete_multi_device_iterator' Op, not %r.)r   r   rS   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   +delete_multi_device_iterator_eager_fallbackr3   r4   r5   r6   r7   r   r8   r9   )r   r   rS   r   r?   r@   rA   rB   _attr_NrC   rD   rE   r    r    r!   delete_multi_device_iterator.  sF   
r   z!raw_ops.DeleteMultiDeviceIteratorc           	      C   s   t |ttfstd| t|}t| tj} t	|tj}t|tj
}| gt| |g }d|f}tjdd||||d}d }|S )Nr   Ns   DeleteMultiDeviceIteratorr   rL   )r4   r5   r6   r7   r   r/   r   r   r   convert_n_to_tensorr   r   r   )	r   r   rS   r   r   r   rG   rF   rA   r    r    r!   r   [  s$   r   c           
   
   C   r   )r   DeleteRandomSeedGeneratorNra   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   +delete_random_seed_generator_eager_fallbackr3   r8   r9   r   r    r    r!   delete_random_seed_generatorm  s4   
r   z!raw_ops.DeleteRandomSeedGeneratorc                 C   r   )Ns   DeleteRandomSeedGeneratorr   rL   r   r   r    r    r!   r     s   r   c           
   
   C   r   )r   DeleteSeedGeneratorNra   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   $delete_seed_generator_eager_fallbackr3   r8   r9   r   r    r    r!   delete_seed_generator  r   r   zraw_ops.DeleteSeedGeneratorc                 C   r   )Ns   DeleteSeedGeneratorr   rL   r   r   r    r    r!   r     r   r   resource_handle
serializedc           
   
   C   r   )a  Converts the given variant tensor to an iterator and stores it in the given resource.

  Args:
    resource_handle: A `Tensor` of type `resource`.
      A handle to an iterator resource.
    serialized: A `Tensor` of type `variant`.
      A variant tensor storing the state of the iterator contained in the
      resource.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  DeserializeIteratorNra   )r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   #deserialize_iterator_eager_fallbackr3   r8   r9   )
r   r   r   r?   r@   rA   rB   rC   rD   rE   r    r    r!   deserialize_iterator  s4   
r   zraw_ops.DeserializeIteratorc                 C   r   )Ns   DeserializeIteratorr   rL   r   )r   r   r   r   rG   rF   rA   r    r    r!   r     r   r   c           
   
   C      t j pt  }|j}|jrLz
t|d| }|W S  tjy0 } zt	||  W Y d}~nd}~w tj
y9   Y nw zt| |dW S  tjyK   Y nw tjd| d\}}}}|dd }t rnd}|j}	td|	|| |\}|S )xTODO: add doc.

  Args:
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `resource`.
  DummyMemoryCacheNra   rb   r    )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   !dummy_memory_cache_eager_fallbackr3   r8   r9   r   r:   r<   r=   re   r    r    r!   dummy_memory_cache  B   	r  zraw_ops.DummyMemoryCachec                 C   @   g }d }t jdd|||| d}t  rt d||| |\}|S )Ns   DummyMemoryCacherK   rL   r  r   r   r:   r=   rg   r    r    r!   r  "     
r  c           
   
   C   r   )r   DummySeedGeneratorNra   rb   r    )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   #dummy_seed_generator_eager_fallbackr3   r8   r9   r   r:   r<   r=   re   r    r    r!   dummy_seed_generator.  r  r
  zraw_ops.DummySeedGeneratorc                 C   r  )Ns   DummySeedGeneratorrK   rL   r  r  rg   r    r    r!   r	  V  r  r	  c              
   C   `  t j pt  }|j}|jrTzt|d|| d|d|}|W S  tjy5 } zt	|| W Y d}~nd}~w tj
y>   Y nw z
t| ||||dW S  tjyS   Y nw t|ttfsatd| dd |D }t|ttfsutd	| d
d |D }tjd| |||d\}}}	}
|
dd }t rd|	dd|	df}|	j}td||| |\}|S )a  Creates a dataset containing elements of first component of `input_dataset` having true in the last component.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  FilterByLastComponentDatasetr   r   Nr   [Expected list for 'output_types' argument to 'filter_by_last_component_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z4filter_by_last_component_dataset.<locals>.<listcomp>\Expected list for 'output_shapes' argument to 'filter_by_last_component_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   )r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   /filter_by_last_component_dataset_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   )r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!    filter_by_last_component_datasetb  sl   r  z$raw_ops.FilterByLastComponentDatasetc                 C      t |ttfstd| dd |D }t |ttfs!td| dd |D }t| tj} | g}d|d|f}tj	dd	||||d
}t
 rOtd||| |\}|S )Nr  c                 S   r   r   r   r   r    r    r!   r"     r#   zCfilter_by_last_component_dataset_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   s   FilterByLastComponentDatasetrK   rL   r  )r4   r5   r6   r7   r/   r   r   r   r   r   r:   r=   )r   r   r   r   r   rG   rF   rA   r    r    r!   r    6   r  c                 C     t j pt  }|j}|jr\zt|d|| |d|d|d|d|}	|	W S  tjy: }
 zt	|
| W Y d}
~
nd}
~
w tj
yC   Y nw zt| |||||||dW S  tjy[   Y nw t|ttfsitd| d	d
 |D }t|ttfs}td| dd
 |D }|du rd}t|d}tjd| ||||||d\}}}}|dd }	t rd|dd|dd|dd|dd|df
}|j}td|||	 |	\}	|	S )a  Creates a dataset containing elements of `input_dataset` matching `predicate`.

  The `predicate` function must return a scalar boolean and accept the
  following arguments:

  * One tensor for each component of an element of `input_dataset`.
  * One tensor for each value in `other_arguments`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    other_arguments: A list of `Tensor` objects.
      A list of tensors, typically values that were captured when
      building a closure for `predicate`.
    predicate: A function decorated with @Defun.
      A function returning a scalar boolean.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  FilterDataset	predicater   r   r   N)r  r   r   r   r   r   IExpected list for 'output_types' argument to 'filter_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z"filter_dataset.<locals>.<listcomp>JExpected list for 'output_shapes' argument to 'filter_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   )r   other_argumentsr  r   r   r   r   
Targuments)r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   filter_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r   r  r  r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   filter_dataset  s~   




r  zraw_ops.FilterDatasetc              
   C      t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}t||\}}t| t	j
} | gt| }	d|d	|d
|d|d|f
}
tjdd|	|
||d}t rmtd|	|
| |\}|S )Nr  c                 S   r   r   r   r   r    r    r!   r"   
  r#   z1filter_dataset_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   r  r  r   r   s   FilterDatasetrK   rL   r  r4   r5   r6   r7   r   rn   convert_to_mixed_eager_tensorsr/   r   r   r   r   r:   r=   )r   r  r  r   r   r   r   r   _attr_TargumentsrG   rF   rA   r    r    r!   r    sB   

r  has_captured_refc                 C   s  t j pt  }|j}|jrWzt|d|| d|d|d|
}|W S  tjy7 } zt	|| W Y d}~nd}~w tj
y@   Y nw zt| |||||dW S  tjyV   Y nw t|ttfsdtd| dd	 |D }t|ttfsxtd
| dd	 |D }|du rd}t|d}tjd| ||||d\}	}	}
}|dd }t rd|
dd|
dd|
df}|
j}td||| |\}|S )a  Creates a dataset by applying `tf.data.Options` to `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
      A variant tensor representing the input dataset.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    has_captured_ref: An optional `bool`. Defaults to `False`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  FinalizeDatasetr   r   r   N)r   r   r   r   r   KExpected list for 'output_types' argument to 'finalize_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   I  r#   z$finalize_dataset.<locals>.<listcomp>LExpected list for 'output_shapes' argument to 'finalize_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   N  r#   F)r   r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   finalize_dataset_eager_fallbackr3   r4   r5   r6   r7   r   r   r8   r9   r:   r   r;   r<   r=   )r   r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   finalize_dataset"  sx   

r%  zraw_ops.FinalizeDatasetc           	      C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}t| tj	} | g}d|d|d	|f}tj
d
d||||d}t r]td||| |\}|S )Nr"  c                 S   r   r   r   r   r    r    r!   r"   j  r#   z3finalize_dataset_eager_fallback.<locals>.<listcomp>r#  c                 S   r   r%   r&   r'   r    r    r!   r"   o  r#   Fr   r   r   s   FinalizeDatasetrK   rL   r!  r   )	r   r   r   r   r   r   rG   rF   rA   r    r    r!   r$  e  s>   
r$  	filenamesheader_bytesrecord_bytesfooter_bytesbuffer_sizec                 C   s.  t j pt  }|j}|jrYzt|d|| ||||d|
}	|	W S  tjy7 }
 zt	|
| W Y d}
~
nd}
~
w tj
y@   Y nw zt| |||||||dW S  tjyX   Y nw |du r_d}t|d}tjd| ||||||d\}}}}|dd }	t rd|df}|j}td|||	 |	\}	|	S )aR  Creates a dataset that emits the records from one or more binary files.

  Args:
    filenames: A `Tensor` of type `string`.
      A scalar or a vector containing the name(s) of the file(s) to be
      read.
    header_bytes: A `Tensor` of type `int64`.
      A scalar representing the number of bytes to skip at the
      beginning of a file.
    record_bytes: A `Tensor` of type `int64`.
      A scalar representing the number of bytes in each record.
    footer_bytes: A `Tensor` of type `int64`.
      A scalar representing the number of bytes to skip at the end
      of a file.
    buffer_size: A `Tensor` of type `int64`.
      A scalar representing the number of bytes to buffer. Must be > 0.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  FixedLengthRecordDatasetr   Nr   r   r   r   )r&  r'  r(  r)  r*  r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   *fixed_length_record_dataset_eager_fallbackr3   r   rn   r8   r9   r:   r;   r<   r=   )r&  r'  r(  r)  r*  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   fixed_length_record_dataset  sV   


r.  z raw_ops.FixedLengthRecordDatasetc                 C   s   |d u rd}t |d}t| tj} t|tj}t|tj}t|tj}t|tj}| ||||g}d|f}	t jdd||	||d}
t  rQt 	d||	|
 |
\}
|
S )Nr   r   s   FixedLengthRecordDatasetrK   rL   r+  
r   rn   r/   r   r   r   r   r   r:   r=   )r&  r'  r(  r)  r*  r   r   r   rG   rF   rA   r    r    r!   r-    s(   r-  compression_typec                 C   s4  t j pt  }|j}	|	jr[zt|d|| |||||d|}
|
W S  tjy8 } zt	|| W Y d}~nd}~w tj
yA   Y nw zt| ||||||||d	W S  tjyZ   Y nw |du rad}t|d}tjd| |||||||d	\}}}}|dd }
t rd|df}|j}td|||
 |
\}
|
S )a  TODO: add doc.

  Args:
    filenames: A `Tensor` of type `string`.
    header_bytes: A `Tensor` of type `int64`.
    record_bytes: A `Tensor` of type `int64`.
    footer_bytes: A `Tensor` of type `int64`.
    buffer_size: A `Tensor` of type `int64`.
    compression_type: A `Tensor` of type `string`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  FixedLengthRecordDatasetV2r   Nr,  r   )r&  r'  r(  r)  r*  r0  r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   -fixed_length_record_dataset_v2_eager_fallbackr3   r   rn   r8   r9   r:   r;   r<   r=   )r&  r'  r(  r)  r*  r0  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   fixed_length_record_dataset_v2  sZ   


r3  z"raw_ops.FixedLengthRecordDatasetV2c	                 C   s   |d u rd}t |d}t| tj} t|tj}t|tj}t|tj}t|tj}t|tj}| |||||g}	d|f}
t jdd|	|
||d}t  rYt 	d|	|
| |\}|S )Nr   r   s   FixedLengthRecordDatasetV2rK   rL   r1  r/  )r&  r'  r(  r)  r*  r0  r   r   r   rG   rF   rA   r    r    r!   r2  	  s*   r2  c                 C   r  )a~  Creates a dataset that applies `f` to the outputs of `input_dataset`.

  Unlike MapDataset, the `f` in FlatMapDataset is expected to return a
  Dataset variant, and FlatMapDataset will flatten successive results
  into a single Dataset.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    other_arguments: A list of `Tensor` objects.
    f: A function decorated with @Defun.
      A function mapping elements of `input_dataset`, concatenated with
      `other_arguments`, to a Dataset variant that contains elements matching
      `output_types` and `output_shapes`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  FlatMapDatasetfr   r   r   Nr5  r   r   r   r   r   KExpected list for 'output_types' argument to 'flat_map_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   T	  r#   z$flat_map_dataset.<locals>.<listcomp>LExpected list for 'output_shapes' argument to 'flat_map_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   Y	  r#   r   )r   r  r5  r   r   r   r   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   flat_map_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r   r  r5  r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   flat_map_dataset&	  s|   


r:  zraw_ops.FlatMapDatasetc              
   C   r  )Nr7  c                 S   r   r   r   r   r    r    r!   r"   x	  r#   z3flat_map_dataset_eager_fallback.<locals>.<listcomp>r8  c                 S   r   r%   r&   r'   r    r    r!   r"   }	  r#   r   r   r5  r  r   r   s   FlatMapDatasetrK   rL   r4  r  )r   r  r5  r   r   r   r   r   r  rG   rF   rA   r    r    r!   r9  s	  s@   


r9  c
                 C   s  t j pt  }
|
j}|jrdzt|
d|	| ||d|d|d|d|d|d|}|W S  tjy? } zt	||	 W Y d}~nd}~w tj
yH   Y nw zt| |||||||||	|
d	W S  tjyc   Y nw t|ttfsqtd
| dd |D }t|ttfstd| dd |D }|du rd}t|d}tjd| |||||||||	d\}}}}|dd }t rd|dd|dd|dd|dd|dd|dd|dd|dd|df}|j}td||| |\}|S )a  Creates a dataset that invokes a function to generate elements.

  Args:
    init_func_other_args: A list of `Tensor` objects.
    next_func_other_args: A list of `Tensor` objects.
    finalize_func_other_args: A list of `Tensor` objects.
    init_func: A function decorated with @Defun.
    next_func: A function decorated with @Defun.
    finalize_func: A function decorated with @Defun.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  GeneratorDataset	init_func	next_funcfinalize_funcr   r   r   N)r<  r=  r>  r   r   r   r   r   LExpected list for 'output_types' argument to 'generator_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   	  r#   z%generator_dataset.<locals>.<listcomp>MExpected list for 'output_shapes' argument to 'generator_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   	  r#   r   )
init_func_other_argsnext_func_other_argsfinalize_func_other_argsr<  r=  r>  r   r   r   r   Tinit_func_argsTnext_func_argsTfinalize_func_args)r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1    generator_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )rA  rB  rC  r<  r=  r>  r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   generator_dataset	  s   
	






	rH  zraw_ops.GeneratorDatasetc                 C   s  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}t| |
\}} t||
\}}t||
\}}t| t| t| }d|d	|d
|d|d|d|d|d|d|f}tjdd|||
|	d}t rt	d||| |\}|S )Nr?  c                 S   r   r   r   r   r    r    r!   r"   	  r#   z4generator_dataset_eager_fallback.<locals>.<listcomp>r@  c                 S   r   r%   r&   r'   r    r    r!   r"   	  r#   r   r   r<  r=  r>  rD  rE  rF  r   r   s   GeneratorDatasetrK   rL   r;  
r4   r5   r6   r7   r   rn   r  r   r:   r=   )rA  rB  rC  r<  r=  r>  r   r   r   r   r   Z_attr_Tinit_func_argsZ_attr_Tnext_func_argsZ_attr_Tfinalize_func_argsrG   rF   rA   r    r    r!   rG  	  sH   


rG  c              
   C      t j pt  }|j}|jrNzt|d|| }|W S  tjy1 } zt	|| W Y d}~nd}~w tj
y:   Y nw zt| ||dW S  tjyM   Y nw tjd| |d\}}}}|dd }t rqd}	|j}
td|
|	| |\}|S )a
  Returns the `tf.data.Options` attached to `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
      A variant tensor representing the input dataset.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `string`.
  
GetOptionsNra   )r   r   r    )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   get_options_eager_fallbackr3   r8   r9   r   r:   r<   r=   )r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   get_options
  B   rM  zraw_ops.GetOptionsc                 C   P   t | tj} | g}d }tjdd||||d}t r#td||| |\}|S )Ns
   GetOptionsrK   rL   rK  r/   r   r   r   r   r   r:   r=   )r   r   r   rG   rF   rA   r    r    r!   rL  -
     
rL  cycle_lengthblock_lengthc	                 C   s  t j pt  }	|	j}
|
jr`zt|	d|| |||d|d|d|d|}|W S  tjy< } zt	|| W Y d}~nd}~w tj
yE   Y nw zt| |||||||||	d
W S  tjy_   Y nw t|ttfsmtd| d	d
 |D }t|ttfstd| dd
 |D }|du rd}t|d}tjd| ||||||||d
\}}}}|dd }t rd|dd|dd|dd|dd|df
}|j}td||| |\}|S )ax  Creates a dataset that applies `f` to the outputs of `input_dataset`.

  Unlike MapDataset, the `f` in InterleaveDataset is expected to return
  a Dataset variant, and InterleaveDataset will flatten successive
  results into a single Dataset. Unlike FlatMapDataset,
  InterleaveDataset will interleave sequences of up to `block_length`
  consecutive elements from `cycle_length` input elements.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    other_arguments: A list of `Tensor` objects.
    cycle_length: A `Tensor` of type `int64`.
    block_length: A `Tensor` of type `int64`.
    f: A function decorated with @Defun.
      A function mapping elements of `input_dataset`, concatenated with
      `other_arguments`, to a Dataset variant that contains elements matching
      `output_types` and `output_shapes`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  InterleaveDatasetr5  r   r   r   Nr6  MExpected list for 'output_types' argument to 'interleave_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   m
  r#   z&interleave_dataset.<locals>.<listcomp>NExpected list for 'output_shapes' argument to 'interleave_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   r
  r#   r   )	r   r  rR  rS  r5  r   r   r   r   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   !interleave_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r   r  rR  rS  r5  r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   interleave_dataset:
  s   




rX  zraw_ops.InterleaveDatasetc
              
   C   s  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}t||	\}
}t| t	j
} t|t	j}t|t	j}| gt| ||g }d|d	|
d
|d|d|f
}tjdd|||	|d}t rtd||| |\}|S )NrU  c                 S   r   r   r   r   r    r    r!   r"   
  r#   z5interleave_dataset_eager_fallback.<locals>.<listcomp>rV  c                 S   r   r%   r&   r'   r    r    r!   r"   
  r#   r   r   r5  r  r   r   s   InterleaveDatasetrK   rL   rT  r4   r5   r6   r7   r   rn   r  r/   r   r   r   r   r   r:   r=   )r   r  rR  rS  r5  r   r   r   r   r   r  rG   rF   rA   r    r    r!   rW  
  sD   


rW  shared_name	containerc                 C     t j pt  }|j}|jrXzt|d|d| d|d|d|}|W S  tjy8 } zt	|| W Y d}~nd}~w tj
yA   Y nw zt| |||||dW S  tjyW   Y nw t| d} t|d}t|ttfsqtd| d	d
 |D }t|ttfstd| dd
 |D }tjd| ||||d\}	}	}
}|dd }t rd|
dd|
dd|
dd|
df}|
j}td||| |\}|S )ao  A container for an iterator resource.

  Args:
    shared_name: A `string`.
    container: A `string`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `resource`.
  IteratorrZ  r[  r   r   NrZ  r[  r   r   r   r   CExpected list for 'output_types' argument to 'iterator' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   
  r#   ziterator.<locals>.<listcomp>DExpected list for 'output_shapes' argument to 'iterator' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   
  r#   rZ  r[  r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   iterator_eager_fallbackr3   r   rn   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   rZ  r[  r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   iterator
  v   

rd  zraw_ops.Iteratorc           	      C      t | d} t |d}t|ttfstd| dd |D }t|ttfs-td| dd |D }g }d| d|d|d	|f}t jd
d||||d}t  rWt d||| |\}|S )NrZ  r[  r_  c                 S   r   r   r   r   r    r    r!   r"   
  r#   z+iterator_eager_fallback.<locals>.<listcomp>r`  c                 S   r   r%   r&   r'   r    r    r!   r"   
  r#   r   r   s   IteratorrK   rL   r]  	r   rn   r4   r5   r6   r7   r   r:   r=   	rZ  r[  r   r   r   r   rG   rF   rA   r    r    r!   rb  
  :   
rb  string_handlec              
   C   x  t j pt  }|j}|jrTzt|d|| d|d|}|W S  tjy5 } zt	|| W Y d}~nd}~w tj
y>   Y nw z
t| ||||dW S  tjyS   Y nw |du rZg }t|ttfsgtd| dd |D }|du rtg }t|ttfstd	| d
d |D }tjd| |||d\}}}	}
|
dd }t rd|	dd|	df}|	j}td||| |\}|S )a  Converts the given string representing a handle to an iterator to a resource.

  Args:
    string_handle: A `Tensor` of type `string`.
      A string representation of the given handle.
    output_types: An optional list of `tf.DTypes`. Defaults to `[]`.
      If specified, defines the type of each tuple component in an
      element produced by the resulting iterator.
    output_shapes: An optional list of shapes (each a `tf.TensorShape` or list of `ints`). Defaults to `[]`.
      If specified, defines the shape of each tuple component in an
      element produced by the resulting iterator.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `resource`.
  IteratorFromStringHandler   r   Nr   VExpected list for 'output_types' argument to 'iterator_from_string_handle' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   0  r#   z/iterator_from_string_handle.<locals>.<listcomp>WExpected list for 'output_shapes' argument to 'iterator_from_string_handle' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   7  r#   rj  r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   *iterator_from_string_handle_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   rj  r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   iterator_from_string_handle  sr   
rr  z raw_ops.IteratorFromStringHandlec                 C      |d u rg }t |ttfstd| dd |D }|d u r g }t |ttfs-td| dd |D }t| tj} | g}d|d|f}tj	dd	||||d
}t
 r[td||| |\}|S )Nrm  c                 S   r   r   r   r   r    r    r!   r"   P  r#   z>iterator_from_string_handle_eager_fallback.<locals>.<listcomp>rn  c                 S   r   r%   r&   r'   r    r    r!   r"   W  r#   r   r   s   IteratorFromStringHandlerK   rL   rl  r4   r5   r6   r7   r/   r   r   r   r   r   r:   r=   rj  r   r   r   r   rG   rF   rA   r    r    r!   rp  I  >   rp  c              
   C   rk  )aZ  TODO: add doc.

  Args:
    string_handle: A `Tensor` of type `string`.
    output_types: An optional list of `tf.DTypes`. Defaults to `[]`.
    output_shapes: An optional list of shapes (each a `tf.TensorShape` or list of `ints`). Defaults to `[]`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `resource`.
  IteratorFromStringHandleV2r   r   Nr   YExpected list for 'output_types' argument to 'iterator_from_string_handle_v2' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z2iterator_from_string_handle_v2.<locals>.<listcomp>ZExpected list for 'output_shapes' argument to 'iterator_from_string_handle_v2' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   ro  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   -iterator_from_string_handle_v2_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   rq  r    r    r!   iterator_from_string_handle_v2e  sr   r{  z"raw_ops.IteratorFromStringHandleV2c                 C   rs  )Nrx  c                 S   r   r   r   r   r    r    r!   r"     r#   zAiterator_from_string_handle_v2_eager_fallback.<locals>.<listcomp>ry  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   s   IteratorFromStringHandleV2rK   rL   rw  rt  ru  r    r    r!   rz    rv  rz  c              
   C   b  t j pt  }|j}|jrTzt|d|| d|d|}|W S  tjy5 } zt	|| W Y d}~nd}~w tj
y>   Y nw z
t| ||||dW S  tjyS   Y nw t|ttfsatd| dd |D }t|ttfsutd	| d
d |D }tjd| |||d\}}}	}
|
dd }|s|	S t rd|	dd|	df}|	j}td||| |S )a  Gets the next output from the given iterator .

  Args:
    iterator: A `Tensor` of type `resource`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    name: A name for the operation (optional).

  Returns:
    A list of `Tensor` objects of type `output_types`.
  IteratorGetNextr   r   Nr   LExpected list for 'output_types' argument to 'iterator_get_next' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z%iterator_get_next.<locals>.<listcomp>MExpected list for 'output_shapes' argument to 'iterator_get_next' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   rd  r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1    iterator_get_next_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   rd  r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   iterator_get_next  sj   r  zraw_ops.IteratorGetNextc                 C      t |ttfstd| dd |D }t |ttfs!td| dd |D }t| tj} | g}d|d|f}tj	dt
|||||d	}t rQtd
||| |S )Nr~  c                 S   r   r   r   r   r    r    r!   r"     r#   z4iterator_get_next_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   s   IteratorGetNextrL   r}  r4   r5   r6   r7   r/   r   r   r   r   r   r   r:   r=   rd  r   r   r   r   rG   rF   rA   r    r    r!   r    4   r  c              
   C   r  )a  Gets the next output from the given iterator as an Optional variant.

  Args:
    iterator: A `Tensor` of type `resource`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  IteratorGetNextAsOptionalr   r   Nr   XExpected list for 'output_types' argument to 'iterator_get_next_as_optional' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   3  r#   z1iterator_get_next_as_optional.<locals>.<listcomp>YExpected list for 'output_shapes' argument to 'iterator_get_next_as_optional' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   8  r#   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   ,iterator_get_next_as_optional_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   r  r    r    r!   iterator_get_next_as_optional  sj   
r  z!raw_ops.IteratorGetNextAsOptionalc                 C   r  )Nr  c                 S   r   r   r   r   r    r    r!   r"   O  r#   z@iterator_get_next_as_optional_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"   T  r#   r   r   s   IteratorGetNextAsOptionalrK   rL   r  )r4   r5   r6   r7   r/   r   r   r   r   r   r:   r=   r  r    r    r!   r  J  r  r  c              
   C   r|  )a  Gets the next output from the given iterator.

  This operation is a synchronous version IteratorGetNext. It should only be used
  in situations where the iterator does not block the calling thread, or where
  the calling thread is not a member of the thread pool used to execute parallel
  operations (e.g. in eager mode).

  Args:
    iterator: A `Tensor` of type `resource`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    name: A name for the operation (optional).

  Returns:
    A list of `Tensor` objects of type `output_types`.
  IteratorGetNextSyncr   r   Nr   QExpected list for 'output_types' argument to 'iterator_get_next_sync' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z*iterator_get_next_sync.<locals>.<listcomp>RExpected list for 'output_shapes' argument to 'iterator_get_next_sync' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   %iterator_get_next_sync_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   r  r    r    r!   iterator_get_next_syncb  sj   
r  zraw_ops.IteratorGetNextSyncc                 C   r  )Nr  c                 S   r   r   r   r   r    r    r!   r"     r#   z9iterator_get_next_sync_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   s   IteratorGetNextSyncrL   r  r  r  r    r    r!   r    r  r  c              
   C   rJ  )a  Converts the given `resource_handle` representing an iterator to a string.

  Args:
    resource_handle: A `Tensor` of type `resource`.
      A handle to an iterator resource.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `string`.
  IteratorToStringHandleNra   )r   r   r    )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   (iterator_to_string_handle_eager_fallbackr3   r8   r9   r   r:   r<   r=   )r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   iterator_to_string_handle  rN  r  zraw_ops.IteratorToStringHandlec                 C   rO  )Ns   IteratorToStringHandlerK   rL   r  r/   r   r   r   r   r   r:   r=   )r   r   r   rG   rF   rA   r    r    r!   r       r  c                 C   r\  )aX  TODO: add doc.

  Args:
    shared_name: A `string`.
    container: A `string`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `resource`.
  
IteratorV2rZ  r[  r   r   Nr^  FExpected list for 'output_types' argument to 'iterator_v2' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   ziterator_v2.<locals>.<listcomp>GExpected list for 'output_shapes' argument to 'iterator_v2' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   ra  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   iterator_v2_eager_fallbackr3   r   rn   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   rc  r    r    r!   iterator_v2  re  r  zraw_ops.IteratorV2c           	      C   rf  )NrZ  r[  r  c                 S   r   r   r   r   r    r    r!   r"   8  r#   z.iterator_v2_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"   =  r#   r   r   s
   IteratorV2rK   rL   r  rg  rh  r    r    r!   r  1  ri  r  c           
   
   C   r   )a  Makes a new iterator from the given `dataset` and stores it in `iterator`.

  This operation may be executed multiple times. Each execution will reset the
  iterator in `iterator` to the first element of `dataset`.

  Args:
    dataset: A `Tensor` of type `variant`.
    iterator: A `Tensor` of type `resource`.
    name: A name for the operation (optional).

  Returns:
    The created Operation.
  MakeIteratorNra   )r   rd  r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   make_iterator_eager_fallbackr3   r8   r9   )
r   rd  r   r?   r@   rA   rB   rC   rD   rE   r    r    r!   make_iteratorJ  s2   
r  zraw_ops.MakeIteratorc                 C   r   )Ns   MakeIteratorr   rL   )r/   r   r   r   r   r   r   )r   rd  r   r   rG   rF   rA   r    r    r!   r  o  r   r  Tuse_inter_op_parallelismpreserve_cardinalityc	                 C   s   t j pt  }	|	j}
|
jrbzt|	d|| |d|d|d|d|d|d|}|W S  tjy> } zt	|| W Y d}~nd}~w tj
yG   Y nw zt| |||||||||	d	
W S  tjya   Y nw t|ttfsotd
| dd |D }t|ttfstd| dd |D }|du rd}t|d}|du rd}t|d}|du rd}t|d}tjd| ||||||||d
\}}}}|dd }t rd|dd|dd|dd|dd|dd|dd|df}|j}td||| |\}|S )a  Creates a dataset that applies `f` to the outputs of `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    other_arguments: A list of `Tensor` objects.
    f: A function decorated with @Defun.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    use_inter_op_parallelism: An optional `bool`. Defaults to `True`.
    preserve_cardinality: An optional `bool`. Defaults to `False`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  
MapDatasetr5  r   r   r  r  r   N)r5  r   r   r  r  r   r   r   FExpected list for 'output_types' argument to 'map_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   zmap_dataset.<locals>.<listcomp>GExpected list for 'output_shapes' argument to 'map_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   TFr   )	r   r  r5  r   r   r  r  r   r   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   map_dataset_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r;   r   r<   r=   )r   r  r5  r   r   r  r  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   map_datasetz  s   



r  zraw_ops.MapDatasetc
                 C   s  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d	}|d u rFd
}t|d}t||	\}
}t	| t
j} | gt| }d|d|
d|d|d|d	|d|f}tjdd|||	|d}t rtd||| |\}|S )Nr  c                 S   r   r   r   r   r    r    r!   r"     r#   z.map_dataset_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   Tr  Fr  r   r   r5  r  r   r   s
   MapDatasetrK   rL   r  )r4   r5   r6   r7   r   r   rn   r  r/   r   r   r   r   r:   r=   )r   r  r5  r   r   r  r  r   r   r   r  rG   rF   rA   r    r    r!   r    sP   

r  rK   max_intra_op_parallelismc                 C   s  t j pt  }|j}|jr\zt|d|| |d|d|d|d|}	|	W S  tjy: }
 zt	|
| W Y d}
~
nd}
~
w tj
yC   Y nw zt| |||||||dW S  tjy[   Y nw t|ttfsitd| d	d
 |D }t|ttfs}td| dd
 |D }|du rd}t|d}tjd| ||||||d\}}}}|dd }	t rd|dd|dd|dd|dd|dd|df}|j}td|||	 |	S )a    Maps a function on the list of tensors unpacked from arguments on dimension 0.
  The function given by `f` is assumed to be stateless, and is executed
  concurrently on all the slices; up to batch_size (i.e. the size of the 0th
  dimension of each argument) functions will be scheduled at once.

  The `max_intra_op_parallelism` attr, which defaults to 1, can be used to
  limit the intra op parallelism. To limit inter-op parallelism, a user can
  set a private threadpool on the dataset using `tf.data.Options`'s
  `ThreadingOptions`.

  Note that this op is not exposed to users directly, but is invoked in tf.data
  rewrites.

  Args:
    arguments: A list of `Tensor` objects.
          A list of tensors whose types are `Targuments`, corresponding to the inputs
          the function should be mapped over.
    captured_inputs: A list of `Tensor` objects.
          A list of tensors whose types are `Tcaptured`, corresponding to the captured
          inputs of the defun.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
      A list of types.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
      A list of shapes.
    f: A function decorated with @Defun.
    max_intra_op_parallelism: An optional `int`. Defaults to `1`.
    name: A name for the operation (optional).

  Returns:
    A list of `Tensor` objects of type `output_types`.
  MapDefunr   r   r5  r  N)r   r   r5  r  r   r   DExpected list for 'output_types' argument to 'map_defun' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   .  r#   zmap_defun.<locals>.<listcomp>EExpected list for 'output_shapes' argument to 'map_defun' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   3  r#   rK   )	argumentscaptured_inputsr   r   r5  r  r   r  	Tcaptured)r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   map_defun_eager_fallbackr3   r4   r5   r6   r7   r   r   r8   r9   r:   r;   r   r<   r=   )r  r  r   r   r5  r  r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   	map_defun  s~    


r  zraw_ops.MapDefunc                 C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}t| |\}} t||\}	}t| t| }
d|d	|	d
|d|d|d|f}tjdt||
|||d}t	 rst
d|
|| |S )Nr  c                 S   r   r   r   r   r    r    r!   r"   Q  r#   z,map_defun_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"   V  r#   rK   r  r  r  r   r   r5  s   MapDefunrL   r  )r4   r5   r6   r7   r   r   r  r   r   r:   r=   )r  r  r   r   r5  r  r   r   r  Z_attr_TcapturedrG   rF   rA   r    r    r!   r  L  sB   r  	algorithm
cpu_budget
ram_budgetc                 C   s  t j pt  }|j}|jr]zt|d|| d|d|d|d|d|}	|	W S  tjy; }
 zt	|
| W Y d}
~
nd}
~
w tj
yD   Y nw zt| |||||||dW S  tjy\   Y nw t|ttfsjtd	| d
d |D }t|ttfs~td| dd |D }|du rd}t|d}|du rd}t|d}|du rd}t|d}tjd| ||||||d\}}}}|dd }	t rd|dd|dd|dd|dd|df
}|j}td|||	 |	\}	|	S )ax  Identity transformation that models performance.

  Identity transformation that models performance.

  Args:
    input_dataset: A `Tensor` of type `variant`.
      A variant tensor representing the input dataset.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    algorithm: An optional `int`. Defaults to `0`.
    cpu_budget: An optional `int`. Defaults to `0`.
    ram_budget: An optional `int`. Defaults to `0`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ModelDatasetr  r  r  r   r   N)r  r  r  r   r   r   r   HExpected list for 'output_types' argument to 'model_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z!model_dataset.<locals>.<listcomp>IExpected list for 'output_shapes' argument to 'model_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   )r   r   r   r  r  r  r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   model_dataset_eager_fallbackr3   r4   r5   r6   r7   r   r   r8   r9   r:   r   r;   r<   r=   )r   r   r   r  r  r  r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   model_dataseti  s   



r  zraw_ops.ModelDatasetc              
   C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d}|d u rFd}t|d	}t| tj	} | g}d|d|d	|d
|d|f
}	tj
dd||	||d}
t rytd||	|
 |
\}
|
S )Nr  c                 S   r   r   r   r   r    r    r!   r"     r#   z0model_dataset_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r  r  r  r   r   s   ModelDatasetrK   rL   r  )r4   r5   r6   r7   r   r   r/   r   r   r   r   r:   r=   )r   r   r   r  r  r  r   r   rG   rF   rA   r    r    r!   r    sJ   


r  c                 C   s  t j pt  }|j}|jr[zt|d|d| d|d|d|d|}|W S  tjy: }	 zt	|	| W Y d}	~	nd}	~	w tj
yC   Y nw zt| ||||||dW S  tjyZ   Y nw t| ttfshtd	|  d
d | D } t|d}t|d}t|ttfstd| dd |D }t|ttfstd| dd |D }tjd| |||||d\}
}
}}|dd }t rd|dd|dd|dd|dd|df
}|j}td||| |\}|S )a	  Creates a MultiDeviceIterator resource.

  Args:
    devices: A list of `strings` that has length `>= 1`.
      A list of devices the iterator works across.
    shared_name: A `string`.
      If non-empty, this resource will be shared under the given name
      across multiple sessions.
    container: A `string`.
      If non-empty, this resource is placed in the given container.
      Otherwise, a default container is used.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
      The type list for the return values.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
      The list of shapes being produced.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `resource`.
  MultiDeviceIteratorri   rZ  r[  r   r   N)ri   rZ  r[  r   r   r   r   KExpected list for 'devices' argument to 'multi_device_iterator' Op, not %r.c                 S   r   rl   rm   r'   r    r    r!   r"     r#   z)multi_device_iterator.<locals>.<listcomp>PExpected list for 'output_types' argument to 'multi_device_iterator' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   QExpected list for 'output_shapes' argument to 'multi_device_iterator' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   )ri   rZ  r[  r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   $multi_device_iterator_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )ri   rZ  r[  r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   r     s   



zraw_ops.MultiDeviceIteratorc           
   
   C   s   t | ttfstd|  dd | D } t|d}t|d}t |ttfs-td| dd |D }t |ttfsAtd| d	d |D }g }d
| d|d|d|d|f
}tjdd||||d}	t rmtd|||	 |	\}	|	S )Nr  c                 S   r   rl   rm   r'   r    r    r!   r"   .  r#   z8multi_device_iterator_eager_fallback.<locals>.<listcomp>rZ  r[  r  c                 S   r   r   r   r   r    r    r!   r"   5  r#   r  c                 S   r   r%   r&   r'   r    r    r!   r"   :  r#   ri   r   r   s   MultiDeviceIteratorrK   rL   r  	r4   r5   r6   r7   r   rn   r   r:   r=   )
ri   rZ  r[  r   r   r   r   rG   rF   rA   r    r    r!   r  )  sH   


r  c              
   C   rk  )a  Generates a MultiDeviceIterator resource from its provided string handle.

  Args:
    string_handle: A `Tensor` of type `string`.
      String representing the resource.
    output_types: An optional list of `tf.DTypes`. Defaults to `[]`.
      The type list for the return values.
    output_shapes: An optional list of shapes (each a `tf.TensorShape` or list of `ints`). Defaults to `[]`.
      The list of shapes being produced.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `resource`.
  #MultiDeviceIteratorFromStringHandler   r   Nr   cExpected list for 'output_types' argument to 'multi_device_iterator_from_string_handle' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   o  r#   z<multi_device_iterator_from_string_handle.<locals>.<listcomp>dExpected list for 'output_shapes' argument to 'multi_device_iterator_from_string_handle' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   v  r#   ro  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   7multi_device_iterator_from_string_handle_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   rq  r    r    r!   (multi_device_iterator_from_string_handleG  st   r  z+raw_ops.MultiDeviceIteratorFromStringHandlec                 C   rs  )Nr  c                 S   r   r   r   r   r    r    r!   r"     r#   zKmulti_device_iterator_from_string_handle_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   s#   MultiDeviceIteratorFromStringHandlerK   rL   r  rt  ru  r    r    r!   r    rv  r  	shard_numincarnation_idc                 C   sn  t j pt  }|j}|jrXzt|d|| ||d|d|
}|W S  tjy7 }	 zt	|	| W Y d}	~	nd}	~	w tj
y@   Y nw zt| ||||||dW S  tjyW   Y nw t|ttfsetd| dd |D }t|ttfsytd	| d
d |D }tjd| |||||d\}
}
}}|dd }|s|S t rd|dd|df}|j}td||| |S )a  Gets next element for the provided shard number.

  Args:
    multi_device_iterator: A `Tensor` of type `resource`.
      A MultiDeviceIterator resource.
    shard_num: A `Tensor` of type `int32`.
      Integer representing which shard to fetch data for.
    incarnation_id: A `Tensor` of type `int64`.
      Which incarnation of the MultiDeviceIterator is running.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
      The type list for the return values.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
      The list of shapes being produced.
    name: A name for the operation (optional).

  Returns:
    A list of `Tensor` objects of type `output_types`.
  #MultiDeviceIteratorGetNextFromShardr   r   Nr   dExpected list for 'output_types' argument to 'multi_device_iterator_get_next_from_shard' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z=multi_device_iterator_get_next_from_shard.<locals>.<listcomp>eExpected list for 'output_shapes' argument to 'multi_device_iterator_get_next_from_shard' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   )r   r  r  r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   8multi_device_iterator_get_next_from_shard_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   )r   r  r  r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   )multi_device_iterator_get_next_from_shard  sv   r  z+raw_ops.MultiDeviceIteratorGetNextFromShardc           
      C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }t| tj} t|tj}t|tj	}| ||g}d|d|f}t
jdt|||||d	}	t
 rat
d
|||	 |	S )Nr  c                 S   r   r   r   r   r    r    r!   r"     r#   zLmulti_device_iterator_get_next_from_shard_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   s#   MultiDeviceIteratorGetNextFromShardrL   r  )r4   r5   r6   r7   r/   r   r   r   int32r   r   r   r   r:   r=   )
r   r  r  r   r   r   r   rG   rF   rA   r    r    r!   r    s8   
r  max_buffer_sizec              
   C   s   t j pt  }|j}|jrRzt|d|| ||}|W S  tjy3 } zt	|| W Y d}~nd}~w tj
y<   Y nw z
t| ||||dW S  tjyQ   Y nw tjd| |||d\}}}	}
|
dd }t rwd}|	j}td||| |\}|S )a  Initializes the multi device iterator with the given dataset.

  Args:
    dataset: A `Tensor` of type `variant`. Dataset to be iterated upon.
    multi_device_iterator: A `Tensor` of type `resource`.
      A MultiDeviceIteratorResource.
    max_buffer_size: A `Tensor` of type `int64`.
      The maximum size of the host side per device buffer to keep.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `int64`.
  MultiDeviceIteratorInitNra   )r   r   r  r   r    )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   )multi_device_iterator_init_eager_fallbackr3   r8   r9   r   r:   r<   r=   )r   r   r  r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   multi_device_iterator_init  sJ   
r  zraw_ops.MultiDeviceIteratorInitc                 C   sp   t | tj} t |tj}t |tj}| ||g}d }tjdd||||d}t r3t	d||| |\}|S )Ns   MultiDeviceIteratorInitrK   rL   r  )
r/   r   r   r   r   r   r   r   r:   r=   )r   r   r  r   r   rG   rF   rA   r    r    r!   r  6  s   
r  c              
   C   rJ  )a  Produces a string handle for the given MultiDeviceIterator.

  Args:
    multi_device_iterator: A `Tensor` of type `resource`.
      A MultiDeviceIterator resource.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `string`.
  !MultiDeviceIteratorToStringHandleNra   )r   r   r    )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   5multi_device_iterator_to_string_handle_eager_fallbackr3   r8   r9   r   r:   r<   r=   )r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   &multi_device_iterator_to_string_handleF  sF   r  z)raw_ops.MultiDeviceIteratorToStringHandlec                 C   rO  )Ns!   MultiDeviceIteratorToStringHandlerK   rL   r  r  )r   r   r   rG   rF   rA   r    r    r!   r  r  r  r  c                 C   s  t j pt  }|j}|jr[zt|d|d| d|d|d|d|}|W S  tjy: }	 zt	|	| W Y d}	~	nd}	~	w tj
yC   Y nw zt| ||||||dW S  tjyZ   Y nw t|ttfshtd	| d
d |D }t|ttfs|td| dd |D }|du rd}t|d}|du rd}t|d}tjd| |||||d\}
}
}}|dd }t rd|dd|dd|dd|dd|df
}|j}td||| |\}|S )a  Makes a "one-shot" iterator that can be iterated only once.

  A one-shot iterator bundles the logic for defining the dataset and
  the state of the iterator in a single op, which allows simple input
  pipelines to be defined without an additional initialization
  ("MakeIterator") step.

  One-shot iterators have the following limitations:

  * They do not support parameterization: all logic for creating the underlying
    dataset must be bundled in the `dataset_factory` function.
  * They are not resettable. Once a one-shot iterator reaches the end of its
    underlying dataset, subsequent "IteratorGetNext" operations on that
    iterator will always produce an `OutOfRange` error.

  For greater flexibility, use "Iterator" and "MakeIterator" to define
  an iterator using an arbitrary subgraph, which may capture tensors
  (including fed values) as parameters, and which may be reset multiple
  times by rerunning "MakeIterator".

  Args:
    dataset_factory: A function decorated with @Defun.
      A function of type `() -> DT_VARIANT`, where the returned
      DT_VARIANT is a dataset.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    container: An optional `string`. Defaults to `""`.
    shared_name: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `resource`.
  OneShotIteratordataset_factoryr   r   r[  rZ  N)r  r   r   r[  rZ  r   r   LExpected list for 'output_types' argument to 'one_shot_iterator' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z%one_shot_iterator.<locals>.<listcomp>MExpected list for 'output_shapes' argument to 'one_shot_iterator' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   )r  r   r   r[  rZ  r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1    one_shot_iterator_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r  r   r   r[  rZ  r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   one_shot_iterator  s   "



r  zraw_ops.OneShotIteratorc           
   
   C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d}g }d	| d
|d|d|d|f
}tjdd||||d}	t retd|||	 |	\}	|	S )Nr  c                 S   r   r   r   r   r    r    r!   r"     r#   z4one_shot_iterator_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r[  rZ  r  r   r   s   OneShotIteratorrK   rL   r  r  )
r  r   r   r[  rZ  r   r   rG   rF   rA   r    r    r!   r    sD   

r  optimizationsc                 C   s  t j pt  }|j}|jrYzt|d|| |d|d|d|}|W S  tjy8 }	 zt	|	| W Y d}	~	nd}	~	w tj
yA   Y nw zt| ||||||dW S  tjyX   Y nw t|ttfsftd| dd	 |D }t|ttfsztd
| dd	 |D }|du rg }t|ttfstd| dd	 |D }tjd| |||||d\}
}
}}|dd }t rd|dd|dd|df}|j}td||| |\}|S )a  Creates a dataset by applying optimizations to `input_dataset`.

  Creates a dataset by applying optimizations to `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
      A variant tensor representing the input dataset.
    optimizations: A `Tensor` of type `string`.
      A `tf.string` vector `tf.Tensor` identifying optimizations to use.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    optimization_configs: An optional list of `strings`. Defaults to `[]`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  OptimizeDatasetr   r   optimization_configsNr   r   r  r   r   KExpected list for 'output_types' argument to 'optimize_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   %  r#   z$optimize_dataset.<locals>.<listcomp>LExpected list for 'output_shapes' argument to 'optimize_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   *  r#   SExpected list for 'optimization_configs' argument to 'optimize_dataset' Op, not %r.c                 S   r   r  rm   r'   r    r    r!   r"   1  r#   )r   r  r   r   r  r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   optimize_dataset_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   )r   r  r   r   r  r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   optimize_dataset  s   

r  zraw_ops.OptimizeDatasetc           
      C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.g }t |ttfs;td| dd |D }t| tj} t|tj}| |g}d|d	|d
|f}t	j
dd||||d}	t	 rst	d|||	 |	\}	|	S )Nr  c                 S   r   r   r   r   r    r    r!   r"   L  r#   z3optimize_dataset_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"   Q  r#   r  c                 S   r   r  rm   r'   r    r    r!   r"   X  r#   r   r   r  s   OptimizeDatasetrK   rL   r  r4   r5   r6   r7   r/   r   r   r   r   r   r   r:   r=   )
r   r  r   r   r  r   r   rG   rF   rA   r    r    r!   r  G  sL   
r  optimizations_enabledoptimizations_disabledoptimizations_defaultc                 C   s  t j pt  }|j}	|	jr]zt|d|| |||d|d|d|}
|
W S  tjy: } zt	|| W Y d}~nd}~w tj
yC   Y nw zt| ||||||||d	W S  tjy\   Y nw t|ttfsjtd| dd	 |D }t|ttfs~td
| dd	 |D }|du rg }t|ttfstd| dd	 |D }tjd| |||||||d	\}}}}|dd }
t rd|dd|dd|df}|j}td|||
 |
\}
|
S )a  Creates a dataset by applying related optimizations to `input_dataset`.

  Creates a dataset by applying related optimizations to `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
      A variant tensor representing the input dataset.
    optimizations_enabled: A `Tensor` of type `string`.
      A `tf.string` vector `tf.Tensor` identifying user enabled optimizations.
    optimizations_disabled: A `Tensor` of type `string`.
      A `tf.string` vector `tf.Tensor` identifying user disabled optimizations.
    optimizations_default: A `Tensor` of type `string`.
      A `tf.string` vector `tf.Tensor` identifying optimizations by default.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    optimization_configs: An optional list of `strings`. Defaults to `[]`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  OptimizeDatasetV2r   r   r  Nr  NExpected list for 'output_types' argument to 'optimize_dataset_v2' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z'optimize_dataset_v2.<locals>.<listcomp>OExpected list for 'output_shapes' argument to 'optimize_dataset_v2' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   VExpected list for 'optimization_configs' argument to 'optimize_dataset_v2' Op, not %r.c                 S   r   r  rm   r'   r    r    r!   r"     r#   )r   r  r  r  r   r   r  r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   "optimize_dataset_v2_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   )r   r  r  r  r   r   r  r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   optimize_dataset_v2g  s   
	
r  zraw_ops.OptimizeDatasetV2c	                 C   s  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.g }t |ttfs;td| dd |D }t| tj} t|tj}t|tj}t|tj}| |||g}	d|d	|d
|f}
t	j
dd|	|
||d}t	 rt	d|	|
| |\}|S )Nr  c                 S   r   r   r   r   r    r    r!   r"     r#   z6optimize_dataset_v2_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r  c                 S   r   r  rm   r'   r    r    r!   r"     r#   r   r   r  s   OptimizeDatasetV2rK   rL   r  r  )r   r  r  r  r   r   r  r   r   rG   rF   rA   r    r    r!   r    sP   
r  serialized_optionsc                 C   s  t j pt  }|j}|jrZzt|d|| d|d|d|d|}|W S  tjy9 }	 zt	|	| W Y d}	~	nd}	~	w tj
yB   Y nw zt| ||||||dW S  tjyY   Y nw t|d}t|ttfsmtd| d	d
 |D }t|ttfstd| dd
 |D }|du rd}t|d}tjd| |||||d\}
}
}}|dd }t rd|dd|dd|dd|df}|j}td||| |\}|S )am  Creates a dataset by attaching tf.data.Options to `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
      A variant tensor representing the input dataset.
    serialized_options: A `string`.
      A `tf.string` scalar `tf.Tensor` of serialized `tf.data.Options` protocol buffer.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  OptionsDatasetr  r   r   r   N)r  r   r   r   r   r   JExpected list for 'output_types' argument to 'options_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z#options_dataset.<locals>.<listcomp>KExpected list for 'output_shapes' argument to 'options_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   )r   r  r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   options_dataset_eager_fallbackr3   r   rn   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   )r   r  r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   options_dataset  s~   


r  zraw_ops.OptionsDatasetc           
      C   s   t |d}t|ttfstd| dd |D }t|ttfs'td| dd |D }|d u r4d}t |d}t| tj	} | g}d|d	|d
|d|f}t j
dd||||d}	t  ret d|||	 |	\}	|	S )Nr  r  c                 S   r   r   r   r   r    r    r!   r"   ,  r#   z2options_dataset_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"   1  r#   r   r   r   r   s   OptionsDatasetrK   rL   r  )r   rn   r4   r5   r6   r7   r/   r   r   r   r   r:   r=   )
r   r  r   r   r   r   r   rG   rF   rA   r    r    r!   r  &  s@   

r  padded_shapesc                 C   s  t j pt  }|j}|jrZzt|d|| |||d|d|}	|	W S  tjy8 }
 zt	|
| W Y d}
~
nd}
~
w tj
yA   Y nw zt| |||||||dW S  tjyY   Y nw t|ttfsgtd| t|}t|ttfsxtd| dd	 |D }|du rd
}t|d}tjd| ||||||d\}}}}|dd }	t rd|dd|dd|dd|df}|j}td|||	 |	\}	|	S )a  Creates a dataset that batches and pads `batch_size` elements from the input.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    batch_size: A `Tensor` of type `int64`.
      A scalar representing the number of elements to accumulate in a
      batch.
    padded_shapes: A list of at least 1 `Tensor` objects with type `int64`.
      A list of int64 tensors representing the desired padded shapes
      of the corresponding output components. These shapes may be partially
      specified, using `-1` to indicate that a particular dimension should be
      padded to the maximum size of all batch elements.
    padding_values: A list of `Tensor` objects.
      A list of scalars containing the padding value to use for
      each of the outputs.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  PaddedBatchDatasetr   r   Nr   r   r   r   PExpected list for 'padded_shapes' argument to 'padded_batch_dataset' Op, not %r.PExpected list for 'output_shapes' argument to 'padded_batch_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   v  r#   z(padded_batch_dataset.<locals>.<listcomp>r   )r   r   r  padding_valuesr   r   r   Toutput_typesr   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   #padded_batch_dataset_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r;   r   r<   r=   )r   r   r  r  r   r   r   r?   r@   rA   rB   r   rC   rD   rE   rF   rG   r    r    r!   padded_batch_datasetB  sz   

r  zraw_ops.PaddedBatchDatasetc                 C   s   t |ttfstd| t|}t |ttfstd| dd |D }|d u r+d}t|d}t||\}	}t	| t
j} t	|t
j}t|t
j}| |gt| t| }
d|	d|d	|d|f}tjd
d|
|||d}t r{td|
|| |\}|S )Nr  r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   z7padded_batch_dataset_eager_fallback.<locals>.<listcomp>r   r   r  r   r   s   PaddedBatchDatasetrK   rL   r  )r4   r5   r6   r7   r   r   rn   r  r/   r   r   r   r   r   r   r:   r=   )r   r   r  r  r   r   r   r   r   _attr_Toutput_typesrG   rF   rA   r    r    r!   r    sD   

r  c	                 C   s  t j pt  }	|	j}
|
jr_zt|	d|| ||||d|d|d|}|W S  tjy; } zt	|| W Y d}~nd}~w tj
yD   Y nw zt| |||||||||	d
W S  tjy^   Y nw t|ttfsltd| t|}t|ttfs}td| d	d
 |D }|du rd}t|d}|du rd}t|d}tjd| ||||||||d
\}}}}|dd }t rd|dd|dd|dd|dd|df
}|j}td||| |\}|S )a  Creates a dataset that batches and pads `batch_size` elements from the input.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    batch_size: A `Tensor` of type `int64`.
      A scalar representing the number of elements to accumulate in a
      batch.
    padded_shapes: A list of at least 1 `Tensor` objects with type `int64`.
      A list of int64 tensors representing the desired padded shapes
      of the corresponding output components. These shapes may be partially
      specified, using `-1` to indicate that a particular dimension should be
      padded to the maximum size of all batch elements.
    padding_values: A list of `Tensor` objects.
      A list of scalars containing the padding value to use for
      each of the outputs.
    drop_remainder: A `Tensor` of type `bool`.
      A scalar representing whether the last batch should be dropped in case its size
      is smaller than desired.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    parallel_copy: An optional `bool`. Defaults to `False`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  PaddedBatchDatasetV2r   r   r   N)r   r   r   r   r   SExpected list for 'padded_shapes' argument to 'padded_batch_dataset_v2' Op, not %r.SExpected list for 'output_shapes' argument to 'padded_batch_dataset_v2' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   z+padded_batch_dataset_v2.<locals>.<listcomp>Fr   )	r   r   r  r  r   r   r   r   r   r  r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   &padded_batch_dataset_v2_eager_fallbackr3   r4   r5   r6   r7   r   r   r   rn   r8   r9   r:   r   r;   r   r<   r=   )r   r   r  r  r   r   r   r   r   r?   r@   rA   rB   r   rC   rD   rE   rF   rG   r    r    r!   padded_batch_dataset_v2  s   

	

r  zraw_ops.PaddedBatchDatasetV2c
              
   C   s0  t |ttfstd| t|}
t |ttfstd| dd |D }|d u r+d}t|d}|d u r7d}t|d}t||	\}}t	
| tj} t	
|tj}t	|tj}t	
|tj}| |gt| t| |g }d|d	|d
|d|
d|f
}tjdd|||	|d}t rtd||| |\}|S )Nr  r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   z:padded_batch_dataset_v2_eager_fallback.<locals>.<listcomp>Fr   r   r   r  r   r   s   PaddedBatchDatasetV2rK   rL   r  )r4   r5   r6   r7   r   r   r   rn   r  r/   r   r   r   r   r   r   r   r:   r=   )r   r   r  r  r   r   r   r   r   r   r   r  rG   rF   rA   r    r    r!   r    sN   

r  defaultnum_parallel_callsdeterministicc
                 C   s  t j pt  }
|
j}|jrczt|
d|	| |||d|d|d|d|d|}|W S  tjy> } zt	||	 W Y d}~nd}~w tj
yG   Y nw zt| |||||||||	|
dW S  tjyb   Y nw t|ttfsptd	| d
d |D }t|ttfstd| dd |D }|du rd}t|d}|du rd}t|d}|du rd}t|d}tjd| |||||||||	d\}}}}|dd }t rd|dd|dd|dd|dd|df
}|j}td||| |\}|S )a  TODO: add doc.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    batch_size: A `Tensor` of type `int64`.
    num_parallel_calls: A `Tensor` of type `int64`.
    drop_remainder: A `Tensor` of type `bool`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    parallel_copy: An optional `bool`. Defaults to `False`.
    deterministic: An optional `string`. Defaults to `"default"`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ParallelBatchDatasetr   r   r   r  r   N)r   r   r   r  r   r   r   QExpected list for 'output_types' argument to 'parallel_batch_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   U  r#   z*parallel_batch_dataset.<locals>.<listcomp>RExpected list for 'output_shapes' argument to 'parallel_batch_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   Z  r#   Fr   r   )
r   r   r  r   r   r   r   r  r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   %parallel_batch_dataset_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r   r;   r<   r=   )r   r   r  r   r   r   r   r  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   parallel_batch_dataset(  s   




r  zraw_ops.ParallelBatchDatasetc              
   C   s,  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d	}|d u rFd
}t|d}t| t	j
} t|t	j}t|t	j}t|t	j}| |||g}d|d|d|d	|d|f
}tjdd|||
|	d}t rtd||| |\}|S )Nr  c                 S   r   r   r   r   r    r    r!   r"     r#   z9parallel_batch_dataset_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   Fr   r   r  r   r   r   r   s   ParallelBatchDatasetrK   rL   r  r   )r   r   r  r   r   r   r   r  r   r   r   rG   rF   rA   r    r    r!   r  ~  sR   

r  c	                 C   s  t j pt  }	|	j}
|
jrazt|	d|| ||d|d|d|d|d|}|W S  tjy= } zt	|| W Y d}~nd}~w tj
yF   Y nw zt| |||||||||	d
W S  tjy`   Y nw t|ttfsntd	| d
d |D }t|ttfstd| dd |D }|du rd}t|d}|du rd}t|d}tjd| ||||||||d
\}}}}|dd }t rd|dd|dd|dd|dd|dd|df}|j}td||| |\}|S )a  Creates a dataset containing elements of `input_dataset` matching `predicate`.

  The `predicate` function must return a scalar boolean and accept the
  following arguments:

  * One tensor for each component of an element of `input_dataset`.
  * One tensor for each value in `other_arguments`.

  Unlike a "FilterDataset", which applies `predicate` sequentially, this dataset
  invokes up to `num_parallel_calls` copies of `predicate` in parallel.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    other_arguments: A list of `Tensor` objects.
      A list of tensors, typically values that were captured when
      building a closure for `predicate`.
    num_parallel_calls: A `Tensor` of type `int64`.
      The number of concurrent invocations of `predicate` that process
      elements from `input_dataset` in parallel.
    predicate: A function decorated with @Defun.
      A function returning a scalar boolean.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    deterministic: An optional `string`. Defaults to `"default"`.
      A string indicating the op-level determinism to use. Deterministic controls
      whether the interleave is allowed to return elements out of order if the next
      element to be returned isn't available, but a later element is. Options are
      "true", "false", and "default". "default" indicates that determinism should be
      decided by the `experimental_deterministic` parameter of `tf.data.Options`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ParallelFilterDatasetr  r  r   r   r   N)r  r  r   r   r   r   r   RExpected list for 'output_types' argument to 'parallel_filter_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z+parallel_filter_dataset.<locals>.<listcomp>SExpected list for 'output_shapes' argument to 'parallel_filter_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   )	r   r  r  r  r   r   r  r   r   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   &parallel_filter_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r   r  r  r  r   r   r  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   parallel_filter_dataset  s   $
	



r  zraw_ops.ParallelFilterDatasetc
                 C   s  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d	}t||	\}
}t| t	j
} t|t	j}| gt| |g }d
|d|d|
d|d|d	|f}tjdd|||	|d}t rtd||| |\}|S )Nr	  c                 S   r   r   r   r   r    r    r!   r"     r#   z:parallel_filter_dataset_eager_fallback.<locals>.<listcomp>r
  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r  r   r   r  r  r   r   s   ParallelFilterDatasetrK   rL   r  rY  )r   r  r  r  r   r   r  r   r   r   r  rG   rF   rA   r    r    r!   r    sJ   
r  sloppyc                 C   s  t j pt  }|j}|jrezt|d|
| ||||d|d|d|d|d|	}|W S  tjy? } zt	||
 W Y d}~nd}~w tj
yH   Y nw zt| |||||||||	|
|dW S  tjyd   Y nw t|ttfsrtd	| d
d |D }t|ttfstd| dd |D }|du rd}t|d}|	du rd}	t|	d}	tjd| |||||||||	|
d\}}}}|dd }t rd|dd|dd|dd|dd|dd|df}|j}td||| |\}|S )aR	  Creates a dataset that applies `f` to the outputs of `input_dataset`.

  The resulting dataset is similar to the `InterleaveDataset`, except that the
  dataset will fetch records from the interleaved datasets in parallel.

  The `tf.data` Python API creates instances of this op from
  `Dataset.interleave()` when the `num_parallel_calls` parameter of that method
  is set to any value other than `None`.

  By default, the output of this dataset will be deterministic, which may result
  in the dataset blocking if the next data item to be returned isn't available.
  In order to avoid head-of-line blocking, one can set the
  `experimental_deterministic` parameter of `tf.data.Options` to `False`,
  which can improve performance at the expense of non-determinism.

  Args:
    input_dataset: A `Tensor` of type `variant`.
      Dataset that produces a stream of arguments for the function `f`.
    other_arguments: A list of `Tensor` objects.
      Additional arguments to pass to `f` beyond those produced by `input_dataset`.
      Evaluated once when the dataset is instantiated.
    cycle_length: A `Tensor` of type `int64`.
      Number of datasets (each created by applying `f` to the elements of
      `input_dataset`) among which the `ParallelInterleaveDatasetV2` will cycle in a
      round-robin fashion.
    block_length: A `Tensor` of type `int64`.
      Number of elements at a time to produce from each interleaved invocation of a
      dataset returned by `f`.
    num_parallel_calls: A `Tensor` of type `int64`.
      Determines the number of threads that should be used for fetching data from
      input datasets in parallel. The Python API `tf.data.experimental.AUTOTUNE`
      constant can be used to indicate that the level of parallelism should be autotuned.
    f: A function decorated with @Defun.
      A function mapping elements of `input_dataset`, concatenated with
      `other_arguments`, to a Dataset variant that contains elements matching
      `output_types` and `output_shapes`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    sloppy: An optional `bool`. Defaults to `False`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ParallelInterleaveDatasetV2r5  r   r   r  r   N)r5  r   r   r  r   r   r   YExpected list for 'output_types' argument to 'parallel_interleave_dataset_v2' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   r  r#   z2parallel_interleave_dataset_v2.<locals>.<listcomp>ZExpected list for 'output_shapes' argument to 'parallel_interleave_dataset_v2' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   w  r#   Fr   )r   r  rR  rS  r  r5  r   r   r  r   r   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   -parallel_interleave_dataset_v2_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r;   r   r<   r=   )r   r  rR  rS  r  r5  r   r   r  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   parallel_interleave_dataset_v2)  s   .






r  z#raw_ops.ParallelInterleaveDatasetV2c                 C   s4  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|	d u r:d}	t|	d	}	t||\}}t	| t
j} t	|t
j}t	|t
j}t	|t
j}| gt| |||g }d
|d|d|d|d|d	|	f}tjdd||||
d}t rtd||| |\}|S )Nr  c                 S   r   r   r   r   r    r    r!   r"     r#   zAparallel_interleave_dataset_v2_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   Fr  r   r   r5  r  r   r   s   ParallelInterleaveDatasetV2rK   rL   r  r4   r5   r6   r7   r   r   rn   r  r/   r   r   r   r   r   r:   r=   )r   r  rR  rS  r  r5  r   r   r  r   r   r   r  rG   rF   rA   r    r    r!   r    sP   
r  c                 C   s  t j pt  }|j}|jrezt|d|
| ||||d|d|d|d|d|	}|W S  tjy? } zt	||
 W Y d}~nd}~w tj
yH   Y nw zt| |||||||||	|
|dW S  tjyd   Y nw t|ttfsrtd	| d
d |D }t|ttfstd| dd |D }|du rd}t|d}|	du rd}	t|	d}	tjd| |||||||||	|
d\}}}}|dd }t rd|dd|dd|dd|dd|dd|df}|j}td||| |\}|S )aQ  Creates a dataset that applies `f` to the outputs of `input_dataset`.

  The resulting dataset is similar to the `InterleaveDataset`, except that the
  dataset will fetch records from the interleaved datasets in parallel.

  The `tf.data` Python API creates instances of this op from
  `Dataset.interleave()` when the `num_parallel_calls` parameter of that method
  is set to any value other than `None`.

  By default, the output of this dataset will be deterministic, which may result
  in the dataset blocking if the next data item to be returned isn't available.
  In order to avoid head-of-line blocking, one can either set the `deterministic`
  attribute to "false", or leave it as "default" and set the
  `experimental_deterministic` parameter of `tf.data.Options` to `False`.
  This can improve performance at the expense of non-determinism.

  Args:
    input_dataset: A `Tensor` of type `variant`.
      Dataset that produces a stream of arguments for the function `f`.
    other_arguments: A list of `Tensor` objects.
      Additional arguments to pass to `f` beyond those produced by `input_dataset`.
      Evaluated once when the dataset is instantiated.
    cycle_length: A `Tensor` of type `int64`.
      Number of datasets (each created by applying `f` to the elements of
      `input_dataset`) among which the `ParallelInterleaveDatasetV2` will cycle in a
      round-robin fashion.
    block_length: A `Tensor` of type `int64`.
      Number of elements at a time to produce from each interleaved invocation of a
      dataset returned by `f`.
    num_parallel_calls: A `Tensor` of type `int64`.
      Determines the number of threads that should be used for fetching data from
      input datasets in parallel. The Python API `tf.data.experimental.AUTOTUNE`
      constant can be used to indicate that the level of parallelism should be autotuned.
    f: A function decorated with @Defun.
      A function mapping elements of `input_dataset`, concatenated with
      `other_arguments`, to a Dataset variant that contains elements matching
      `output_types` and `output_shapes`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    deterministic: An optional `string`. Defaults to `"default"`.
      A string indicating the op-level determinism to use. Deterministic controls
      whether the interleave is allowed to return elements out of order if the next
      element to be returned isn't available, but a later element is. Options are
      "true", "false", and "default". "default" indicates that determinism should be
      decided by the `experimental_deterministic` parameter of `tf.data.Options`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ParallelInterleaveDatasetV3r5  r  r   r   r   Nr5  r  r   r   r   r   r   YExpected list for 'output_types' argument to 'parallel_interleave_dataset_v3' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z2parallel_interleave_dataset_v3.<locals>.<listcomp>ZExpected list for 'output_shapes' argument to 'parallel_interleave_dataset_v3' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   )r   r  rR  rS  r  r5  r   r   r  r   r   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   -parallel_interleave_dataset_v3_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r   r  rR  rS  r  r5  r   r   r  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   parallel_interleave_dataset_v3  s   4






r  z#raw_ops.ParallelInterleaveDatasetV3c                 C   s4  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|	d u r:d}	t|	d	}	t||\}}t| t	j
} t|t	j}t|t	j}t|t	j}| gt| |||g }d
|d|d|d|d|d	|	f}tjdd||||
d}t rtd||| |\}|S )Nr  c                 S   r   r   r   r   r    r    r!   r"   8  r#   zAparallel_interleave_dataset_v3_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"   =  r#   r   r  r   r   r5  r  r   r   s   ParallelInterleaveDatasetV3rK   rL   r  rY  )r   r  rR  rS  r  r5  r   r   r  r   r   r   r  rG   rF   rA   r    r    r!   r  3  sP   
r  buffer_output_elementsprefetch_input_elementsc                 C   s  t j pt  }|j}|jrizt|d|| ||||||d|d|
d|d|	d|}|W S  tjyA } zt	|| W Y d}~nd}~w tj
yJ   Y nw zt| ||||||||
||	|||dW S  tjyh   Y nw t|ttfsvtd	| d
d |D }t|	ttfstd|	 dd |	D }	|
du rd}
t|
d}
|du rd}t|d}tjd| |||||||||	|
||d\}}}}|dd }t rd|dd|dd|dd|dd|dd|df}|j}td||| |\}|S )a  Creates a dataset that applies `f` to the outputs of `input_dataset`.

  The resulting dataset is similar to the `InterleaveDataset`, except that the
  dataset will fetch records from the interleaved datasets in parallel.

  The `tf.data` Python API creates instances of this op from
  `Dataset.interleave()` when the `num_parallel_calls` parameter of that method
  is set to any value other than `None`.

  By default, the output of this dataset will be deterministic, which may result
  in the dataset blocking if the next data item to be returned isn't available.
  In order to avoid head-of-line blocking, one can either set the `deterministic`
  attribute to "false", or leave it as "default" and set the
  `experimental_deterministic` parameter of `tf.data.Options` to `False`.
  This can improve performance at the expense of non-determinism.

  Args:
    input_dataset: A `Tensor` of type `variant`.
      Dataset that produces a stream of arguments for the function `f`.
    other_arguments: A list of `Tensor` objects.
      Additional arguments to pass to `f` beyond those produced by `input_dataset`.
      Evaluated once when the dataset is instantiated.
    cycle_length: A `Tensor` of type `int64`.
      Number of datasets (each created by applying `f` to the elements of
      `input_dataset`) among which the `ParallelInterleaveDatasetV2` will cycle in a
      round-robin fashion.
    block_length: A `Tensor` of type `int64`.
      Number of elements at a time to produce from each interleaved invocation of a
      dataset returned by `f`.
    buffer_output_elements: A `Tensor` of type `int64`.
      The number of elements each iterator being interleaved should buffer (similar
      to the `.prefetch()` transformation for each interleaved iterator).
    prefetch_input_elements: A `Tensor` of type `int64`.
      Determines the number of iterators to prefetch, allowing buffers to warm up and
      data to be pre-fetched without blocking the main thread.
    num_parallel_calls: A `Tensor` of type `int64`.
      Determines the number of threads that should be used for fetching data from
      input datasets in parallel. The Python API `tf.data.experimental.AUTOTUNE`
      constant can be used to indicate that the level of parallelism should be autotuned.
    f: A function decorated with @Defun.
      A function mapping elements of `input_dataset`, concatenated with
      `other_arguments`, to a Dataset variant that contains elements matching
      `output_types` and `output_shapes`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    deterministic: An optional `string`. Defaults to `"default"`.
      A string indicating the op-level determinism to use. Deterministic controls
      whether the interleave is allowed to return elements out of order if the next
      element to be returned isn't available, but a later element is. Options are
      "true", "false", and "default". "default" indicates that determinism should be
      decided by the `experimental_deterministic` parameter of `tf.data.Options`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ParallelInterleaveDatasetV4r5  r  r   r   r   Nr  YExpected list for 'output_types' argument to 'parallel_interleave_dataset_v4' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z2parallel_interleave_dataset_v4.<locals>.<listcomp>ZExpected list for 'output_shapes' argument to 'parallel_interleave_dataset_v4' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   )r   r  rR  rS  r  r  r  r5  r   r   r  r   r   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   -parallel_interleave_dataset_v4_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r   r  rR  rS  r  r  r  r5  r   r   r  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   parallel_interleave_dataset_v4W  s   :




r   z#raw_ops.ParallelInterleaveDatasetV4c                 C   sT  t |ttfstd| dd |D }t |	ttfs!td|	 dd |	D }	|
d u r.d}
t|
d}
|d u r:d}t|d	}t||\}}t| t	j
} t|t	j}t|t	j}t|t	j}t|t	j}t|t	j}| gt| |||||g }d
|d|
d|d|d|	d	|f}tjdd||||d}t rtd||| |\}|S )Nr  c                 S   r   r   r   r   r    r    r!   r"     r#   zAparallel_interleave_dataset_v4_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r  r   r   r5  r  r   r   s   ParallelInterleaveDatasetV4rK   rL   r  rY  )r   r  rR  rS  r  r  r  r5  r   r   r  r   r   r   r  rG   rF   rA   r    r    r!   r    sT   
r  c                 C   s2  t j pt  }|j}|jrgzt|d|
| ||d|d|d|d|d|d|d|	}|W S  tjyA } zt	||
 W Y d	}~nd	}~w tj
yJ   Y nw zt| |||||||||	|
|d
W S  tjyf   Y nw t|ttfsttd| dd |D }t|ttfstd| dd |D }|d	u rd}t|d}|d	u rd}t|d}|d	u rd}t|d}|	d	u rd}	t|	d}	tjd| |||||||||	|
d\}}}}|d	d	 }t rd|dd|dd|dd|dd|dd|dd|dd|df}|j}td||| |\}|S )a   Creates a dataset that applies `f` to the outputs of `input_dataset`.

  Unlike a "MapDataset", which applies `f` sequentially, this dataset invokes up
  to `num_parallel_calls` copies of `f` in parallel.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    other_arguments: A list of `Tensor` objects.
    num_parallel_calls: A `Tensor` of type `int32`.
      The number of concurrent invocations of `f` that process
      elements from `input_dataset` in parallel.
    f: A function decorated with @Defun.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    use_inter_op_parallelism: An optional `bool`. Defaults to `True`.
    sloppy: An optional `bool`. Defaults to `False`.
    preserve_cardinality: An optional `bool`. Defaults to `False`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ParallelMapDatasetr5  r   r   r  r  r  r   N)	r5  r   r   r  r  r  r   r   r   OExpected list for 'output_types' argument to 'parallel_map_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   1  r#   z(parallel_map_dataset.<locals>.<listcomp>PExpected list for 'output_shapes' argument to 'parallel_map_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   6  r#   TFr   )r   r  r  r5  r   r   r  r  r  r   r   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   #parallel_map_dataset_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r;   r   r<   r=   )r   r  r  r5  r   r   r  r  r  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   parallel_map_dataset  s   









r%  zraw_ops.ParallelMapDatasetc                 C   sL  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d	}|d u rFd}t|d
}|	d u rRd}	t|	d}	t||\}}t	| t
j} t	|t
j}| gt| |g }d|d|d|d|d|d	|d
|d|	f}tjdd||||
d}t rtd||| |\}|S )Nr"  c                 S   r   r   r   r   r    r    r!   r"   e  r#   z7parallel_map_dataset_eager_fallback.<locals>.<listcomp>r#  c                 S   r   r%   r&   r'   r    r    r!   r"   j  r#   Tr  Fr  r  r   r   r5  r  r   r   s   ParallelMapDatasetrK   rL   r!  )r4   r5   r6   r7   r   r   rn   r  r/   r   r   r   r  r   r:   r=   )r   r  r  r5  r   r   r  r  r  r   r   r   r  rG   rF   rA   r    r    r!   r$  `  sX   

r$  c                 C   s2  t j pt  }|j}|jrgzt|d|
| ||d|d|d|d|d|d|d|	}|W S  tjyA } zt	||
 W Y d	}~nd	}~w tj
yJ   Y nw zt| |||||||||	|
|d
W S  tjyf   Y nw t|ttfsttd| dd |D }t|ttfstd| dd |D }|d	u rd}t|d}|d	u rd}t|d}|d	u rd}t|d}|	d	u rd}	t|	d}	tjd| |||||||||	|
d\}}}}|d	d	 }t rd|dd|dd|dd|dd|dd|dd|dd|df}|j}td||| |\}|S )a  Creates a dataset that applies `f` to the outputs of `input_dataset`.

  Unlike a "MapDataset", which applies `f` sequentially, this dataset invokes up
  to `num_parallel_calls` copies of `f` in parallel.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    other_arguments: A list of `Tensor` objects.
    num_parallel_calls: A `Tensor` of type `int64`.
      The number of concurrent invocations of `f` that process
      elements from `input_dataset` in parallel.
    f: A function decorated with @Defun.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    use_inter_op_parallelism: An optional `bool`. Defaults to `True`.
    deterministic: An optional `string`. Defaults to `"default"`.
    preserve_cardinality: An optional `bool`. Defaults to `False`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ParallelMapDatasetV2r5  r   r   r  r  r  r   N)	r5  r   r   r  r  r  r   r   r   RExpected list for 'output_types' argument to 'parallel_map_dataset_v2' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z+parallel_map_dataset_v2.<locals>.<listcomp>SExpected list for 'output_shapes' argument to 'parallel_map_dataset_v2' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   Tr   Fr   )r   r  r  r5  r   r   r  r  r  r   r   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   &parallel_map_dataset_v2_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r;   r   r<   r=   )r   r  r  r5  r   r   r  r  r  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   parallel_map_dataset_v2  s   









r*  zraw_ops.ParallelMapDatasetV2c                 C   sL  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d	}|d u rFd
}t|d}|	d u rRd}	t|	d}	t||\}}t	| t
j} t	|t
j}| gt| |g }d|d|d|d|d|d	|d|d|	f}tjdd||||
d}t rtd||| |\}|S )Nr'  c                 S   r   r   r   r   r    r    r!   r"     r#   z:parallel_map_dataset_v2_eager_fallback.<locals>.<listcomp>r(  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   Tr  r   r  Fr  r   r   r5  r  r   r   s   ParallelMapDatasetV2rK   rL   r&  r  )r   r  r  r5  r   r   r  r  r  r   r   r   r  rG   rF   rA   r    r    r!   r)    sX   

r)  slack_periodlegacy_autotunebuffer_size_minc	                 C   s  t j pt  }	|	j}
|
jrbzt|	d|| |d|d|d|d|d|d|}|W S  tjy> } zt	|| W Y d}~nd}~w tj
yG   Y nw zt| |||||||||	d	
W S  tjya   Y nw t|ttfsotd
| dd |D }t|ttfstd| dd |D }|du rd}t|d}|du rd}t|d}|du rd}t|d}|du rd}t|d}tjd| ||||||||d
\}}}}|dd }t rd|dd|dd|dd|dd|dd|df}|j}td||| |\}|S )a  Creates a dataset that asynchronously prefetches elements from `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    buffer_size: A `Tensor` of type `int64`.
      The maximum number of elements to buffer in an iterator over
      this dataset.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    slack_period: An optional `int`. Defaults to `0`.
    legacy_autotune: An optional `bool`. Defaults to `True`.
    buffer_size_min: An optional `int`. Defaults to `0`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  PrefetchDatasetr   r   r+  r,  r-  r   N)r   r   r+  r,  r-  r   r   r   KExpected list for 'output_types' argument to 'prefetch_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   C  r#   z$prefetch_dataset.<locals>.<listcomp>LExpected list for 'output_shapes' argument to 'prefetch_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   H  r#   r   Tr   )	r   r*  r   r   r+  r,  r-  r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   prefetch_dataset_eager_fallbackr3   r4   r5   r6   r7   r   r   r   rn   r8   r9   r:   r;   r   r   r<   r=   )r   r*  r   r   r+  r,  r-  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   prefetch_dataset  s   





r2  zraw_ops.PrefetchDatasetc
                 C   s(  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d	}|d u rFd}t|d
}|d u rRd}t|d}t	| t
j} t	|t
j}| |g}
d|d|d|d	|d
|d|f}tjdd|
||	|d}t rtd|
|| |\}|S )Nr/  c                 S   r   r   r   r   r    r    r!   r"   s  r#   z3prefetch_dataset_eager_fallback.<locals>.<listcomp>r0  c                 S   r   r%   r&   r'   r    r    r!   r"   x  r#   r   r+  Tr,  r-  r   r   r   r   s   PrefetchDatasetrK   rL   r.  )r4   r5   r6   r7   r   r   r   rn   r/   r   r   r   r   r   r:   r=   )r   r*  r   r   r+  r,  r-  r   r   r   rG   rF   rA   r    r    r!   r1  n  sT   
r1  startstopstepreplicate_on_splitc                 C   s  t j pt  }|j}	|	jr^zt|d|| ||d|d|d|d|}
|
W S  tjy; } zt	|| W Y d}~nd}~w tj
yD   Y nw zt| ||||||||d	W S  tjy]   Y nw t|ttfsktd| d	d
 |D }t|ttfstd| dd
 |D }|du rd}t|d}|du rd}t|d}tjd| |||||||d	\}}}}|dd }
t rd|dd|dd|dd|df}|j}td|||
 |
\}
|
S )a  Creates a dataset with a range of values. Corresponds to python's xrange.

  Args:
    start: A `Tensor` of type `int64`.
      corresponds to start in python's xrange().
    stop: A `Tensor` of type `int64`.
      corresponds to stop in python's xrange().
    step: A `Tensor` of type `int64`.
      corresponds to step in python's xrange().
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    replicate_on_split: An optional `bool`. Defaults to `False`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  RangeDatasetr   r   r   r6  N)r   r   r   r6  r   r   HExpected list for 'output_types' argument to 'range_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z!range_dataset.<locals>.<listcomp>IExpected list for 'output_shapes' argument to 'range_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   F)r3  r4  r5  r   r   r   r6  r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   range_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r   r8   r9   r:   r;   r   r<   r=   )r3  r4  r5  r   r   r   r6  r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   range_dataset  s   


r;  zraw_ops.RangeDatasetc	                 C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d	}t| t	j
} t|t	j
}t|t	j
}| ||g}	d
|d|d|d	|f}
tjdd|	|
||d}t r{td|	|
| |\}|S )Nr8  c                 S   r   r   r   r   r    r    r!   r"     r#   z0range_dataset_eager_fallback.<locals>.<listcomp>r9  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   Fr6  r   r   s   RangeDatasetrK   rL   r7  )r4   r5   r6   r7   r   rn   r   r/   r   r   r   r   r:   r=   )r3  r4  r5  r   r   r   r6  r   r   rG   rF   rA   r    r    r!   r:    r   r:  c	                 C   s  t j pt  }	|	j}
|
jrazt|	d|| ||d|d|d|d|d|}|W S  tjy= } zt	|| W Y d}~nd}~w tj
yF   Y nw zt| |||||||||	d
W S  tjy`   Y nw t|ttfsntd	| d
d |D }t|ttfstd| dd |D }|du rd}t|d}|du rd}t|d}tjd| ||||||||d
\}}}}|dd }|s|S t rd|dd|dd|dd|dd|dd|dd|df}|j}td||| |S )a  Reduces the input dataset to a singleton using a reduce function.

  Args:
    input_dataset: A `Tensor` of type `variant`.
      A variant tensor representing the input dataset.
    initial_state: A list of `Tensor` objects.
      A nested structure of tensors, representing the initial state of the
      transformation.
    other_arguments: A list of `Tensor` objects.
    f: A function decorated with @Defun.
      A function that maps `(old_state, input_element)` to `new_state`. It must take
      two arguments and return a nested structures of tensors. The structure of
      `new_state` must match the structure of `initial_state`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    use_inter_op_parallelism: An optional `bool`. Defaults to `True`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A list of `Tensor` objects of type `output_types`.
  ReduceDatasetr5  r   r   r  r   N)r5  r   r   r  r   r   r   IExpected list for 'output_types' argument to 'reduce_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   2  r#   z"reduce_dataset.<locals>.<listcomp>JExpected list for 'output_shapes' argument to 'reduce_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   7  r#   Tr   )	r   initial_stater  r5  r   r   r  r   r   Tstater  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   reduce_dataset_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r;   r   r<   r=   )r   r?  r  r5  r   r   r  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   reduce_dataset   s   




rB  zraw_ops.ReduceDatasetc
                 C   s  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d	}t||	\}
}t||	\}}t	| t
j} | gt| t| }d
|d|
d|d|d|d|d	|f}tjdt||||	|d}t rtd||| |S )Nr=  c                 S   r   r   r   r   r    r    r!   r"   ]  r#   z1reduce_dataset_eager_fallback.<locals>.<listcomp>r>  c                 S   r   r%   r&   r'   r    r    r!   r"   b  r#   Tr  r   r   r5  r@  r  r   r   s   ReduceDatasetrL   r<  )r4   r5   r6   r7   r   r   rn   r  r/   r   r   r   r   r   r:   r=   )r   r?  r  r5  r   r   r  r   r   r   Z_attr_Tstater  rG   rF   rA   r    r    r!   rA  X  sJ   rA  countc                 C   r   )a  Creates a dataset that emits the outputs of `input_dataset` `count` times.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    count: A `Tensor` of type `int64`.
      A scalar representing the number of times that `input_dataset` should
      be repeated. A value of `-1` indicates that it should be repeated infinitely.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  RepeatDatasetr   r   r   Nr   IExpected list for 'output_types' argument to 'repeat_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z"repeat_dataset.<locals>.<listcomp>JExpected list for 'output_shapes' argument to 'repeat_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   rC  r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   repeat_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   r   rC  r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   repeat_datasety  r   rJ  zraw_ops.RepeatDatasetc           
      C   r   )NrE  c                 S   r   r   r   r   r    r    r!   r"     r#   z1repeat_dataset_eager_fallback.<locals>.<listcomp>rF  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   r   r   s   RepeatDatasetrK   rL   rD  r   
r   rC  r   r   r   r   r   rG   rF   rA   r    r    r!   rH    r   rH  rewrite_namec                 C   sf  t j pt  }|j}|jrVzt|d|| |d|d|	}|W S  tjy6 } zt	|| W Y d}~nd}~w tj
y?   Y nw zt| |||||dW S  tjyU   Y nw t|ttfsctd| dd |D }t|ttfswtd	| d
d |D }tjd| ||||d\}	}	}
}|dd }t rd|
dd|
df}|
j}td||| |\}|S )a  TODO: add doc.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    rewrite_name: A `Tensor` of type `string`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  RewriteDatasetr   r   Nr   JExpected list for 'output_types' argument to 'rewrite_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z#rewrite_dataset.<locals>.<listcomp>KExpected list for 'output_shapes' argument to 'rewrite_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   )r   rL  r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   rewrite_dataset_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   )r   rL  r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   rewrite_dataset  sl   
rQ  zraw_ops.RewriteDatasetc           	      C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }t| tj} t|tj}| |g}d|d|f}t	j
dd	||||d
}t	 rWt	d||| |\}|S )NrN  c                 S   r   r   r   r   r    r    r!   r"     r#   z2rewrite_dataset_eager_fallback.<locals>.<listcomp>rO  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   s   RewriteDatasetrK   rL   rM  r  )	r   rL  r   r   r   r   rG   rF   rA   r    r    r!   rP    s6   
rP  c              
   C   r   )aV  Converts the given `resource_handle` representing an iterator to a variant tensor.

  Args:
    resource_handle: A `Tensor` of type `resource`.
      A handle to an iterator resource.
    external_state_policy: An optional `int`. Defaults to `0`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  SerializeIteratorr   N)r   r   r   r   )r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   !serialize_iterator_eager_fallbackr3   r   r   r8   r9   r:   r   r<   r=   )r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   serialize_iterator,  sT   rT  zraw_ops.SerializeIteratorc                 C   r   )Nr   r   s   SerializeIteratorrK   rL   rR  )	r   r   r/   r   r   r   r   r:   r=   )r   r   r   r   rG   rF   rA   r    r    r!   rS  _  r   rS  
num_shardsindexrequire_non_emptyc                 C   r   )a  Creates a `Dataset` that includes only 1/`num_shards` of this dataset.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    num_shards: A `Tensor` of type `int64`.
      An integer representing the number of shards operating in parallel.
    index: A `Tensor` of type `int64`.
      An integer representing the current worker index.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    require_non_empty: An optional `bool`. Defaults to `False`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ShardDatasetrW  r   r   r   N)rW  r   r   r   r   r   HExpected list for 'output_types' argument to 'shard_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z!shard_dataset.<locals>.<listcomp>IExpected list for 'output_shapes' argument to 'shard_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   Fr   )r   rU  rV  r   r   rW  r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   shard_dataset_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r   r;   r<   r=   )r   rU  rV  r   r   rW  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   shard_dataseto  s   

r\  zraw_ops.ShardDatasetc	                 C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d	}t| t	j
} t|t	j}t|t	j}| ||g}	d|d
|d|d	|f}
tjdd|	|
||d}t r{td|	|
| |\}|S )NrY  c                 S   r   r   r   r   r    r    r!   r"     r#   z0shard_dataset_eager_fallback.<locals>.<listcomp>rZ  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   FrW  r   r   r   r   s   ShardDatasetrK   rL   rX  r4   r5   r6   r7   r   r   rn   r/   r   r   r   r   r   r:   r=   )r   rU  rV  r   r   rW  r   r   r   rG   rF   rA   r    r    r!   r[    sH   


r[  reshuffle_each_iterationc
                 C   s  t j pt  }
|
j}|jrbzt|
d|	| ||||d|d|d|d|}|W S  tjy= } zt	||	 W Y d}~nd}~w tj
yF   Y nw zt| |||||||||	|
dW S  tjya   Y nw t|ttfsotd| d	d
 |D }t|ttfstd| dd
 |D }|du rd}t|d}|du rd}t|d}tjd| |||||||||	d\}}}}|dd }t rd|dd|dd|dd|df}|j}td||| |\}|S )a  Creates a dataset that shuffles and repeats elements from `input_dataset`

  pseudorandomly.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    buffer_size: A `Tensor` of type `int64`.
      The number of output elements to buffer in an iterator over
      this dataset. Compare with the `min_after_dequeue` attr when creating a
      `RandomShuffleQueue`.
    seed: A `Tensor` of type `int64`.
      A scalar seed for the random number generator. If either `seed` or
      `seed2` is set to be non-zero, the random number generator is seeded
      by the given seed.  Otherwise, a random seed is used.
    seed2: A `Tensor` of type `int64`.
      A second scalar seed to avoid seed collision.
    count: A `Tensor` of type `int64`.
      A scalar representing the number of times the underlying dataset
      should be repeated. The default is `-1`, which results in infinite repetition.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    reshuffle_each_iteration: An optional `bool`. Defaults to `True`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ShuffleAndRepeatDatasetr   r   r^  r   N)r   r   r^  r   r   r   UExpected list for 'output_types' argument to 'shuffle_and_repeat_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z.shuffle_and_repeat_dataset.<locals>.<listcomp>VExpected list for 'output_shapes' argument to 'shuffle_and_repeat_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   Tr   )
r   r*  r~   r   rC  r   r   r^  r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   )shuffle_and_repeat_dataset_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r;   r   r<   r=   )r   r*  r~   r   rC  r   r   r^  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   shuffle_and_repeat_dataset  s   



rc  zraw_ops.ShuffleAndRepeatDatasetc                 C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d	}t| t	j
} t|t	j}t|t	j}t|t	j}t|t	j}| ||||g}d
|d|d|d	|f}tjdd|||
|	d}t rtd||| |\}|S )Nr`  c                 S   r   r   r   r   r    r    r!   r"   ;  r#   z=shuffle_and_repeat_dataset_eager_fallback.<locals>.<listcomp>ra  c                 S   r   r%   r&   r'   r    r    r!   r"   @  r#   Tr^  r   r   r   r   s   ShuffleAndRepeatDatasetrK   rL   r_  r]  )r   r*  r~   r   rC  r   r   r^  r   r   r   rG   rF   rA   r    r    r!   rb  6  sN   rb  seed_generatorc                 C   s  t j pt  }|j}|jrdzt|d|
| |||||d|d|d|d|	}|W S  tjy> } zt	||
 W Y d}~nd}~w tj
yG   Y nw zt| |||||||||	|
|dW S  tjyc   Y nw t|ttfsqtd| d	d
 |D }t|ttfstd| dd
 |D }|du rd}t|d}|	du rd}	t|	d}	tjd| |||||||||	|
d\}}}}|dd }t rd|dd|dd|dd|df}|j}td||| |\}|S )a  TODO: add doc.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    buffer_size: A `Tensor` of type `int64`.
    seed: A `Tensor` of type `int64`.
    seed2: A `Tensor` of type `int64`.
    count: A `Tensor` of type `int64`.
    seed_generator: A `Tensor` of type `resource`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    reshuffle_each_iteration: An optional `bool`. Defaults to `True`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ShuffleAndRepeatDatasetV2r^  r   r   r   Nr^  r   r   r   r   r   XExpected list for 'output_types' argument to 'shuffle_and_repeat_dataset_v2' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z1shuffle_and_repeat_dataset_v2.<locals>.<listcomp>YExpected list for 'output_shapes' argument to 'shuffle_and_repeat_dataset_v2' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   Tr   )r   r*  r~   r   rC  rd  r   r   r^  r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   ,shuffle_and_repeat_dataset_v2_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r   r;   r<   r=   )r   r*  r~   r   rC  rd  r   r   r^  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   shuffle_and_repeat_dataset_v2Y  s   

	


rj  z!raw_ops.ShuffleAndRepeatDatasetV2c                 C   s0  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|	d u r:d}	t|	d	}	t| t	j
} t|t	j}t|t	j}t|t	j}t|t	j}t|t	j}| |||||g}d|d
|d|d	|	f}tjdd||||
d}t rtd||| |\}|S )Nrg  c                 S   r   r   r   r   r    r    r!   r"     r#   z@shuffle_and_repeat_dataset_v2_eager_fallback.<locals>.<listcomp>rh  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   Tr^  r   r   r   r   s   ShuffleAndRepeatDatasetV2rK   rL   re  r4   r5   r6   r7   r   r   rn   r/   r   r   r   r   r   r   r:   r=   )r   r*  r~   r   rC  rd  r   r   r^  r   r   r   rG   rF   rA   r    r    r!   ri    sR   
ri  c	                 C   s  t j pt  }	|	j}
|
jr`zt|	d|| |||d|d|d|d|}|W S  tjy< } zt	|| W Y d}~nd}~w tj
yE   Y nw zt| |||||||||	d
W S  tjy_   Y nw t|ttfsmtd| d	d
 |D }t|ttfstd| dd
 |D }|du rd}t|d}|du rd}t|d}tjd| ||||||||d
\}}}}|dd }t rd|dd|dd|dd|df}|j}td||| |\}|S )a  Creates a dataset that shuffles elements from `input_dataset` pseudorandomly.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    buffer_size: A `Tensor` of type `int64`.
      The number of output elements to buffer in an iterator over
      this dataset. Compare with the `min_after_dequeue` attr when creating a
      `RandomShuffleQueue`.
    seed: A `Tensor` of type `int64`.
      A scalar seed for the random number generator. If either `seed` or
      `seed2` is set to be non-zero, the random number generator is seeded
      by the given seed.  Otherwise, a random seed is used.
    seed2: A `Tensor` of type `int64`.
      A second scalar seed to avoid seed collision.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    reshuffle_each_iteration: An optional `bool`. Defaults to `True`.
      If true, each iterator over this dataset will be given
      a different pseudorandomly generated seed, based on a sequence seeded by the
      `seed` and `seed2` inputs. If false, each iterator will be given the same
      seed, and repeated iteration over this dataset will yield the exact same
      sequence of results.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ShuffleDatasetr^  r   r   r   Nrf  JExpected list for 'output_types' argument to 'shuffle_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z#shuffle_dataset.<locals>.<listcomp>KExpected list for 'output_shapes' argument to 'shuffle_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   Tr   )	r   r*  r~   r   r   r   r^  r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   shuffle_dataset_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r   r;   r<   r=   )r   r*  r~   r   r   r   r^  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   shuffle_dataset  s   



rp  zraw_ops.ShuffleDatasetc
                 C   s  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d	}t| t	j
} t|t	j}t|t	j}t|t	j}| |||g}
d|d
|d|d	|f}tjdd|
||	|d}t rtd|
|| |\}|S )Nrm  c                 S   r   r   r   r   r    r    r!   r"   0  r#   z2shuffle_dataset_eager_fallback.<locals>.<listcomp>rn  c                 S   r   r%   r&   r'   r    r    r!   r"   5  r#   Tr^  r   r   r   r   s   ShuffleDatasetrK   rL   rl  r]  )r   r*  r~   r   r   r   r^  r   r   r   rG   rF   rA   r    r    r!   ro  +  sL   

ro  c                 C   r   )a  TODO: add doc.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    buffer_size: A `Tensor` of type `int64`.
    seed_generator: A `Tensor` of type `resource`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ShuffleDatasetV2r   r   r   Nr   MExpected list for 'output_types' argument to 'shuffle_dataset_v2' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   u  r#   z&shuffle_dataset_v2.<locals>.<listcomp>NExpected list for 'output_shapes' argument to 'shuffle_dataset_v2' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   z  r#   r   )r   r*  rd  r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   !shuffle_dataset_v2_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r   r*  rd  r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   shuffle_dataset_v2M  s|   

ru  zraw_ops.ShuffleDatasetV2c                 C   r   )Nrr  c                 S   r   r   r   r   r    r    r!   r"     r#   z5shuffle_dataset_v2_eager_fallback.<locals>.<listcomp>rs  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   r   r   s   ShuffleDatasetV2rK   rL   rq  )r4   r5   r6   r7   r   rn   r/   r   r   r   r   r   r   r:   r=   )r   r*  rd  r   r   r   r   r   rG   rF   rA   r    r    r!   rt    r   rt  c
                 C   s  t j pt  }
|
j}|jrbzt|
d|	| ||||d|d|d|d|}|W S  tjy= } zt	||	 W Y d}~nd}~w tj
yF   Y nw zt| |||||||||	|
dW S  tjya   Y nw t|ttfsotd| d	d
 |D }t|ttfstd| dd
 |D }|du rd}t|d}|du rd}t|d}tjd| |||||||||	d\}}}}|dd }t rd|dd|dd|dd|df}|j}td||| |\}|S )ay  TODO: add doc.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    buffer_size: A `Tensor` of type `int64`.
    seed: A `Tensor` of type `int64`.
    seed2: A `Tensor` of type `int64`.
    seed_generator: A `Tensor` of type `resource`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    reshuffle_each_iteration: An optional `bool`. Defaults to `True`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  ShuffleDatasetV3r^  r   r   r   Nrf  MExpected list for 'output_types' argument to 'shuffle_dataset_v3' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z&shuffle_dataset_v3.<locals>.<listcomp>NExpected list for 'output_shapes' argument to 'shuffle_dataset_v3' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   Tr   )
r   r*  r~   r   rd  r   r   r^  r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   !shuffle_dataset_v3_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r   r;   r<   r=   )r   r*  r~   r   rd  r   r   r^  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   shuffle_dataset_v3  s   



rz  zraw_ops.ShuffleDatasetV3c                 C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}|d u r:d}t|d	}t| t	j
} t|t	j}t|t	j}t|t	j}t|t	j}| ||||g}d|d
|d|d	|f}tjdd|||
|	d}t rtd||| |\}|S )Nrw  c                 S   r   r   r   r   r    r    r!   r"     r#   z5shuffle_dataset_v3_eager_fallback.<locals>.<listcomp>rx  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   Tr^  r   r   r   r   s   ShuffleDatasetV3rK   rL   rv  rk  )r   r*  r~   r   rd  r   r   r^  r   r   r   rG   rF   rA   r    r    r!   ry    sN   

ry  c                 C   r   )as  Creates a dataset that skips `count` elements from the `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    count: A `Tensor` of type `int64`.
      A scalar representing the number of elements from the `input_dataset`
      that should be skipped.  If count is -1, skips everything.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  SkipDatasetr   r   r   Nr   GExpected list for 'output_types' argument to 'skip_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   K  r#   z skip_dataset.<locals>.<listcomp>HExpected list for 'output_shapes' argument to 'skip_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   P  r#   r   rG  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   skip_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   rI  r    r    r!   skip_dataset$  sr   

r  zraw_ops.SkipDatasetc           
      C   r   )Nr|  c                 S   r   r   r   r   r    r    r!   r"   k  r#   z/skip_dataset_eager_fallback.<locals>.<listcomp>r}  c                 S   r   r%   r&   r'   r    r    r!   r"   p  r#   r   r   r   r   s   SkipDatasetrK   rL   r{  r   rK  r    r    r!   r~  f  r   r~  #TV_SparseTensorSliceDataset_Tvaluesindicesvaluesdense_shapec              
   C   s  t j pt  }|j}|jrRzt|d|| ||}|W S  tjy3 } zt	|| W Y d}~nd}~w tj
y<   Y nw z
t| ||||dW S  tjyQ   Y nw tjd| |||d\}}}	}
|
dd }t r|d|	df}|	j}td||| |\}|S )a  Creates a dataset that splits a SparseTensor into elements row-wise.

  Args:
    indices: A `Tensor` of type `int64`.
    values: A `Tensor`.
    dense_shape: A `Tensor` of type `int64`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  SparseTensorSliceDatasetNra   )r  r  r  r   Tvalues)r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   *sparse_tensor_slice_dataset_eager_fallbackr3   r8   r9   r   r:   Z_get_attr_typer<   r=   )r  r  r  r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   sparse_tensor_slice_dataset  sD   
r  z raw_ops.SparseTensorSliceDatasetc           	      C   s|   t |g|g \}\}t| tj} t|tj}| ||g}d|f}t jdd||||d}t  r9t d||| |\}|S )Nr  s   SparseTensorSliceDatasetrK   rL   r  )	r   Zargs_to_matching_eagerr/   r   r   r   r   r:   r=   )	r  r  r  r   r   Z_attr_TvaluesrG   rF   rA   r    r    r!   r    s   
r  c              
   C   "  t j pt  }|j}|jrUzt|d|| ||d|}|W S  tjy5 } zt	|| W Y d}~nd}~w tj
y>   Y nw zt| |||||dW S  tjyT   Y nw |du r[d}t|d}tjd| ||||d\}	}	}
}|dd }t rd|
df}|
j}td||| |\}|S )a  Creates a dataset that emits the records from one or more TFRecord files.

  Args:
    filenames: A `Tensor` of type `string`.
      A scalar or vector containing the name(s) of the file(s) to be
      read.
    compression_type: A `Tensor` of type `string`.
      A scalar containing either (i) the empty string (no
      compression), (ii) "ZLIB", or (iii) "GZIP".
    buffer_size: A `Tensor` of type `int64`.
      A scalar representing the number of bytes to buffer. A value of
      0 means no buffering will be performed.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  TFRecordDatasetr   Nr,  r   r&  r0  r*  r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1    tf_record_dataset_eager_fallbackr3   r   rn   r8   r9   r:   r;   r<   r=   r&  r0  r*  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   tf_record_dataset  sR   
r  zraw_ops.TFRecordDatasetc           	      C      |d u rd}t |d}t| tj} t|tj}t|tj}| ||g}d|f}t jdd||||d}t  rAt 	d||| |\}|S )Nr   r   s   TFRecordDatasetrK   rL   r  r/  	r&  r0  r*  r   r   r   rG   rF   rA   r    r    r!   r    "   

r  byte_offsetsc                 C   s(  t j pt  }|j}|jrWzt|d|| |||d|	}|W S  tjy6 }	 zt	|	| W Y d}	~	nd}	~	w tj
y?   Y nw zt| ||||||dW S  tjyV   Y nw |du r]d}t|d}tjd| |||||d\}
}
}}|dd }t rd|df}|j}td||| |\}|S )aF  Creates a dataset that emits the records from one or more TFRecord files.

  Args:
    filenames: A `Tensor` of type `string`.
      A scalar or vector containing the name(s) of the file(s) to be
      read.
    compression_type: A `Tensor` of type `string`.
      A scalar containing either (i) the empty string (no
      compression), (ii) "ZLIB", or (iii) "GZIP".
    buffer_size: A `Tensor` of type `int64`.
      A scalar representing the number of bytes to buffer. A value of
      0 means no buffering will be performed.
    byte_offsets: A `Tensor` of type `int64`.
      A scalar or vector containing the number of bytes for each file
      that will be skipped prior to reading.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  TFRecordDatasetV2r   Nr,  r   )r&  r0  r*  r  r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   #tf_record_dataset_v2_eager_fallbackr3   r   rn   r8   r9   r:   r;   r<   r=   )r&  r0  r*  r  r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   tf_record_dataset_v2  sT   
r  zraw_ops.TFRecordDatasetV2c           
      C   s   |d u rd}t |d}t| tj} t|tj}t|tj}t|tj}| |||g}d|f}t jdd||||d}	t  rIt 	d|||	 |	\}	|	S )Nr   r   s   TFRecordDatasetV2rK   rL   r  r/  )
r&  r0  r*  r  r   r   r   rG   rF   rA   r    r    r!   r  J  s$   
r  c                 C   r   )a  Creates a dataset that contains `count` elements from the `input_dataset`.

  Args:
    input_dataset: A `Tensor` of type `variant`.
    count: A `Tensor` of type `int64`.
      A scalar representing the number of elements from the `input_dataset`
      that should be taken. A value of `-1` indicates that all of `input_dataset`
      is taken.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  TakeDatasetr   r   r   Nr   GExpected list for 'output_types' argument to 'take_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   z take_dataset.<locals>.<listcomp>HExpected list for 'output_shapes' argument to 'take_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   rG  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   take_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   rI  r    r    r!   take_dataset]  sr   

r  zraw_ops.TakeDatasetc           
      C   r   )Nr  c                 S   r   r   r   r   r    r    r!   r"     r#   z/take_dataset_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   r   r   s   TakeDatasetrK   rL   r  r   rK  r    r    r!   r    r   r  c              
   C   sZ  t j pt  }|j}|jrTzt|d|| d|d|}|W S  tjy5 } zt	|| W Y d}~nd}~w tj
y>   Y nw z
t| ||||dW S  tjyS   Y nw t|ttfsatd| dd |D }|du rnd	}t|d}tjd| |||d
\}}}	}
|
dd }t rd|	dd|	dd|	df}|	j}td||| |\}|S )ax  Creates a dataset that emits `components` as a tuple of tensors once.

  Args:
    components: A list of `Tensor` objects.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  TensorDatasetr   r   Nr  JExpected list for 'output_shapes' argument to 'tensor_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   z"tensor_dataset.<locals>.<listcomp>r   )
componentsr   r   r   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   tensor_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r  r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   tensor_dataset  sb   

r  zraw_ops.TensorDatasetc           	      C   s   t |ttfstd| dd |D }|d u rd}t|d}t| |\}} t| }d|d|d|f}tjdd	||||d
}t rKt	d||| |\}|S )Nr  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   z1tensor_dataset_eager_fallback.<locals>.<listcomp>r   r   r  r   s   TensorDatasetrK   rL   r  rI  )	r  r   r   r   r   r  rG   rF   rA   r    r    r!   r    s0   
r  is_filesc                 C   s  t j pt  }|j}|jrZzt|d|| d|d|d|d|}|W S  tjy9 }	 zt	|	| W Y d}	~	nd}	~	w tj
yB   Y nw zt| ||||||dW S  tjyY   Y nw t|ttfsgtd| d	d
 |D }|du rtd}t|d}|du rd}t|d}|du rd}t|d}tjd| |||||d\}
}
}}|dd }t rd|dd|dd|dd|dd|df
}|j}td||| |\}|S )a  Creates a dataset that emits each dim-0 slice of `components` once.

  Args:
    components: A list of `Tensor` objects.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    is_files: An optional `bool`. Defaults to `False`.
    metadata: An optional `string`. Defaults to `""`.
    replicate_on_split: An optional `bool`. Defaults to `False`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  TensorSliceDatasetr   r  r   r6  N)r   r  r   r6  r   r   PExpected list for 'output_shapes' argument to 'tensor_slice_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   1  r#   z(tensor_slice_dataset.<locals>.<listcomp>Fr   )r  r   r  r   r6  r   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   #tensor_slice_dataset_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r;   r   r<   r=   )r  r   r  r   r6  r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   tensor_slice_dataset
  s|   




r  zraw_ops.TensorSliceDatasetc              
   C   s   t |ttfstd| dd |D }|d u rd}t|d}|d u r&d}t|d}|d u r2d}t|d}t| |\}} t| }d	|d
|d|d|d|f
}	tjdd||	||d}
t	 rgt
d||	|
 |
\}
|
S )Nr  c                 S   r   r%   r&   r'   r    r    r!   r"   V  r#   z7tensor_slice_dataset_eager_fallback.<locals>.<listcomp>Fr  r   r   r6  r  r   s   TensorSliceDatasetrK   rL   r  )r4   r5   r6   r7   r   r   rn   r  r   r:   r=   )r  r   r  r   r6  r   r   r  rG   rF   rA   r    r    r!   r  Q  s>   

r  c              
   C   r  )ad  Creates a dataset that emits the lines of one or more text files.

  Args:
    filenames: A `Tensor` of type `string`.
      A scalar or a vector containing the name(s) of the file(s) to be
      read.
    compression_type: A `Tensor` of type `string`.
      A scalar containing either (i) the empty string (no
      compression), (ii) "ZLIB", or (iii) "GZIP".
    buffer_size: A `Tensor` of type `int64`.
      A scalar containing the number of bytes to buffer.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  TextLineDatasetr   Nr,  r   r  )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1    text_line_dataset_eager_fallbackr3   r   rn   r8   r9   r:   r;   r<   r=   r  r    r    r!   text_line_datasetn  sR   
r  zraw_ops.TextLineDatasetc           	      C   r  )Nr   r   s   TextLineDatasetrK   rL   r  r/  r  r    r    r!   r    r  r  input_handlec              
   C   rJ  )TODO: add doc.

  Args:
    input_handle: A `Tensor` of type `variant`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  UnwrapDatasetVariantNra   r  r   r    )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   %unwrap_dataset_variant_eager_fallbackr3   r8   r9   r   r:   r<   r=   r  r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   unwrap_dataset_variant  B   
r  zraw_ops.UnwrapDatasetVariantc                 C   rO  )Ns   UnwrapDatasetVariantrK   rL   r  rP  r  r   r   rG   rF   rA   r    r    r!   r    rQ  r  sizeshiftstridec	                 C   s  t j pt  }	|	j}
|
jr_zt|	d|| ||||d|d|d|}|W S  tjy; } zt	|| W Y d}~nd}~w tj
yD   Y nw zt| |||||||||	d
W S  tjy^   Y nw t|ttfsltd| dd	 |D }t|ttfstd
| dd	 |D }|du rd}t|d}tjd| ||||||||d
\}}}}|dd }t rd|dd|dd|df}|j}td||| |\}|S )a/    Combines (nests of) input elements into a dataset of (nests of) windows.

  A "window" is a finite dataset of flat elements of size `size` (or possibly
  fewer if there are not enough input elements to fill the window and
  `drop_remainder` evaluates to false).

  The `shift` argument determines the number of input elements by which
  the window moves on each iteration.  The first element in the `k`th window
  will be element

  ```
  1 + (k-1) * shift
  ```

  of the input dataset. In particular, the first element of the first window
  will always be the first element of the input dataset.  

  If the `stride` parameter is greater than 1, then each window will skip
  `(stride - 1)` input elements between each element that appears in the
  window. Output windows will still contain `size` elements regardless of
  the value of `stride`.

  The `stride` argument determines the stride of the input elements, and the
  `shift` argument determines the shift of the window.

  For example, letting `{...}` to represent a Dataset:

  - `tf.data.Dataset.range(7).window(2)` produces
    `{{0, 1}, {2, 3}, {4, 5}, {6}}`
  - `tf.data.Dataset.range(7).window(3, 2, 1, True)` produces
    `{{0, 1, 2}, {2, 3, 4}, {4, 5, 6}}`
  - `tf.data.Dataset.range(7).window(3, 1, 2, True)` produces
    `{{0, 2, 4}, {1, 3, 5}, {2, 4, 6}}`

  Note that when the `window` transformation is applied to a dataset of
  nested elements, it produces a dataset of nested windows.

  For example:

  - `tf.data.Dataset.from_tensor_slices((range(4), range(4))).window(2)`
    produces `{({0, 1}, {0, 1}), ({2, 3}, {2, 3})}`
  - `tf.data.Dataset.from_tensor_slices({"a": range(4)}).window(2)`
    produces `{{"a": {0, 1}}, {"a": {2, 3}}}`

  Args:
    input_dataset: A `Tensor` of type `variant`.
    size: A `Tensor` of type `int64`.
      An integer scalar, representing the number of elements
      of the input dataset to combine into a window. Must be positive.
    shift: A `Tensor` of type `int64`.
      An integer scalar, representing the number of input elements
      by which the window moves in each iteration.  Defaults to `size`.
      Must be positive.
    stride: A `Tensor` of type `int64`.
      An integer scalar, representing the stride of the input elements
      in the sliding window. Must be positive. The default value of 1 means
      "retain every input element".
    drop_remainder: A `Tensor` of type `bool`.
      A Boolean scalar, representing whether the last window should be
      dropped if its size is smaller than `window_size`.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  WindowDatasetr   r   r   Nr   IExpected list for 'output_types' argument to 'window_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   M  r#   z"window_dataset.<locals>.<listcomp>JExpected list for 'output_shapes' argument to 'window_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   R  r#   r   )	r   r  r  r  r   r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   window_dataset_eager_fallbackr3   r4   r5   r6   r7   r   rn   r8   r9   r:   r;   r<   r=   )r   r  r  r  r   r   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   window_dataset  sz   E

r  zraw_ops.WindowDatasetc
                 C   s  t |ttfstd| dd |D }t |ttfs!td| dd |D }|d u r.d}t|d}t| tj	} t|tj
}t|tj
}t|tj
}t|tj}| ||||g}
d|d	|d|f}tjd
d|
||	|d}t r}td|
|| |\}|S )Nr  c                 S   r   r   r   r   r    r    r!   r"   o  r#   z1window_dataset_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"   t  r#   r   r   r   r   s   WindowDatasetrK   rL   r  )r4   r5   r6   r7   r   rn   r/   r   r   r   r   r   r   r:   r=   )r   r  r  r  r   r   r   r   r   r   rG   rF   rA   r    r    r!   r  j  sF   
r  c              
   C   sj  t j pt  }|j}|jrTzt|d|| d|d|}|W S  tjy5 } zt	|| W Y d}~nd}~w tj
y>   Y nw z
t| ||||dW S  tjyS   Y nw t|ttfsatd| dd |D }t|ttfsutd	| d
d |D }tjd| |||d\}}}	}
|
dd }t rd|	dd|	dd|	df}|	j}td||| |\}|S )aG  TODO: add doc.

  Args:
    inputs: A list of `Tensor` objects.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  WindowOpr   r   Nr   DExpected list for 'output_types' argument to 'window_op' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"     r#   zwindow_op.<locals>.<listcomp>EExpected list for 'output_shapes' argument to 'window_op' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"     r#   )r<   r   r   r   Tinputs)r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   window_op_eager_fallbackr3   r4   r5   r6   r7   r8   r9   r   r:   r;   r<   r=   )r<   r   r   r   r?   r@   rA   rB   rC   rD   rE   rF   rG   r    r    r!   	window_op  sj   
r  zraw_ops.WindowOpc           	      C   s   t |ttfstd| dd |D }t |ttfs!td| dd |D }t| |\}} t| }d|d|d|f}tjd	d
||||d}t rStd||| |\}|S )Nr  c                 S   r   r   r   r   r    r    r!   r"     r#   z,window_op_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"     r#   r   r   r  s   WindowOprK   rL   r  )	r4   r5   r6   r7   r   r  r   r:   r=   )	r<   r   r   r   r   Z_attr_TinputsrG   rF   rA   r    r    r!   r    s8   
r  c              
   C   rJ  )r  WrapDatasetVariantNra   r  r    )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   #wrap_dataset_variant_eager_fallbackr3   r8   r9   r   r:   r<   r=   r  r    r    r!   wrap_dataset_variant  r  r  zraw_ops.WrapDatasetVariantc                 C   rO  )Ns   WrapDatasetVariantrK   rL   r  rP  r  r    r    r!   r     rQ  r  input_datasetsc                 C   s  t j pt  }|j}|jrWzt|d|| d|d|d|
}|W S  tjy7 } zt	|| W Y d}~nd}~w tj
y@   Y nw zt| |||||dW S  tjyV   Y nw t| ttfsdtd|  t| }	t|ttfsutd| d	d
 |D }t|ttfstd| dd
 |D }|du rd}t|d}tjd| ||||d\}
}
}}|dd }t rd|dd|dd|dd|df}|j}td||| |\}|S )a3  Creates a dataset that zips together `input_datasets`.

  The elements of the resulting dataset are created by zipping corresponding
  elements from each of the input datasets.

  The size of the resulting dataset will match the size of the smallest input
  dataset, and no error will be raised if input datasets have different sizes.

  Args:
    input_datasets: A list of at least 1 `Tensor` objects with type `variant`.
      List of `N` variant Tensors representing datasets to be zipped together.
    output_types: A list of `tf.DTypes` that has length `>= 1`.
    output_shapes: A list of shapes (each a `tf.TensorShape` or list of `ints`) that has length `>= 1`.
    metadata: An optional `string`. Defaults to `""`.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `variant`.
  
ZipDatasetr   r   r   Nr   HExpected list for 'input_datasets' argument to 'zip_dataset' Op, not %r.FExpected list for 'output_types' argument to 'zip_dataset' Op, not %r.c                 S   r   r   r   r   r    r    r!   r"   A   r#   zzip_dataset.<locals>.<listcomp>GExpected list for 'output_shapes' argument to 'zip_dataset' Op, not %r.c                 S   r   r%   r&   r'   r    r    r!   r"   F   r#   r   )r  r   r   r   r   r   )r)   r   r*   r+   r   r,   r-   r.   r/   r0   r1   zip_dataset_eager_fallbackr3   r4   r5   r6   r7   r   r   rn   r8   r9   r:   r;   r   r<   r=   )r  r   r   r   r   r?   r@   rA   rB   r   rC   rD   rE   rF   rG   r    r    r!   zip_dataset   s   


r  zraw_ops.ZipDatasetc           
      C   s   t | ttfstd|  t| }t |ttfstd| dd |D }t |ttfs2td| dd |D }|d u r?d}t|d}t| t	j
} t| }d	|d
|d|d|f}tjdd||||d}	t rqtd|||	 |	\}	|	S )Nr  r  c                 S   r   r   r   r   r    r    r!   r"   f   r#   z.zip_dataset_eager_fallback.<locals>.<listcomp>r  c                 S   r   r%   r&   r'   r    r    r!   r"   k   r#   r   r   r   r   r   s
   ZipDatasetrK   rL   r  )r4   r5   r6   r7   r   r   rn   r/   r   r   r   r   r:   r=   )
r  r   r   r   r   r   r   rG   rF   rA   r    r    r!   r  \   sL   

r  )N)r   N)Fr   N)r   FN)FN)TFr   N)rK   N)r   r   r   N)r   r   N)Fr   r   N)r   r   N)TFFr   N)Tr   Fr   N)r   Tr   r   N)r   FN)Tr   N)r   N)Fr   FN(P  __doc__collectionsZtensorflow.pythonr   Ztensorflow.python.eagerr   r)   r   r-   r   r   Ztensorflow.python.frameworkr   r   Ztensorflow.security.fuzzing.pyr   Z_atypesr   Z_op_def_registryr	   r/   r
   r8   Z"tensorflow.python.util.deprecationr   Ztensorflow.python.utilr   	_dispatchZ tensorflow.python.util.tf_exportr   typingr   r   ZTensorFuzzingAnnotationResourcerH   Z	to_raw_opr   r2   
namedtuplerV   rY   rQ   rX   r_   r[   r^   rc   rf   r`   rd   rr   ru   rh   rs   r|   rw   r{   r   ZInt64r   r}   r   r   ZBoolr   r   r   ZVariantstrr   r   r   r   r   r   r   Stringr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   intr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r
  r  r	  r  r  r  r  r  r  r%  r!  r$  r.  r+  r-  r3  r1  r2  r:  r4  r9  rH  r;  rG  rM  rK  rL  rX  rT  rW  rd  r]  rb  rr  rl  rp  r{  rw  rz  r  r}  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r  r  ZInt32r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r%  r!  r$  r*  r&  r)  r2  r.  r1  r;  r7  r:  rB  r<  rA  rJ  rD  rH  rQ  rM  rP  rT  rR  rS  r\  rX  r[  rc  r_  rb  rj  re  ri  rp  rl  ro  ru  rq  rt  rz  rv  ry  r  r{  r~  ZBFloat16Z
Complex128Z	Complex64ZFloat16ZFloat32ZFloat64ZHalfZInt16ZInt8ZQInt16ZQInt32ZQInt8ZQUInt16ZQUInt8ZUInt16ZUInt32ZUInt64ZUInt8r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r    r    r    r!   <module>   s^   595)B>&+"2-.6@2FKB6 E2B@>6@2*1&4E*.;*>&"&"6*2& "&"&#"%%&8"*M&*@&Z=Vf8b*J&Q& '"BQ>">*@"*;"7&7"<*'&&>"*"&:S6$U<M8$!L".?&:D6D.@*)&&Y":J4V RP4"E0LJH\UX^#SZB%b>Z!mVZ$sVv$|rN&aJN(bJL(VHR&IN( U$<!@889600,RINh Xdv#PrZ%WVJ"CFhNd>#?:J)FH7DV;R>@:$5 0D,H6D.&*fxb 7.&*6H6