mindspore.numpy.remainder
- mindspore.numpy.remainder(x1, x2, dtype=None)[源代码]
Returns element-wise remainder of division.
Computes the remainder complementary to the floor_divide function. It is equivalent to the Python modulus operator
x1 % x2
and has the same sign as the divisor x2. The MATLAB function equivalent to np.remainder is mod.说明
Numpy arguments out, where, casting, order, subok, signature, and extobj are not supported.
- 参数
x1 (Tensor) – input array.
x2 (Tensor) – input array.
dtype (
mindspore.dtype
, optional) – Defaults to None. Overrides the dtype of the output Tensor.
- 返回
Tensor or scalar, the element-wise remainder of the quotient
floor_divide(x1, x2)
. This is a scalar if both x1 and x2 are scalars.
- Supported Platforms:
Ascend
GPU
CPU
样例
>>> import mindspore.numpy as np >>> output = np.remainder(np.array([4, 7]), np.array([2, 3])) >>> print(output) [0 1] >>> output = np.remainder(np.arange(7), np.array(5)) >>> print(output) [0 1 2 3 4 0 1]