fn
atan2
→Tensoratan2(other: Tensor | Scalar, input: Tensor)Element-wise quadrant-aware inverse tangent.
Computes while using the signs of y and x to
pick the correct quadrant, returning a result in . Unlike
arctan, this handles all four quadrants of the plane and the special
cases at the axes.
Parameters
otherTensor or scalarThe
x (denominator) coordinate.inputTensorThe
y (numerator) coordinate. Broadcasts against other.Returns
TensorAngles in radians in the range , with shape
broadcast(input.shape, other.shape).
Notes
Definition by cases:
Useful for polar / spherical coordinate conversions. The argument order is the
mathematical convention atan2(y, x).
Examples
>>> import lucid
>>> y = lucid.tensor([1.0, -1.0])
>>> x = lucid.tensor([1.0, -1.0])
>>> lucid.atan2(x, y)
Tensor([0.7854, -2.3562])