
    AVh{l                     b   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jH                  dddg      Z% eddd      Z& eddd      Z'dFde#e e!   ejP                  f   de#e e!   ejP                  f   de)de*de+de+de&d e'fd!Z,  ed"       ejZ                  e,            Z.de#e e!   ejP                  f   de#e e!   ejP                  f   de)de*de+de+de&d e'fd#Z/ ejH                  d$g d%      Z0 ed& Z1ejd                  ejf                   ed'      dFd(e#e!ejP                  f   d)e#e!e1f   d*e#e!ejP                  f   d+e#e!e1f   fd,                     Z4  ed-       ejZ                  e4            Z5e4jl                  jn                  Z8d(e#e!ejP                  f   d)e#e!e1f   d*e#e!ejP                  f   d+e#e!e1f   fd.Z9 ejH                  d/d0d1g      Z: ed2 Z;ejd                  ejf                   ed3      dFd4e#e!ejP                  f   d5e#e!e;f   fd6                     Z<  ed7       ejZ                  e<            Z=e<jl                  jn                  Z>d4e#e!ejP                  f   d5e#e!e;f   fd8Z? ejH                  d9d:d;g      Z@ ed< ZA ed=dd      ZB ed>dd      ZCdFd?e#e e!   eCf   d@e#e!eAf   dAe#e!eBf   dBe+fdCZD  edD       ejZ                  eD            ZEd?e#e e!   eCf   d@e#e!eAf   dAe#e!eBf   dBe+fdEZFy)GzUPython 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RaggedCrossoutput_valuesoutput_row_splitsTV_RaggedCross_out_values_type_atypes.Int64_atypes.String"TV_RaggedCross_out_row_splits_type_atypes.Int32sparse_indicessparse_shapeinput_orderhashed_outputnum_bucketshash_keyout_values_typeout_row_splits_typec                 j   t         j                   xs t        j                         }|j                  }|j                  rA	 t	        j
                  |d|| |||||d|d|d|d|	d|
d|      }t        j                  |      }|S t        |t         t"        f      st%        d
|z        t'        |      }t        |t         t"        f      st%        d|z        t'        |      |k7  rt)        dt'        |      |fz        t+        j,                  |d      }t+        j.                  |d      }t+        j0                  |d      }t+        j0                  |	d      }	t+        j2                  |
d      }
t+        j2                  |d      }t5        j6                  d| |||||||||	|
||      \  }}}}|dd }t+        j8                         rd|j;                  d      d|j=                  d      d|j?                  d      d|j;                  d      d|j;                  d      d|j=                  d      d|j=                  d      d|j=                  d      d|j=                  d      d|jA                  d      d|jA                  d      f}|jB                  }t+        jD                  d|||       t        j                  |      }|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)a  Generates a feature cross from a list of tensors, and returns it as a
RaggedTensor.  See `tf.ragged.cross` for more details.

  Args:
    ragged_values: A list of `Tensor` objects with types from: `int64`, `string`.
      The values tensor for each RaggedTensor input.
    ragged_row_splits: A list of `Tensor` objects with types from: `int32`, `int64`.
      The row_splits tensor for each RaggedTensor input.
    sparse_indices: A list of `Tensor` objects with type `int64`.
      The indices tensor for each SparseTensor input.
    sparse_values: A list of `Tensor` objects with types from: `int64`, `string`.
      The values tensor for each SparseTensor input.
    sparse_shape: A list with the same length as `sparse_indices` of `Tensor` objects with type `int64`.
      The dense_shape tensor for each SparseTensor input.
    dense_inputs: A list of `Tensor` objects with types from: `int64`, `string`.
      The tf.Tensor inputs.
    input_order: A `string`.
      String specifying the tensor type for each input.  The `i`th character in
      this string specifies the type of the `i`th input, and is one of: 'R' (ragged),
      'D' (dense), or 'S' (sparse).  This attr is used to ensure that the crossed
      values are combined in the order of the inputs from the call to tf.ragged.cross.
    hashed_output: A `bool`.
    num_buckets: An `int` that is `>= 0`.
    hash_key: An `int`.
    out_values_type: A `tf.DType` from: `tf.int64, tf.string`.
    out_row_splits_type: A `tf.DType` from: `tf.int32, tf.int64`.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (output_values, output_row_splits).

    output_values: A `Tensor` of type `out_values_type`.
    output_row_splits: A `Tensor` of type `out_row_splits_type`.
  r   r   r   r   r    r!   r"   N)r   r   r   r    r!   r"   namectxIExpected list for 'sparse_indices' argument to 'ragged_cross' Op, not %r.GExpected list for 'sparse_shape' argument to 'ragged_cross' Op, not %r.sList argument 'sparse_shape' to 'ragged_cross' Op with length %d must match length %d of argument 'sparse_indices'.)ragged_valuesragged_row_splitsr   sparse_valuesr   dense_inputsr   r   r   r    r!   r"   r$   Nsparseragged_values_typesragged_splits_typessparse_values_typesdense_types)#_contextr   _thread_local_datais_eagerr   TFE_Py_FastPathExecute_RaggedCrossOutput_make_core_NotOkStatusException_opsraise_from_not_ok_status_FallbackExceptionragged_cross_eager_fallback_SymbolicException
