OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON

Description

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

Prototype

OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON(entityName, paramName, incorrectDim, 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.

incorrectDim

Input

Actual dimension (for example, 2D). 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
// Expected output: Parameter query of ApplyRotaryPosEmb has incorrect shape dim 3D.
//          Reason: The shape dims of input query must be 4 when the attr layout is 1 (BSND).
if (queryDimNum != 4 && layout_ == 1) {
    std::string dimStr = std::to_string(queryDimNum) + "D";
    OP_LOGE_FOR_INVALID_SHAPEDIM_WITH_REASON("ApplyRotaryPosEmb", "query",
        dimStr.c_str(),
        "The shape dims of input query must be 4 when the attr layout is 1 (BSND).");
    return ge::GRAPH_FAILED;
}