
    AVh                        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g d      Z%d>de#e!ejL                  f   de'de'de(de'de'fdZ)  ed       ejT                  e)            Z+de#e!ejL                  f   de'de'de(de'de'fdZ, ejH                  dg d      Z-d>de#e!ejL                  f   de#e!ejL                  f   de'de'de'f
dZ.  ed        ejT                  e.            Z/de#e!ejL                  f   de#e!ejL                  f   de'de'de'f
d!Z0 ejH                  d"g d      Z1d#d$dd$dg dddf	de#e!ejL                  f   de'de'de(d%e'd&e2d'e3d(e'd)e'd*e'de'de'fd+Z4  ed,       ejT                  e4            Z5de#e!ejL                  f   de'de'de(d%e'd&e2d'e3d(e'd)e'd*e'de'de'fd-Z6 ejH                  d.g d      Z7d>de#e!ejL                  f   de'de'de(d%e'de'de'fd/Z8  ed0       ejT                  e8            Z9de#e!ejL                  f   de'de'de(d%e'de'de'fd1Z: ejH                  d2g d      Z;d>de#e!ejL                  f   de'de'de(d%e'de'de'fd3Z<  ed4       ejT                  e<            Z=de#e!ejL                  f   de'de'de(d%e'de'de'fd5Z> ejH                  d6g d      Z?d>de#e!ejL                  f   de'de'de(d%e'de'de'fd7Z@  ed8       ejT                  e@            ZAde#e!ejL                  f   de'de'de(d%e'de'de'fd9ZB ejH                  d:g d      ZCd>de#e!ejL                  f   de'de'de(d%e'de'de'fd;ZD  ed<       ejT                  eD            ZEde#e!ejL                  f   de'de'de(d%e'de'de'fd=ZFy)?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AllCandidateSampler)sampled_candidatestrue_expected_countsampled_expected_counttrue_classesnum_truenum_sampleduniqueseedseed2c                 h   t         j                   xs t        j                         }|j                  }|j                  r:	 t	        j
                  |d|| d|d|d|d|d|      }	t        j                  |	      }	|	S t        j                   |d      }t        j                   |d      }t        j"                  |d      }|d	}t        j                   |d      }|d	}t        j                   |d      }t%        j&                  d| ||||||
      \  }}}}|dd }	t        j(                         r{d|j+                  d      d|j+                  d      d|j-                  d      d|j+                  d      d|j+                  d      f
}|j.                  }t        j0                  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 labels for candidate sampling with a learned unigram distribution.

  See explanations of candidate sampling and the data formats at
  go/candidate-sampling.

  For each batch, this op picks a single set of sampled candidate labels.

  The advantages of sampling candidates per-batch are simplicity and the
  possibility of efficient dense matrix multiplication. The disadvantage is that
  the sampled candidates must be chosen independently of the context and of the
  true labels.

  Args:
    true_classes: A `Tensor` of type `int64`.
      A batch_size * num_true matrix, in which each row contains the
      IDs of the num_true target_classes in the corresponding original label.
    num_true: An `int` that is `>= 1`. Number of true labels per context.
    num_sampled: An `int` that is `>= 1`. Number of candidates to produce.
    unique: A `bool`.
      If unique is true, we sample with rejection, so that all sampled
      candidates in a batch are unique. This requires some approximation to
      estimate the post-rejection sampling probabilities.
    seed: An optional `int`. Defaults to `0`.
      If either seed or seed2 are set to be non-zero, the random number
      generator is seeded by the given seed.  Otherwise, it is seeded by a
      random seed.
    seed2: An optional `int`. Defaults to `0`.
      An second seed to avoid seed collision.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (sampled_candidates, true_expected_count, sampled_expected_count).

    sampled_candidates: A `Tensor` of type `int64`.
    true_expected_count: A `Tensor` of type `float32`.
    sampled_expected_count: A `Tensor` of type `float32`.
  r   r   r   r   r   r   N)r   r   r   r   r   namectxr   )r   r   r   r   r   r   r   )_contextr   _thread_local_datais_eagerr   TFE_Py_FastPathExecute_AllCandidateSamplerOutput_make_core_NotOkStatusException_opsraise_from_not_ok_status_FallbackException$all_candidate_sampler_eager_fallback_SymbolicException_executemake_int	make_bool_op_def_library_apply_op_helpermust_record_gradient_get_attr_int_get_attr_boolinputsrecord_gradient)r   r   r   r   r   r   r   _ctxtld_resulte__op_outputs_attrs_inputs_flats                   `/home/dcms/DCMS/lib/python3.12/site-packages/tensorflow/python/ops/gen_candidate_sampling_ops.pyall_candidate_samplerrA      s:   L 
			0h..0$#\\
11#T<X{HffdGg +009gn x4(!!+}=+fh/&	\D			4	($
]E


E7
+%'88L8+6v$(DB!QX QK'""$#++J7.  *FC4E4Ef4Ms((13F ::L|VW>&,,W5'	.E && -
##At,,## 
1
{d%dF F ## 
s0    8F< <HG**HHH H10H1zraw_ops.AllCandidateSamplerc           
         t        j                  |d      }t        j                  |d      }t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }t        j                  | t
        j                        } | g}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   s   AllCandidateSampler   r5   attrsr   r   r   )r-   r.   r/   r(   convert_to_tensor_dtypesint64r   r2   r6   r$   r%   )r   r   r   r   r   r   r   r   r?   r>   r9   s              r@   r+   r+   t   s    x4(!!+}=+fh/&	\D			4	($
]E


E7
+%''gmmD,,-h&$(&3Q|#)s?'""$|VW>&,,W5'	.    ComputeAccidentalHits)indicesidsweightsr   c                    t         j                   xs t        j                         }|j                  }|j                  r7	 t	        j
                  |d|| |d|d|d|      }t        j                  |      }|S t        j                   |d      }|d}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|||       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 gw xY w)	a  Computes the ids of the positions in sampled_candidates that match true_labels.

  When doing log-odds NCE, the result of this op should be passed through a
  SparseToDense op, then added to the logits of the sampled candidates. This has
  the effect of 'removing' the sampled labels that match the true labels by
  making the classifier sure that they are sampled labels.

  Args:
    true_classes: A `Tensor` of type `int64`.
      The true_classes output of UnpackSparseLabels.
    sampled_candidates: A `Tensor` of type `int64`.
      The sampled_candidates output of CandidateSampler.
    num_true: An `int`. Number of true labels per context.
    seed: An optional `int`. Defaults to `0`.
      If either seed or seed2 are set to be non-zero, the random number
      generator is seeded by the given seed.  Otherwise, it is seeded by a
      random seed.
    seed2: An optional `int`. Defaults to `0`.
      An second seed to avoid seed collision.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (indices, ids, weights).

    indices: A `Tensor` of type `int32`.
    ids: A `Tensor` of type `int64`.
    weights: A `Tensor` of type `float32`.
  rJ   r   r   r   N)r   r   r   r   r   r   )r   r   r   r   r   r   )r    r   r!   r"   r   r#   _ComputeAccidentalHitsOutputr%   r&   r'   r(   r)   r*   &compute_accidental_hits_eager_fallbackr,   r-   r.   r0   r1   r2   r3   r5   r6   )r   r   r   r   r   r   r7   r8   r9   r:   r;   r<   r=   r>   r?   s                  r@   compute_accidental_hitsrQ      s   : 
			0h..0$#\\	11%t\;MHfdGU<g -227;gn x4(	\D			4	($
]E


E7
+%'88l4F*2U&*	,!QX
 QK'""$#++J7'#2C2CG2LNF::Lvw@(..w7'	.? && -
##At,,## 
3
*XDDd, , ## 
s0    5E* *F1=FF10F15G GGzraw_ops.ComputeAccidentalHitsc                    t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }t        j                  | t        j
                        } t        j                  |t        j
                        }| |g}d|d|d|f}t        j                  dd||||      }	t        j                         rt        j                  d|||	       t        j                  |	      }	|	S )	Nr   r   r   r   s   ComputeAccidentalHitsrC   rD   rJ   )r-   r.   r(   rF   rG   rH   r   r2   r6   rO   r%   )
r   r   r   r   r   r   r   r?   r>   r9   s
             r@   rP   rP      s    x4(	\D			4	($
]E


E7
+%''gmmD,--.@'--P 23,&$?&5q#)s?'""$vw@(..w7'	.rI   FixedUnigramCandidateSampler    	range_max
vocab_file
distortionnum_reserved_ids
num_shardsshardc                 ^   t         j                   xs t        j                         }|j                  }|j                  rH	 t	        j
                  |d|| d|d|d|d|d|d|d|d	|d
|	d|
d|d|      }t        j                  |      }|S t        j                   |d      }t        j                   |d      }t        j"                  |d      }t        j                   |d      }|d}t        j$                  |d      }|d}t        j&                  |d      }|d}t        j                   |d      }|d}t        j                   |d	      }|	d}	t        j                   |	d
      }	|
g }
t)        |
t*        t,        f      st/        d|
z        |
D cg c]  }t        j&                  |d       }
}|d}t        j                   |d      }|d}t        j                   |d      }t1        j2                  d| |||||||||	|
|||      \  }}}}|dd }t        j4                         rd|j7                  d      d|j7                  d      d|j9                  d      d|j7                  d      d|j;                  d      d|j;                  d      d|j7                  d      d	|j7                  d	      d
|j7                  d
      d|j;                  d      d|j7                  d      d|j7                  d      f}|j<                  }t        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        | |||||||||	|
||||      S # t        j                  $ r Y w xY wc c}w )aA  Generates labels for candidate sampling with a learned unigram distribution.

  A unigram sampler could use a fixed unigram distribution read from a
  file or passed in as an in-memory array instead of building up the distribution
  from data on the fly. There is also an option to skew the distribution by
  applying a distortion power to the weights.

  The vocabulary file should be in CSV-like format, with the last field
  being the weight associated with the word.

  For each batch, this op picks a single set of sampled candidate labels.

  The advantages of sampling candidates per-batch are simplicity and the
  possibility of efficient dense matrix multiplication. The disadvantage is that
  the sampled candidates must be chosen independently of the context and of the
  true labels.

  Args:
    true_classes: A `Tensor` of type `int64`.
      A batch_size * num_true matrix, in which each row contains the
      IDs of the num_true target_classes in the corresponding original label.
    num_true: An `int` that is `>= 1`. Number of true labels per context.
    num_sampled: An `int` that is `>= 1`.
      Number of candidates to randomly sample.
    unique: A `bool`.
      If unique is true, we sample with rejection, so that all sampled
      candidates in a batch are unique. This requires some approximation to
      estimate the post-rejection sampling probabilities.
    range_max: An `int` that is `>= 1`.
      The sampler will sample integers from the interval [0, range_max).
    vocab_file: An optional `string`. Defaults to `""`.
      Each valid line in this file (which should have a CSV-like format)
      corresponds to a valid word ID. IDs are in sequential order, starting from
      num_reserved_ids. The last entry in each line is expected to be a value
      corresponding to the count or relative probability. Exactly one of vocab_file
      and unigrams needs to be passed to this op.
    distortion: An optional `float`. Defaults to `1`.
      The distortion is used to skew the unigram probability distribution.
      Each weight is first raised to the distortion's power before adding to the
      internal unigram distribution. As a result, distortion = 1.0 gives regular
      unigram sampling (as defined by the vocab file), and distortion = 0.0 gives
      a uniform distribution.
    num_reserved_ids: An optional `int`. Defaults to `0`.
      Optionally some reserved IDs can be added in the range [0,
      ..., num_reserved_ids) by the users. One use case is that a special unknown
      word token is used as ID 0. These IDs will have a sampling probability of 0.
    num_shards: An optional `int` that is `>= 1`. Defaults to `1`.
      A sampler can be used to sample from a subset of the original range
      in order to speed up the whole computation through parallelism. This parameter
      (together with 'shard') indicates the number of partitions that are being
      used in the overall computation.
    shard: An optional `int` that is `>= 0`. Defaults to `0`.
      A sampler can be used to sample from a subset of the original range
      in order to speed up the whole computation through parallelism. This parameter
      (together with 'num_shards') indicates the particular partition number of a
      sampler op, when partitioning is being used.
    unigrams: An optional list of `floats`. Defaults to `[]`.
      A list of unigram counts or probabilities, one per ID in sequential
      order. Exactly one of vocab_file and unigrams should be passed to this op.
    seed: An optional `int`. Defaults to `0`.
      If either seed or seed2 are set to be non-zero, the random number
      generator is seeded by the given seed.  Otherwise, it is seeded by a
      random seed.
    seed2: An optional `int`. Defaults to `0`.
      An second seed to avoid seed collision.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (sampled_candidates, true_expected_count, sampled_expected_count).

    sampled_candidates: A `Tensor` of type `int64`.
    true_expected_count: A `Tensor` of type `float32`.
    sampled_expected_count: A `Tensor` of type `float32`.
  rS   r   r   r   rV   rW   rX   rY   rZ   r[   unigramsr   r   N)r   r   r   rV   rW   rX   rY   rZ   r[   r]   r   r   r   r   rT   rU   r   VExpected list for 'unigrams' argument to 'fixed_unigram_candidate_sampler' Op, not %r.)r   r   r   r   rV   rW   rX   rY   rZ   r[   r]   r   r   r   ) r    r   r!   r"   r   r#   #_FixedUnigramCandidateSamplerOutputr%   r&   r'   r(   r)   r*   .fixed_unigram_candidate_sampler_eager_fallbackr,   r-   r.   r/   make_str
make_float
isinstancelisttuple	TypeErrorr0   r1   r2   r3   r4   get_attrr5   r6   )r   r   r   r   rV   rW   rX   rY   rZ   r[   r]   r   r   r   r7   r8   r9   r:   _fr;   r<   r=   r>   r?   s                           r@   fixed_unigram_candidate_samplerri      s   V 
			0h..0$#\\11,dL*-h<\:,lJ
HfdGULg 499'Bgn x4(!!+}=+fh/&	;7)J  \:*J"":|<*&&'79KLJ  \:*
]E


E7
+%H	HtUm	,
	8:B	CD D =EEbh!!"j1E(E	\D			4	($
]E


E7
+%'88&\194?/53=3=9I3=U19.3$
@!QX QK'""$#++J7.  *K,lll<(,ll<(*< 23\-w(*ll:&0A0A&0Is((1
3F ::L&fgG/55g>'	.U && -
##At,,## 
;
{92BuxdDd, , ## 
8 Fs7    AL+ N*+M2>MM21M26N N'&N'z$raw_ops.FixedUnigramCandidateSamplerc                    t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }|d	}t        j                  |d
      }|d}t        j                  |d      }|	d	}	t        j                  |	d      }	|
g }
t        |
t        t        f      st        d|
z        |
D cg c]  }t        j                  |d       }
}|d	}t        j                  |d      }|d	}t        j                  |d      }t        j                  | t        j                        } | g}d|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 c c}w )Nr   r   r   rV   rT   rW   rU   rX   r   rY   rZ   r[   r^   r]   r   r   s   FixedUnigramCandidateSamplerrC   rD   rS   )r-   r.   r/   ra   rb   rc   rd   re   rf   r(   rF   rG   rH   r   r2   r6   r_   r%   )r   r   r   r   rV   rW   rX   rY   rZ   r[   r]   r   r   r   r   rh   r?   r>   r9   s                      r@   r`   r`     s,   x4(!!+}=+fh/&	;7)J  \:*J"":|<*&&'79KLJ  \:*
]E


E7
+%H	HtUm	,
	8:B	CD D =EEbh!!"j1E(E	\D			4	($
]E


E7
+%''gmmD,,-h+y,
L "2L*	5*hguF& <a$0C"&(' ""$&fgG/55g>'	.) Fs   G9LearnedUnigramCandidateSamplerc                    t         j                   xs t        j                         }|j                  }	|	j                  r<	 t	        j
                  |d|| d|d|d|d|d|d|      }
t        j                  |
      }
|
S t        j                   |d      }t        j                   |d      }t        j"                  |d      }t        j                   |d      }|d
}t        j                   |d      }|d
}t        j                   |d      }t%        j&                  d| |||||||	      \  }}}}|dd }
t        j(                         rd|j+                  d      d|j+                  d      d|j-                  d      d|j+                  d      d|j+                  d      d|j+                  d      f}|j.                  }t        j0                  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)%  Generates labels for candidate sampling with a learned unigram distribution.

  See explanations of candidate sampling and the data formats at
  go/candidate-sampling.

  For each batch, this op picks a single set of sampled candidate labels.

  The advantages of sampling candidates per-batch are simplicity and the
  possibility of efficient dense matrix multiplication. The disadvantage is that
  the sampled candidates must be chosen independently of the context and of the
  true labels.

  Args:
    true_classes: A `Tensor` of type `int64`.
      A batch_size * num_true matrix, in which each row contains the
      IDs of the num_true target_classes in the corresponding original label.
    num_true: An `int` that is `>= 1`. Number of true labels per context.
    num_sampled: An `int` that is `>= 1`.
      Number of candidates to randomly sample.
    unique: A `bool`.
      If unique is true, we sample with rejection, so that all sampled
      candidates in a batch are unique. This requires some approximation to
      estimate the post-rejection sampling probabilities.
    range_max: An `int` that is `>= 1`.
      The sampler will sample integers from the interval [0, range_max).
    seed: An optional `int`. Defaults to `0`.
      If either seed or seed2 are set to be non-zero, the random number
      generator is seeded by the given seed.  Otherwise, it is seeded by a
      random seed.
    seed2: An optional `int`. Defaults to `0`.
      An second seed to avoid seed collision.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (sampled_candidates, true_expected_count, sampled_expected_count).

    sampled_candidates: A `Tensor` of type `int64`.
    true_expected_count: A `Tensor` of type `float32`.
    sampled_expected_count: A `Tensor` of type `float32`.
  rk   r   r   r   rV   r   r   Nr   r   r   rV   r   r   r   r   r   r   r   r   r   rV   r   r   r   )r    r   r!   r"   r   r#   %_LearnedUnigramCandidateSamplerOutputr%   r&   r'   r(   r)   r*   0learned_unigram_candidate_sampler_eager_fallbackr,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r   r   r   r   rV   r   r   r   r7   r8   r9   r:   r;   r<   r=   r>   r?   s                    r@   !learned_unigram_candidate_samplerrs     sg   R 
			0h..0$#\\
11.lHm[(FYgu>g 6;;GDgn x4(!!+}=+fh/&	;7)	\D			4	($
]E


E7
+%'88(|3;6A179/35tM!QX QK'""$#++J7.  *K,f'#2C2CG2L	NF
 ::L(,I177@'	.O && -
##At,,## 
=
{94u  ## 
0    :G& &H-9HH-,H-1I IIz&raw_ops.LearnedUnigramCandidateSamplerc	                 @   t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }t        j                  | t
        j                        } | g}	d|d|d|d|d|d|f}
t        j                  dd	|	|
||
      }t        j                         rt        j                  d|	|
|       t        j                  |      }|S )Nr   r   r   rV   r   r   r   s   LearnedUnigramCandidateSamplerrC   rD   rk   )r-   r.   r/   r(   rF   rG   rH   r   r2   r6   rp   r%   r   r   r   r   rV   r   r   r   r   r?   r>   r9   s               r@   rq   rq   ,  s   x4(!!+}=+fh/&	;7)	\D			4	($
]E


E7
+%''gmmD,,-h+y&$@&>$0C"&(' ""$(,I177@'	.rI   LogUniformCandidateSamplerc                    t         j                   xs t        j                         }|j                  }	|	j                  r<	 t	        j
                  |d|| d|d|d|d|d|d|      }
t        j                  |
      }
|
S t        j                   |d      }t        j                   |d      }t        j"                  |d      }t        j                   |d      }|d
}t        j                   |d      }|d
}t        j                   |d      }t%        j&                  d| |||||||	      \  }}}}|dd }
t        j(                         rd|j+                  d      d|j+                  d      d|j-                  d      d|j+                  d      d|j+                  d      d|j+                  d      f}|j.                  }t        j0                  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 labels for candidate sampling with a log-uniform distribution.

  See explanations of candidate sampling and the data formats at
  go/candidate-sampling.

  For each batch, this op picks a single set of sampled candidate labels.

  The advantages of sampling candidates per-batch are simplicity and the
  possibility of efficient dense matrix multiplication. The disadvantage is that
  the sampled candidates must be chosen independently of the context and of the
  true labels.

  Args:
    true_classes: A `Tensor` of type `int64`.
      A batch_size * num_true matrix, in which each row contains the
      IDs of the num_true target_classes in the corresponding original label.
    num_true: An `int` that is `>= 1`. Number of true labels per context.
    num_sampled: An `int` that is `>= 1`.
      Number of candidates to randomly sample.
    unique: A `bool`.
      If unique is true, we sample with rejection, so that all sampled
      candidates in a batch are unique. This requires some approximation to
      estimate the post-rejection sampling probabilities.
    range_max: An `int` that is `>= 1`.
      The sampler will sample integers from the interval [0, range_max).
    seed: An optional `int`. Defaults to `0`.
      If either seed or seed2 are set to be non-zero, the random number
      generator is seeded by the given seed.  Otherwise, it is seeded by a
      random seed.
    seed2: An optional `int`. Defaults to `0`.
      An second seed to avoid seed collision.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (sampled_candidates, true_expected_count, sampled_expected_count).

    sampled_candidates: A `Tensor` of type `int64`.
    true_expected_count: A `Tensor` of type `float32`.
    sampled_expected_count: A `Tensor` of type `float32`.
  rw   r   r   r   rV   r   r   Nrn   r   ro   )r    r   r!   r"   r   r#   !_LogUniformCandidateSamplerOutputr%   r&   r'   r(   r)   r*   ,log_uniform_candidate_sampler_eager_fallbackr,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   rr   s                    r@   log_uniform_candidate_samplerr{   I  sf   R 
			0h..0$#\\
11*D,
-h64%1g 277@gn x4(!!+}=+fh/&	;7)	\D			4	($
]E


E7
+%'88$</72=f09,1>!QX QK'""$#++J7.  *K,f'#2C2CG2L	NF
 ::L$lFGE-33G<'	.O && -
##At,,## 
9
{94u  ## 
rt   z"raw_ops.LogUniformCandidateSamplerc	                 @   t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }t        j                  | t
        j                        } | g}	d|d|d|d|d|d|f}
t        j                  dd	|	|
||
      }t        j                         rt        j                  d|	|
|       t        j                  |      }|S )Nr   r   r   rV   r   r   r   s   LogUniformCandidateSamplerrC   rD   rw   )r-   r.   r/   r(   rF   rG   rH   r   r2   r6   ry   r%   rv   s               r@   rz   rz     s   x4(!!+}=+fh/&	;7)	\D			4	($
]E


E7
+%''gmmD,,-h+y&$@&:A$0C"&(' ""$$lFGE-33G<'	.rI   #ThreadUnsafeUnigramCandidateSamplerc                    t         j                   xs t        j                         }|j                  }	|	j                  r<	 t	        j
                  |d|| d|d|d|d|d|d|      }
t        j                  |
      }
|
S t        j                   |d      }t        j                   |d      }t        j"                  |d      }t        j                   |d      }|d
}t        j                   |d      }|d
}t        j                   |d      }t%        j&                  d| |||||||	      \  }}}}|dd }
t        j(                         rd|j+                  d      d|j+                  d      d|j-                  d      d|j+                  d      d|j+                  d      d|j+                  d      f}|j.                  }t        j0                  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)rm   r}   r   r   r   rV   r   r   Nrn   r   ro   )r    r   r!   r"   r   r#   *_ThreadUnsafeUnigramCandidateSamplerOutputr%   r&   r'   r(   r)   r*   6thread_unsafe_unigram_candidate_sampler_eager_fallbackr,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   rr   s                    r@   'thread_unsafe_unigram_candidate_samplerr     sh   R 
			0h..0$#\\
113T<Hm[(FYgu>g ;@@Ign x4(!!+}=+fh/&	;7)	\D			4	($
]E


E7
+%'88-L8@;F6<9B5:G!QX QK'""$#++J7.  *K,f'#2C2CG2L	NF
 ::L-|VWN6<<WE'	.Q && -
##At,,## 
C
{94u  ## 
rt   z+raw_ops.ThreadUnsafeUnigramCandidateSamplerc	                 @   t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }t        j                  | t
        j                        } | g}	d|d|d|d|d|d|f}
t        j                  dd	|	|
||
      }t        j                         rt        j                  d|	|
|       t        j                  |      }|S )Nr   r   r   rV   r   r   r   s#   ThreadUnsafeUnigramCandidateSamplerrC   rD   r}   )r-   r.   r/   r(   rF   rG   rH   r   r2   r6   r   r%   rv   s               r@   r   r   %  s   x4(!!+}=+fh/&	;7)	\D			4	($
]E


E7
+%''gmmD,,-h+y&$@&CQ$0C"&(' ""$-|VWN6<<WE'	.rI   UniformCandidateSamplerc                    t         j                   xs t        j                         }|j                  }	|	j                  r<	 t	        j
                  |d|| d|d|d|d|d|d|      }
t        j                  |
      }
|
S t        j                   |d      }t        j                   |d      }t        j"                  |d      }t        j                   |d      }|d
}t        j                   |d      }|d
}t        j                   |d      }t%        j&                  d| |||||||	      \  }}}}|dd }
t        j(                         rd|j+                  d      d|j+                  d      d|j-                  d      d|j+                  d      d|j+                  d      d|j+                  d      f}|j.                  }t        j0                  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 labels for candidate sampling with a uniform distribution.

  See explanations of candidate sampling and the data formats at
  go/candidate-sampling.

  For each batch, this op picks a single set of sampled candidate labels.

  The advantages of sampling candidates per-batch are simplicity and the
  possibility of efficient dense matrix multiplication. The disadvantage is that
  the sampled candidates must be chosen independently of the context and of the
  true labels.

  Args:
    true_classes: A `Tensor` of type `int64`.
      A batch_size * num_true matrix, in which each row contains the
      IDs of the num_true target_classes in the corresponding original label.
    num_true: An `int` that is `>= 1`. Number of true labels per context.
    num_sampled: An `int` that is `>= 1`.
      Number of candidates to randomly sample.
    unique: A `bool`.
      If unique is true, we sample with rejection, so that all sampled
      candidates in a batch are unique. This requires some approximation to
      estimate the post-rejection sampling probabilities.
    range_max: An `int` that is `>= 1`.
      The sampler will sample integers from the interval [0, range_max).
    seed: An optional `int`. Defaults to `0`.
      If either seed or seed2 are set to be non-zero, the random number
      generator is seeded by the given seed.  Otherwise, it is seeded by a
      random seed.
    seed2: An optional `int`. Defaults to `0`.
      An second seed to avoid seed collision.
    name: A name for the operation (optional).

  Returns:
    A tuple of `Tensor` objects (sampled_candidates, true_expected_count, sampled_expected_count).

    sampled_candidates: A `Tensor` of type `int64`.
    true_expected_count: A `Tensor` of type `float32`.
    sampled_expected_count: A `Tensor` of type `float32`.
  r   r   r   r   rV   r   r   Nrn   r   ro   )r    r   r!   r"   r   r#   _UniformCandidateSamplerOutputr%   r&   r'   r(   r)   r*   (uniform_candidate_sampler_eager_fallbackr,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   rr   s                    r@   uniform_candidate_samplerr   B  sf   R 
			0h..0$#\\
11'|Z-h64%1g /44W=gn x4(!!+}=+fh/&	;7)	\D			4	($
]E


E7
+%'88!,4+*0I(,E	F!QX
 QK'""$#++J7.  *K,f'#2C2CG2L	NF
 ::L!<B*009'	.M && -
##At,,## 
5
{94u  ## 
rt   zraw_ops.UniformCandidateSamplerc	                 @   t        j                  |d      }t        j                  |d      }t        j                  |d      }t        j                  |d      }|d}t        j                  |d      }|d}t        j                  |d      }t        j                  | t
        j                        } | g}	d|d|d|d|d|d|f}
t        j                  dd	|	|
||
      }t        j                         rt        j                  d|	|
|       t        j                  |      }|S )Nr   r   r   rV   r   r   r   s   UniformCandidateSamplerrC   rD   r   )r-   r.   r/   r(   rF   rG   rH   r   r2   r6   r   r%   rv   s               r@   r   r     s   x4(!!+}=+fh/&	;7)	\D			4	($
]E


E7
+%''gmmD,,-h+y&$@&7$0C"&(' ""$!<B*009'	.rI   )r   r   N)G__doc__collectionstensorflow.pythonr   tensorflow.python.eagerr   r    r   r&   r   r-   tensorflow.python.frameworkr   rG   tensorflow.security.fuzzing.pyr   _atypesr	   _op_def_registryr
   r(   r   r0   "tensorflow.python.util.deprecationr   tensorflow.python.utilr   	_dispatch tensorflow.python.util.tf_exportr   typingr   r   r   typing_extensionsr   
namedtupler$   Int64intboolrA   	to_raw_opr   r+   rO   rQ   rJ   rP   r_   strfloatri   rS   r`   rp   rs   rk   rq   ry   r{   rw   rz   r   r   r}   r   r   r   r   r    rI   r@   <module>r      s  
  6 7 1 7 9 F K 3 I C 8 6 % % '3[33KM 
