mindspore.numpy.gcd

mindspore.numpy.gcd(x1, x2, dtype=None)[源代码]

Returns the greatest common divisor of |x1| and |x2|.

说明

Numpy arguments out, where, casting, order, subok, signature, and extobj are not supported.

参数
  • x1 (Tensor) – input data.

  • x2 (Tensor) – input data.

  • dtype (mindspore.dtype, optional) – Defaults to None. Overrides the dtype of the output Tensor.

返回

Tensor or scalar, the greatest common divisor of the absolute value of the inputs. This is a scalar if both x1 and x2 are scalars.

Supported Platforms:

Ascend GPU CPU

样例

>>> import mindspore.numpy as np
>>> output = np.gcd(np.arange(6), np.array(20))
>>> print(output)
[20  1  2  1  4  5]