mindspore.ops.Lcm

View Source On Gitee
class mindspore.ops.Lcm[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.

Warning

This is an experimental API that is subject to change or deletion.

Inputs:
  • x1 (Tensor) - The first input tensor.

  • x2 (Tensor) - The second input tensor.

Outputs:

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 x1 or x2 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
>>> x1 = Tensor(np.array([7, 8, 9]))
>>> x2 = Tensor(np.array([14, 6, 12]))
>>> lcm_ = ops.Lcm()
>>> y = lcm_(x1, x2)
>>> print(y)
[14 24 36]