
    AVh~D              	          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 m!Z! ddl"m#Z#  ed Z$d&de#e e!   e$f   de%de#e!e$f   fdZ&  ed       ejN                  e&            Z(de#e e!   e$f   de%de#e!e$f   fdZ) ed Z*d'de#e e!   e*f   de+de#e!e*f   fdZ,  ed       ejN                  e,            Z-de#e e!   e*f   de+de#e!e*f   fdZ. ed Z/d&de#e!e/f   de%de%fdZ0  ed        ejN                  e0            Z1de#e!e/f   de%de%fd!Z2 ed" Z3d(de#e!e3f   de%fd#Z4  ed$       ejN                  e4            Z5de#e!e3f   de%fd%Z6y))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Any)	Annotated) TV_TPUPartitionedInput_T_atypes.BFloat16_atypes.Bool_atypes.Complex128_atypes.Complex64_atypes.Float16_atypes.Float32_atypes.Float64_atypes.Float8e4m3b11fnuz_atypes.Float8e4m3fn_atypes.Float8e4m3fnuz_atypes.Float8e5m2_atypes.Float8e5m2fnuz_atypes.Half_atypes.Int16_atypes.Int32_atypes.Int4_atypes.Int64_atypes.Int8_atypes.QInt16_atypes.QInt32_atypes.QInt8_atypes.QUInt16_atypes.QUInt8_atypes.Resource_atypes.String_atypes.UInt16_atypes.UInt32_atypes.UInt4_atypes.UInt64_atypes.UInt8_atypes.Variantinputspartition_dimreturnc                 ^   t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| d|      }|S t        | t        t        f      st!        d| z        t#        |       }|d}t%        j&                  |d      }t)        j*                  d| ||      \  }}}	}
|
dd }t%        j,                         rYd|	j/                  d      d	|	j1                  d	      d|	j/                  d      f}|	j2                  }t%        j4                  d|||       |\  }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | |||      S # t        j                  $ r Y Ow xY w)
a  An op that groups a list of partitioned inputs together. This op

  Args:
    inputs: A list of at least 1 `Tensor` objects with the same type.
      A list of partitioned inputs which must have the same shape.
    partition_dim: An optional `int`. Defaults to `0`.
      An integer describles which dimension is partitioned. -1 means
      those inputs are replicated.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `inputs`.
  TPUPartitionedInputr4   N)r4   namectxJExpected list for 'inputs' argument to 'tpu_partitioned_input' Op, not %r.r   )r3   r4   r8   NT)_contextr   _thread_local_datais_eagerr   TFE_Py_FastPathExecute_core_NotOkStatusException_opsraise_from_not_ok_status_FallbackException$tpu_partitioned_input_eager_fallback_SymbolicException