R	#w}}2D(E RQT Rcf Rpt R{~ R  IL Rh ?i =>~t~~Nc?de ygmmAS7T `c ru   @D   LO   X[ ,  6{55! # 
E)C4F*G E]fgjlslylygy]z E  GJ E  QT E  ^a EN C	"AB>4>>RiCjk 3CU9V luvy  |C  |I  |I  wI  mJ   VY   ad   mp ( '=k&<&<"K'M #
 `b  uv  MN  _`  lm  xz  EF  RS  Z^ a)C<N2O a[^ amp az~ a  LO a  \_ a  ot a  IL a  [^ a  hk a  AD a  NQ aF  Qy)OPQ_QUQ_Q_`  RA   B .3PWP]P]K]A^ .jm .| .  JN .  [^ .  lo .  }B .  VY .  gj .  sv .  HK .  TW .` )?(>(>$K)M %
ZIc7==>P4Q Z]` Zor Z  }A Z  NQ Z  X[ Z  eh Zx "U+S!TUcUYUcUc  eF  VG  "H 9SRYR_R_M_C` lo   B   LP   ]`   hk   tw 0 %;K$:$: K%M !
Z	#w}}:L0M ZY\ Zkn Zx| Z  JM Z  TW Z  ad Zx MY'KL^T^^\yMz{ ygmmI[?\ hk z}   HL   Y\   dg   ps 0 .D[-C-C)K.M *
[)CDV:W [cf [ux [  CG [  TW [  ^a [  kn [z '_i0]&^_m_c_m_m  oV  `W  'X #SVX_XeXeSeIf ru   EH   RV   cf   nq   z} 0 "8!7!7K"M 
YIc7==6H,I YUX Ygj Ytx Y  FI Y  PS Y  ]` Yv G)$EF~t~~VoGpq 9S'--EW;X dg vy   DH   UX   `c   lo rI   