mindspore.ops.UniformCandidateSampler
- class mindspore.ops.UniformCandidateSampler(num_true, num_sampled, unique, range_max, seed=0, remove_accidental_hits=False)[source]
Uniform candidate sampler.
This function samples a set of classes(sampled_candidates) from [0, range_max-1] based on uniform distribution.
Refer to
mindspore.ops.uniform_candidate_sampler()
for more detail.- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> sampler = ops.UniformCandidateSampler(1, 3, False, 4, 1) >>> output1, output2, output3 = sampler(Tensor(np.array([[1], [3], [4], [6], [3]], dtype=np.int32))) >>> print(output1) [0 0 3] >>> print(output2) [[0.75] [0.75] [0.75] [0.75] [0.75]] >>> print(output3) [0.75 0.75 0.75]