mindspore.ops.hypot

mindspore.ops.hypot(x, other)[source]

Computes hypotenuse of input tensors element-wise as legs of a right triangle. The shape of two inputs should be broadcastable, and data type of them should be one of: float32, float64

Parameters
  • x (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 precision in the two inputs.

Raises
  • TypeError – If data type x or other is not float32 or float64.

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

Supported Platforms:

CPU

Examples

>>> x = Tensor(np.array([3., 5., 7.]))
>>> other = Tensor(np.array([4., 12., 24.]))
>>> y = ops.hypot(x, other)
>>> print(y)
[ 5. 13. 25.]