isinstancelisttuple	TypeErrorlen
ValueError_executemake_str	make_boolmake_int	make_type_op_def_library_apply_op_helpermust_record_gradient_get_attr_intget_attr_get_attr_bool_get_attr_typeinputsrecord_gradient)r)   r*   r   r+   r   r,   r   r   r   r    r!   r"   r$   _ctxtld_resulte_attr_Nsparse__op_outputs_attrs_inputs_flats                          Z/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/ops/gen_ragged_array_ops.pyragged_crossr^       sc   F 
			0h..0$#\\11mT=2C|\{O]{J:K.0CEg #((1gn 
NT5M	2
	%'5	67 7 n%-	L4-	0
	%'3	45 5 	-'
	=	\	M*	+, , !!+}=+$$]OD-!!+}=+x4(&&8IJ/ **+>@UV'88]):&4%2$0k%2 (/+>TK!QX QK'""$**95}ll=)?  1=.

+-Bll013Hll013Hll01=ll=)+<  !235J  !67
9F ::L|VW6$$W-'	.y && -
##At,,## 
(
*NM
+%;_1$H H ## 
s0    ?J7 7K>
K%%K>=K>L L21L2zraw_ops.RaggedCrossc                    t        |t        t        f      st        d|z        t	        |      }t        |t        t        f      st        d|z        t	        |      |k7  rt        dt	        |      |fz        t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |	d      }	t        j                  |
d      }
t        j                  |d	      }t        j                  | |      \  }} t        j                  ||      \  }}t        j                  ||      \  }}t        j                  ||      \  }}t        j                  |t        j                        }t        j                  |t        j                        }t        |       t        |      z   t        |      z   t        |      z   t        |      z   t        |      z   }d
|d|d|d|d|	d|d|d|d|d|
d	|f}t        j                   dd||||      }t        j"                         rt        j$                  d|||       t&        j)                  |      }|S )Nr&   r'   r(   r   r   r   r    r!   r"   r-   r.   r/   r0   r1   s   RaggedCross   rQ   attrsr%   r$   r   )r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   rI   convert_to_mixed_eager_tensorsr:   convert_n_to_tensor_dtypesint64r   rL   rR   r6   r7   )r)   r*   r   r+   r   r,   r   r   r   r    r!   r"   r$   r%   rW   _attr_ragged_values_types_attr_ragged_splits_types_attr_sparse_values_types_attr_dense_typesr\   r[   rU   s                         r]   r=   r=      s   	NT5M	2
	%'5	67 7 n%-	L4-	0
	%'3	45 5 	-'
	=	\	M*	+, , !!+}=+$$]OD-!!+}=+x4(&&8IJ/ **+>@UV-5-T-TUbdg-h*]191X1XYjlo1p..-5-T-TUbdg-h*]$,$K$KLZ]$^!\++NGMMJ.)),F,m$t,='>>nAUUX\]jXkknrs  oA  A  DH  IU  DV  V,}m[=-j
