mindspore.numpy.divmod
- mindspore.numpy.divmod(x1, x2, dtype=None)
Returns element-wise quotient and remainder simultaneously.
- Parameters
- Returns
Element-wise quotient and remainder from floor division, in format of (quotient, remainder)
- Raises
TypeError – if x1 and x2 are not Tensor or scalar.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore.numpy as np >>> a = np.array([1, 2, 3, 4, 5]) >>> print(np.divmod(a, 1.5)) (Tensor(shape=[5], dtype=Float32, value= [ 0.00000000e+00, 1.00000000e+00, 2.00000000e+00, 2.00000000e+00, 3.00000000e+00]), Tensor(shape=[5], dtype=Float32, value= [ 1.00000000e+00, 5.00000000e-01, 0.00000000e+00, 1.00000000e+00, 5.00000000e-01]))