mindspore.ops.Atan2

class mindspore.ops.Atan2(*args, **kwargs)[source]

Returns arctangent of input_x/input_y element-wise.

It returns \(\theta\ \in\ [-\pi, \pi]\) such that \(x = r*\sin(\theta), y = r*\cos(\theta)\), where \(r = \sqrt{x^2 + y^2}\).

Inputs of input_x and input_y comply with the implicit type conversion rules to make the data types consistent. If they have different data types, lower priority data type will be converted to relatively highest priority data type. RuntimeError exception will be thrown when the data type conversion of Parameter is required.

Inputs:
  • input_x (Tensor) - The input tensor.

  • input_y (Tensor) - The input tensor.

Outputs:

Tensor, the shape is the same as the one after broadcasting,and the data type is same as input_x.

Raises

TypeError – If input_x or input_y is not a Tensor.

Supported Platforms:

Ascend CPU

Examples

>>> input_x = Tensor(np.array([0, 1]), mindspore.float32)
>>> input_y = Tensor(np.array([1, 1]), mindspore.float32)
>>> atan2 = ops.Atan2()
>>> output = atan2(input_x, input_y)
>>> print(output)
[0.        0.7853982]