!#<24I],=_&;& ^Q|#)s?'""$|VW6$$W-'	.    RaggedFillEmptyRows)output_value_rowidsr   empty_row_indicatorreverse_index_map) TV_RaggedFillEmptyRows_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.Int16r   _atypes.Int4r   _atypes.Int8_atypes.QInt16_atypes.QInt32_atypes.QInt8_atypes.QUInt16_atypes.QUInt8_atypes.Resourcer   _atypes.UInt16_atypes.UInt32_atypes.UInt4_atypes.UInt64_atypes.UInt8_atypes.Variantragged_fill_empty_rowsvalue_rowidsvaluesnrowsdefault_valuec                    t         j                   xs t        j                         }|j                  }|j                  r3	 t	        j
                  |d|| |||      }t        j                  |      }|S t        | ||||fd      }|t        ur|S 	 t3        j4                  d| ||||      \  }	}	}
}|dd }t7        j8                         r7d|
j;                  d      f}|
j<                  }t7        j>                  d|||       t        j                  |      }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||||fd      }|t        ur|S t        | |||||      S # t        j                   $ r Y t"        t$        f$ rK t'        j(                  t*        dt-        | ||||            }|t&        j.                  j0                  ur|cY S  w xY w# t"        t$        f$ rK t'        j(                  t*        dt-        | ||||            }|t&        j.                  j0                  ur|cY S  w xY w)aO  TODO: add doc.

  Args:
    value_rowids: A `Tensor` of type `int64`.
    values: A `Tensor`.
    nrows: A `Tensor` of type `int64`.
    default_value: A `Tensor`. Must have the same type as `values`.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (output_value_rowids, output_values, empty_row_indicator, reverse_index_map).

    output_value_rowids: A `Tensor` of type `int64`.
    output_values: A `Tensor`. Has the same type as `values`.
    empty_row_indicator: A `Tensor` of type `bool`.
    reverse_index_map: A `Tensor` of type `int64`.
  rl   Nr$   r%    )r   r   r   r   r$   T) r2   r   r3   r4   r   r5   _RaggedFillEmptyRowsOutputr7   r8   r9   r:   r;   r<   &_dispatcher_for_ragged_fill_empty_rowsNotImplemented%ragged_fill_empty_rows_eager_fallbackr>   rB   rD   	_dispatchr   r   dictOpDispatcherNOT_SUPPORTEDrJ   rK   rE   rL   rP   rQ   rR   )r   r   r   r   r$   rS   rT   rU   rV   rX   rY   rZ   r[   r\   s                 r]   r   r      sr   * 
			0h..0$#\\	11#T<g +009gn2 5	vumT;TCGn$n
)::L%*-$(*Aq#x QK'""$3%%c*+F::L|VW>&,,W5'	.g && -
##At,,## 
6t
=tEg		&2
}4TK K## 
z" 	"""B,4:%;H26)8g 
	..<<	<	* Z	  	
  
 "d289F04'6
G i,,:::n		
sP    1D  G> E(EEE F ;F G;"AG;9G;>AIIzraw_ops.RaggedFillEmptyRowsc                    t        j                  ||g|g       \  }}|\  }}t        j                  | t        j
                        } t        j                  |t        j
                        }| |||g}d|f}	t        j                  dd||	||      }
t        j                         rt        j                  d||	|
       t        j                  |
      }
|
S )Nr   s   RaggedFillEmptyRows   ra   rl   )rE   args_to_matching_eagerr:   convert_to_tensorre   rf   r   rL   rR   r   r7   )r   r   r   r   r$   r%   _attr_T	_inputs_Tr\   r[   rU   s              r]   r   r     s    667NPSUWX'9%6=''gmmD,

 
 
6%}=,>&3Q|#)s?'""$|VW>&,,W5'	.rk   RaggedFillEmptyRowsGradd_valuesd_default_value) TV_RaggedFillEmptyRowsGrad_Trq   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   r|   r}   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   ragged_fill_empty_rows_gradro   grad_valuesc           
         t         j                   xs t        j                         }|j                  }|j                  r1	 t	        j
                  |d|| |      }t        j                  |      }|S t        | ||fd      }|t        ur|S 	 t3        j4                  d| ||      \  }}}}	|	dd }t7        j8                         r7d|j;                  d      f}