isinstancelisttuple	TypeErrorlen_executemake_int_op_def_library_apply_op_helpermust_record_gradient_get_attr_int_get_attr_typer3   record_gradient)r3   r4   r8   _ctxtld_resulte_attr_N__op_outputs_attrs_inputs_flats                [/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/ops/gen_tpu_partition_ops.pytpu_partitioned_inputr`      s    
			0h..0$#\\11#T6?g n 
FT5M	*
	.06	78 8 K'M##M?C-'88fM$(*!QX QK'""$3$$S)30B0B30Gs00ACF::L|VW>('	.; && -
##At,,## 
1
DdD D## 
s0    D; ;FE))FFF F,+F,zraw_ops.TPUPartitionedInputc                    t        | t        t        f      st        d| z        t	        |       }|d}t        j                  |d      }t        j                  t        |       |g       \  }} t        |       }d|d|d|f}t        j                  dd||||      }t        j                         rt        j                  d	|||       |\  }|S )
Nr:   r   r4   r;   r<   s   TPUPartitionedInput   r3   attrsr9   r8   r7   )rH   rI   rJ   rK   rL   rM   rN   args_to_matching_eagerr   rQ   rT   )	r3   r4   r8   r9   rY   _attr_Tr^   r]   rW   s	            r_   rF   rF   S   s    	FT5M	*
	.06	78 8 K'M##M?C-33DL#rJ/'6f,#wG&3Q|#)s?'""$|VW>('	.    ) TV_TPUPartitionedInputV2_Tr   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   r2   	is_packedc           
          t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| d|d|      }|S t        | t        t        f      st!        d| z        t#        |       }t        |t        t        f      st!        d|z        |D 	cg c]  }	t%        j&                  |	d       }}	|d}t%        j(                  |d      }t+        j,                  d| |||	      \  }
}
}}|dd }t%        j.                         rjd
|j1                  d
      d|j3                  d      d|j5                  d      d|j7                  d      f}|j8                  }t%        j:                  d|||       |\  }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||      S # t        j                  $ r Y w xY wc c}	w )a_  An op that groups a list of partitioned inputs together. Supports ND sharding.

  Args:
    inputs: A list of at least 1 `Tensor` objects with the same type.
      A list of partitioned inputs which must have the same shape.
    partition_dims: A list of `ints`.
      A list of integers describing how each dimension is partitioned. Emptiness
      indicates the inputs are replicated.
    is_packed: An optional `bool`. Defaults to `False`.
      Indicates whether the input is a packed resource.
    name: A name for the operation (optional).

  Returns:
    A `Tensor`. Has the same type as `inputs`.
  TPUPartitionedInputV2partition_dimsri   N)rl   ri   r8   r9   MExpected list for 'inputs' argument to 'tpu_partitioned_input_v2' Op, not %r.UExpected list for 'partition_dims' argument to 'tpu_partitioned_input_v2' Op, not %r.F)r3   rl   ri   r8   r;   r<   )r=   r   r>   r?   r   r@   rA   rB   rC   rD   rE   'tpu_partitioned_input_v2_eager_fallbackrG   rH   rI   rJ   rK   rL   rM   rN   	make_boolrO   rP   rQ   rR   rS   get_attr_get_attr_boolr3   rT   )r3   rl   ri   r8   rU   rV   rW   rX   rY   _irZ   r[   r\   r]   r^   s                  r_   tpu_partitioned_input_v2rt   j   s,     
			0h..0$#\\11%tV5EY0g n 
FT5M	*
	139	:; ; K'	NT5M	2
	13A	BC C GUUH%%b*:;U.UI  K8)'88~+44A!QX QK'""$3$$S)30B0B30G-= >  -/F ::Lvw@('	.I && -
##At,,## 
4
9  ## 
 Vs6    F 5HG)GGG!G1 1HHzraw_ops.TPUPartitionedInputV2c                 6   t        | t        t        f      st        d| z        t	        |       }t        |t        t        f      st        d|z        |D cg c]  }t        j                  |d       }}|d}t        j                  |d      }t        j                  t        |       |g       \  }} t        |       }d|d|d|d|f}	t        j                  dd	||	||
      }
t        j                         rt        j                  d||	|
       |
\  }
|
S c c}w )Nrm   rn   rl   Fri   r;   r<   s   TPUPartitionedInputV2rb   rc   rk   )rH   rI   rJ   rK   rL   rM   rN   rp   re   r   rQ   rT   )r3   rl   ri   r8   r9   rY   rs   rf   r^   r]   rW   s              r_   ro   ro      s5   	FT5M	*
	139	:; ; K'	NT5M	2
	13A	BC C GUUH%%b*:;U.UI  K8)33DL#rJ/'6f,#w(8.y&5q#)s?'""$vw@('	. Vs   D) TV_TPUPartitionedOutput_Tr   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   r2   
num_splitsc           
      ,   t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| d|d|      }|S t        j                  |d      }|d}t        j                  |d      }t        j                   d| |||      \  }}}	}
|
dd }t        j"                         rYd|	j%                  d      d|	j'                  d      d|	j'                  d      f}|	j(                  }t        j*                  d|||       |S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||      S # t        j                  $ r Y 4w xY w)	a  An op that demultiplexes a tensor to be sharded by XLA to a list of partitioned

  outputs outside the XLA computation.

  Args:
    inputs: A `Tensor`.
      A tensor which represents the full shape of partitioned tensors.
    num_splits: An `int` that is `>= 1`.
    partition_dim: An optional `int`. Defaults to `0`.
      An integer describles which dimension is partitioned.
    name: A name for the operation (optional).

  Returns:
    A list of `num_splits` `Tensor` objects with the same type as `inputs`.
  TPUPartitionedOutputrw   r4   N)rw   r4   r8   r9   r   )r3   rw   r4   r8   r<   )r=   r   r>   r?   r   r@   rA   rB   rC   rD   rE   %tpu_partitioned_output_eager_fallbackrG   rM   rN   rO   rP   rQ   rS   rR   r3   rT   )r3   rw   r4   r8   rU   rV   rW   rX   rZ   r[   r\   r]   r^   s                r_   tpu_partitioned_outputr{      s     
			0h..0$#\\11$dFL*(g n   \:*M##M?C-'88v*.;$H!QX QK'""$3%%c*L-02F ::Lfg?	.5 && -
##At,,## 
2
Z}  ## 
s0    D! !E(4EE('E(,E< <FFzraw_ops.TPUPartitionedOutputc                 D   t        j                  |d      }|d}t        j                  |d      }t        j                  | g|g       \  }\  } | g}d|d|d|f}t        j                  d|||||      }t        j                         rt        j
                  d|||       |S )Nrw   r   r4   r<   s   TPUPartitionedOutputrc   ry   )rM   rN   re   r   rQ   rT   )	r3   rw   r4   r8   r9   rf   r^   r]   rW   s	            r_   rz   rz      s      \:*M##M?C-66xbI'9F,,
O&4j$0C"&(' ""$fg?	.rg   ) TV_TPUPartitionedOutputV2_Tr   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   r2   c           
         t         j                   xs t        j                         }|j                  }|j                  r	 t	        j
                  |d|| d|d|      }|S t        j                  |d      }t        |t         t"        f      st%        d|z        |D cg c]  }t        j                  |d       }}t'        j(                  d| |||      \  }	}	}
}|dd }t        j*                         rYd|
j-                  d      d|
j/                  d      d|
j1                  d      f}|
j2                  }t        j4                  d|||       |S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||      S # t        j                  $ r Y aw xY wc c}w )	aJ  An op that demultiplexes a tensor to be sharded by XLA to a list of partitioned

  outputs outside the XLA computation. Supports ND sharding.

  Args:
    inputs: A `Tensor`.
      A tensor which represents the full shape of partitioned tensors.
    num_splits: An `int` that is `>= 1`.
    partition_dims: A list of `ints`.
      A list of integers describing how each dimension is partitioned. Emptiness
      indicates the inputs are replicated.
    name: A name for the operation (optional).

  Returns:
    A list of `num_splits` `Tensor` objects with the same type as `inputs`.
  TPUPartitionedOutputV2rw   rl   N)rw   rl   r8   r9   VExpected list for 'partition_dims' argument to 'tpu_partitioned_output_v2' Op, not %r.)r3   rw   rl   r8   r<   )r=   r   r>   r?   r   r@   rA   rB   rC   rD   rE   (tpu_partitioned_output_v2_eager_fallbackrG   rM   rN   rH   rI   rJ   rK   rO   rP   rQ   rS   rR   rq   r3   rT   )r3   rw   rl   r8   rU   rV   rW   rX   rs   rZ   r[   r\   r]   r^   s                 r_   tpu_partitioned_output_v2r     s   " 
			0h..0$#\\11&fl$n6g n   \:*	NT5M	2
	24B	CD D GUUH%%b*:;U.U'88 J1?dL!QX QK'""$3%%c*L-/?ll+,.F ::L ,A	.9 && -
##At,,## 
5
Z  ## 
 Vs6    E GF!E<<FFF) )G ?G zraw_ops.TPUPartitionedOutputV2c                    t        j                  |d      }t        |t        t        f      st        d|z        |D cg c]  }t        j                  |d       }}t        j                  | g|g       \  }\  } | g}d|d|d|f}t        j                  d|||||      }	t        j                         rt        j                  d|||	       |	S c c}w )Nrw   r   rl   r<   s   TPUPartitionedOutputV2rc   r   )
rM   rN   rH   rI   rJ   rK   re   r   rQ   rT   )
r3   rw   rl   r8   r9   rs   rf   r^   r]   rW   s
             r_   r   r   M  s      \:*	NT5M	2
	24B	CD D GUUH%%b*:;U.U66xbI'9F,,
4D&6
$0C"&(' ""$ ,A	. Vs   C)r   N)FN)N)7__doc__collectionstensorflow.pythonr   tensorflow.python.eagerr   r=   r   rA   r   rM   tensorflow.python.frameworkr   _dtypestensorflow.security.fuzzing.pyr   _atypesr	   _op_def_registryr
   rC   r   rO   "tensorflow.python.util.deprecationr   tensorflow.python.utilr   	_dispatch tensorflow.python.util.tf_exportr   typingr   r   r   typing_extensionsr   r   intr`   	to_raw_opr7   rF   rh   boolrt   rk   ro   rv   r{   ry   rz   r}   r   r   r    rg   r_   <module>r      s  
  6 7 1 7 9 F K 3 I C 8 6 % % '"  T
 3)DI7O,O"P 3`c 3u~  @C  E]  @]  v^ 3j ?i =>~t~~Nc?de 49F^;^1_ ps   DM  NQ  Sk  Nk  Dl * %  X
 <YtCy:T/T%U <qu <  LU  VY  [u  Vu  Lv <| C	"AB>4>>RjCkl Id3iIc>c4d   BF   V_  `c  e  `  V@ 6 $  V
 29S2K-K#L 2Z] 2mp 2h Ay!?@PfAgh )CAZ<Z2[ il   ~A $ &  Z
 5i5P0P&Q 5_b 5n E#CD^T^^TmEno YsD_?_5` nq rg   