OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON

Description

Records and reports a parameter data type error (with a cause). If an operator parameter has an incorrect data type, an error log (including the specific cause) is generated and the error code EZ0020 is reported.

Prototype

OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON(entityName, paramName, incorrectDtype, reason)

Parameters

Parameter

Input/Output

Description

entityName

Input

Operator name or aclnn API name. The type can be const char* or std::string.

paramName

Input

Parameter name. The type can be const char* or std::string.

incorrectDtype

Input

Actual data type (for example, INT8). The type can be const char* or std::string.

reason

Input

Error cause description. The type can be const char* or std::string.

Return Value

None.

Constraints

None.

Example

The following sample code is for reference only. Do not copy and run it.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
// Expected output: Parameter k_cache of KvRmsNormRopeCache has incorrect dtype FLOAT16.
//          Reason: The dtype of input k_cache should be INT8, HIFLOAT8, FLOAT8_E4M3FN or FLOAT8_E5M2,
//          or the same as the dtype of input kv.
if (!IsSupportedDtype(kCacheDtype, kvDtype)) {
    OP_LOGE_FOR_INVALID_DTYPE_WITH_REASON("KvRmsNormRopeCache", "k_cache",
        Ops::Base::ToString(kCacheDtype).c_str(),
        "The dtype of input k_cache should be INT8, HIFLOAT8, FLOAT8_E4M3FN or FLOAT8_E5M2, "
        "or the same as the dtype of input kv.");
    return ge::GRAPH_FAILED;
}