mindspore.ops.randint_like
- mindspore.ops.randint_like(input, low, high, seed=None, *, dtype=None)[source]
Returns a tensor with the same shape as input whose elements are random integers in the range of [ low , high ) .
Warning
Non-backward-compatible change after version 2.9.0: the signature will change to
randint_like(input, low=0, high, *, dtype=None), seed will be removed, and low will become optional with a default value of0.The Ascend backend does not support the reproducibility of random numbers, so the seed parameter has no effect.
- Parameters
- Keyword Arguments
dtype (
mindspore.dtype, optional) – The data type returned. DefaultNone.- Returns
Tensor
- Supported Platforms:
AscendGPUCPU
Examples
>>> import mindspore >>> a = mindspore.tensor([[1, 2, 3], [3, 2, 1]]) >>> print(mindspore.ops.randint_like(a, 1, 10)) [[4 9 7] [9 1 2]]