Log
English | 简体中文
Product Support Status
| Product | Supported |
|---|---|
| Ascend 950PR&950DT products | √ |
| Atlas A3 products | √ |
| Atlas A2 products | √ |
| Atlas 200I/500 A2 inference products | × |
| Atlas inference products | × |
| Atlas training products | × |
Function Description
-
Operator function: computes the logarithm of the elements in the input tensor x element-wise, and saves the result to the output tensor y. It supports input tensors of multiple types and supports the scaling (shift/scale) operation on the input tensor x.
-
Computation formula:
y=logbase(shift+scale∗x)y = log_{base}(shift + scale * x)
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| x | Input | Input tensor, which is x in the formula. | INT8, INT16, INT32, INT64, UINT8, FLOAT16, FLOAT, DOUBLE BOOL, BFLOAT16, COMPLEX64, COMPLEX128 |
ND |
| base | Optional attribute |
|
FLOAT | - |
| scale | Optional attribute |
|
FLOAT | - |
| shift | Optional attribute |
|
FLOAT | - |
| y | Output | Output tensor after the logarithm computation, which is y in the formula. | If the input type is an integer type (INT type), the output type is FLOAT; in other cases, the output type is the same as that of the input tensor x |
ND |
Constraint Description
- The parameter base must be greater than 0. The default value -1 indicates the base e.
- If the input value is in the specific range (0,0.01] or [0.95,1.05), the output precision may be unstable
- Integer inputs are automatically converted to the FLOAT type for output
Invocation Description
| Invocation Method | Sample Code | Description |
|---|---|---|
| aclnn invocation | test_aclnn_log test_aclnn_inplace_log |
Invokes the Log operator through the aclnnLog or aclnnInplaceLog API. |
| aclnn invocation | test_aclnn_log2 test_aclnn_inplace_log2 |
Invokes the Log operator through the aclnnLog2 or aclnnInplaceLog2 API. |
| aclnn invocation | test_aclnn_log10 test_aclnn_inplace_log10 |
Invokes the Log operator through the aclnnLog10 or aclnnInplaceLog10 API. |
| Graph-mode invocation | test_geir_log | Invokes the Log operator by building a graph through the operator IR. |