mindspore.ops.lcm

View Source On Gitee
mindspore.ops.lcm(input, other)[source]

Computes least common multiplier of input tensors element-wise. The shape of two inputs should be broadcastable, and data type of them should be one of: int32, int64

Parameters
  • input (Tensor) – The first input tensor.

  • other (Tensor) – The second input tensor.

Returns

Tensor, the shape is the same as the one after broadcasting, and the data type is one with higher digits in the two inputs.

Raises
  • TypeError – If data type input or other is not int32 or int64.

  • ValueError – If shape of two inputs are not broadcastable.

Supported Platforms:

Ascend GPU CPU

Examples

>>> import numpy as np
>>> from mindspore import Tensor, ops
>>> input = Tensor(np.array([7, 8, 9]))
>>> other = Tensor(np.array([14, 6, 12]))
>>> y = ops.lcm(input, other)
>>> print(y)
[14 24 36]