|j<                  }t7        j>                  d||
|       t        j                  |      }|S # t        j                  $ r }t        j                  ||       Y d}~nd}~wt        j                  $ r Y nw xY w	 t        | ||fd      }|t        ur|S t        | |||      S # t        j                   $ r Y t"        t$        f$ rI t'        j(                  t*        dt-        | ||            }|t&        j.                  j0                  ur|cY S  w xY w# t"        t$        f$ rI t'        j(                  t*        dt-        | ||            }|t&        j.                  j0                  ur|cY S  w xY w)af  TODO: add doc.

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

  Returns:
    A tuple of `Tensor` objects (d_values, d_default_value).

    d_values: A `Tensor`. Has the same type as `grad_values`.
    d_default_value: A `Tensor`. Has the same type as `grad_values`.
  r   Nr   r   )ro   r   r$   r   ) r2   r   r3   r4   r   r5   _RaggedFillEmptyRowsGradOutputr7   r8   r9   r:   r;   r<   +_dispatcher_for_ragged_fill_empty_rows_gradr   *ragged_fill_empty_rows_grad_eager_fallbackr>   rB   rD   r   r   r   r   r   r   rJ   rK   rE   rL   rP   rQ   rR   )ro   r   r$   rS   rT   rU   rV   rX   rY   rZ   r[   r\   s               r]   r   r   /  sS   " 
			0h..0$#\\11'/@+Og.44W=gn0 :	K/7Gn$n
)::!5F/:GAq#x QK'""$3%%c*+F::L!<B*009'	.a && -
##At,,## 
;k4
149g		&7
[t? ?## 
z" ""'TDU>I7;.=g
 
	..<<	<& Z	  
  
%r4BS<G59,;
G
 i,,:::n	
sP    /D 
G2 E"D==EEF 3F G/AG/-G/2AI
I
zraw_ops.RaggedFillEmptyRowsGradc                 P   t        j                  |g|g       \  }\  }t        j                  | t        j
                        } | |g}d|f}t        j                  dd||||      }t        j                         rt        j                  d|||       t        j                  |      }|S )Nr   s   RaggedFillEmptyRowsGradr`   ra   r   )rE   r   r:   r   re   rf   r   rL   rR   r   r7   )ro   r   r$   r%   r   r\   r[   rU   s           r]   r   r   ~  s    $;;[M3PRS'>K,,->N#[1,>&7$0C"&(' ""$!<B*009'	.rk   RaggedGatheroutput_nested_splitsoutput_dense_values) TV_RaggedGather_Tvaluesrq   rr   rs   rt   ru   rv   rw   rx   ry   rz   r{   r|   r}   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   TV_RaggedGather_TindicesTV_RaggedGather_Tsplitsparams_nested_splitsparams_dense_valuesindicesOUTPUT_RAGGED_RANKc                 
   t         j                   xs t        j                         }|j                  }|j                  r4	 t	        j
                  |d|| ||d|      }t        j                  |      }|S t        | t         t"        f      st%        d| z        t'        |       }	t)        j*                  |d      }t-        j.                  d| ||||      \  }
}
}}|dd }t)        j0                         r{d|j3                  d      d|j3                  d      d	|j3                  d	      d
|j5                  d
      d|j5                  d      f
}|j6                  }t)        j8                  d|||       |d| g||d z   }t        j                  |      }|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)aD  Gather ragged slices from `params` axis `0` according to `indices`.

  Outputs a `RaggedTensor` output composed from `output_dense_values` and
  `output_nested_splits`, such that:

  ```python
  output.shape = indices.shape + params.shape[1:]
  output.ragged_rank = indices.shape.ndims + params.ragged_rank
  output[i...j, d0...dn] = params[indices[i...j], d0...dn]
  ```

  where

  * `params =
     ragged.from_nested_row_splits(params_dense_values, params_nested_splits)`
     provides the values that should be gathered.
  * `indices` ia a dense tensor with dtype `int32` or `int64`, indicating which
     values should be gathered.
  * `output =
     ragged.from_nested_row_splits(output_dense_values, output_nested_splits)`
     is the output tensor.

  (Note: This c++ op is used to implement the higher-level python
  `tf.ragged.gather` op, which also supports ragged indices.)

  Args:
    params_nested_splits: A list of at least 1 `Tensor` objects with the same type in: `int32`, `int64`.
      The `nested_row_splits` tensors that define the row-partitioning for the
      `params` RaggedTensor input.
    params_dense_values: A `Tensor`.
      The `flat_values` for the `params` RaggedTensor. There was a terminology change
      at the python level from dense_values to flat_values, so dense_values is the
      deprecated name.
    indices: A `Tensor`. Must be one of the following types: `int32`, `int64`.
      Indices in the outermost dimension of `params` of the values that should be
      gathered.
    OUTPUT_RAGGED_RANK: An `int` that is `>= 0`.
      The ragged rank of the output RaggedTensor. `output_nested_splits` will contain
      this number of `row_splits` tensors. This value should equal
      `indices.shape.ndims + params.ragged_rank - 1`.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (output_nested_splits, output_dense_values).

    output_nested_splits: A list of `OUTPUT_RAGGED_RANK` `Tensor` objects with the same type as `params_nested_splits`.
    output_dense_values: A `Tensor`. Has the same type as `params_dense_values`.
  r   r   N)r   r$   r%   PExpected list for 'params_nested_splits' argument to 'ragged_gather' Op, not %r.)r   r   r   r   r$   TvaluesTindicesTsplitsPARAMS_RAGGED_RANK)r2   r   r3   r4   r   r5   _RaggedGatherOutputr7   r8   r9   r:   r;   r<   ragged_gather_eager_fallbackr>   r?   r@   rA   rB   rC   rE   rH   rJ   rK   rL   rP   rM   rQ   rR   )r   r   r   r   r$   rS   rT   rU   rV   _attr_PARAMS_RAGGED_RANKrX   rY   rZ   r[   r\   s                  r]   ragged_gatherr     s-   b 
			0h..0$#\\	11nd$8:M%'9;g $))'2gn 
(4-	8
	&(<	=> > !!56(();=QR'88-A,? '+=D	J!QX
 QK'""$++I6
  ,i  +-A 457K 45	7F
 ::Lfg7(()*W5G5H-II'%%g.'	.E && -
##At,,## 
)
 3W/dF F ## 
s0    2F G"F==GGG+ +HHzraw_ops.RaggedGatherc           
         t        | t        t        f      st        d| z        t	        |       }t        j                  |d      }t        j                  |g|g       \  }\  }t        j                  |g|t        j                  t        j                  g      \  }\  }t        j                  t        |       |t        j                  t        j                  gt        j                        \  }	} t        |       ||gz   }
d|d|d|	d|d|f
}t        j                  d|dz   |
|||	      }t        j                         rt        j                  d
|
||       |d | g||d  z   }t        j                  |      }|S )Nr   r   r   r   r   r   s   RaggedGather   ra   r   )r?   r@   rA   rB   rC   rE   rH   r   re   int32rf   r   rL   rR   r   r7   )r   r   r   r   r$   r%   r   _attr_Tvalues_attr_Tindices_attr_Tsplitsr\   r[   rU   s                r]   r   r     s   	(4-	8
	&(<	=> > !!56(();=QR*2*I*IK^J_adfh*i'-'%'>>y#PWP]P]_f_l_lOop.*7(0(G(GMaHbdgjqjwjw  zA  zG  zG  jJ  LS  LY  LY  )Z%-%*+/BG.LL,}j.)%'?*,& _.@1.D$0C"&(' ""$fg7(()*W5G5H-II'%%g.'	.rk   )N)G__doc__collectionstensorflow.pythonr   tensorflow.python.eagerr   r2   r   r8   r   rE   tensorflow.python.frameworkr   re   tensorflow.security.fuzzing.pyr   _atypesr	   _op_def_registryr
   r:   r   rJ   "tensorflow.python.util.deprecationr   tensorflow.python.utilr   r    tensorflow.python.util.tf_exportr   typingr   r   r   typing_extensionsr   
namedtupler6   r   r   Int64strboolintr^   	to_raw_opr   r=   r   rp   add_fallback_dispatch_listadd_type_based_api_dispatcherr   rl   _tf_type_based_dispatcherDispatchr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rk   r]   <module>r      s)  
  6 7 1 7 9 F K 3 I C 8 6 % % '+[++)*, 
 "))I?\l!m %,-QSbds%t "k9TRUYX_XeXeMeCf k  FO  PT  UX  PY  [b  [h  [h  Ph  Fi k  FI k  Z^ k  mp k  | k  Rp k  Gi kZ /i-.~t~~l/KL)R[\`ad\egngtgt\tRu )  U^  _c  dg  _h  jq  jw  jw  _w  Ux )  UX )  im )  | )  KN )  a )  Vx )V 4[33XZ 
 #  T
 
%%
((
#$N33E)F NPYZ]_wZwPx N  BK  LO  QX  Q^  Q^  L^  B_ N  py  z}  W  zW  pX N % ) &N` ?i =>~t~~Nd?ef )?)Y)Y)b)b &	#w}}BT8U _hil  oG  jG  `H   QZ  [^  `g  `m  `m  [m  Qn   H  IL  Nf  If  g  "8!7!7"#"% 
  '   \
 
%%
((
()F9S'--=O3P F_hil  oK  jK  `L F * ) &FP G)$EF~t~~VqGrs .I.c.c.l.l +)CQXQ^Q^L^B_ nwx{  ~Z  yZ  o[  -k,,235 
 "  R
 "#=P_` !";_o^ \	$s)=T2T(U \luvy  |S  wS  mT \  _h  il  nF  iF  _G \  ]` \| 1y/01NOycLcAc7d   |E  FI  Kb  Fb  |c   nw  x{  }U  xU  nV   lo rk   