FilesLast commitLast update
7 days ago
7 days ago
7 days ago
7 days ago
7 days ago
7 days ago
7 days ago
7 days ago
7 days ago
7 days ago
README

Hypot

Applicable Products

Product Supported
Ascend 950PR&950DT products ×
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products ×
Atlas inference products ×
Atlas training products ×

Description

  • Operator function: The operator computes the hypotenuse length (two-dimensional Euclidean norm) elementwise from the corresponding elements of two input tensors. The output is always nonnegative.
  • Formula:

    outi=selfi2+otheri2out_i = \sqrt{self_i^{2} + other_i^{2}}

  • Numerical stability: The implementation scales inputs by the larger absolute value to avoid overflow or underflow in intermediate squared values. Two zero inputs produce +0; inf takes precedence over NaN.

Parameters

Parameter Input/Output/Attribute Description Data Type Data Format
self Input Input tensor self in the formula. FLOAT, FLOAT16, and BFLOAT16 ND
other Input Input tensor other in the formula. FLOAT, FLOAT16, and BFLOAT16 ND
out Output Output tensor out in the formula. FLOAT, FLOAT16, and BFLOAT16 ND
  • self and other can have different dtypes. Type promotion determines the output dtype. The output dtype is FLOAT if either input is FLOAT or if one input is FLOAT16 and the other is BFLOAT16. If both inputs have the same dtype, the output has that dtype.

Constraints

  • The operator supports ND tensors with 0 to 8 dimensions. The input shapes must support broadcasting.
  • The operator supports empty tensors and non-contiguous tensors.
  • The operator does not support DOUBLE, integer types, BOOL, or complex types.
  • This release provides only aclnnHypot and the graph-mode Hypot operator. It does not provide an in-place API.

Invocation

Invocation Method Sample Description
aclnn invocation test_aclnn_hypot Invoke the Hypot operator using the aclnnHypot API.
Graph-mode invocation test_geir_hypot Invoke the Hypot operator by constructing a graph using the operator IR.