OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON

Description

Records and reports multiple parameter shape dimension errors (with causes). If multiple operator parameters have incorrect shape dimensions, an error log (including the specific causes) is generated and the error code EZ0013 is reported.

Prototype

OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON(entityName, paramNames, incorrectDims, reason)

Parameters

Parameter

Input/Output

Description

entityName

Input

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

paramNames

Input

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

incorrectDims

Input

Actual dimension list. 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: Parameters dy, cos and sin of RotaryPositionEmbeddingGrad have incorrect shape dims
//          3, 4 and 4. Reason: The numbers of dimensions of input dy, cos and sin should all be 3D or 4D.
if (dyDimNum != expectedDim || cosDimNum != expectedDim || sinDimNum != expectedDim) {
    std::string dimMsg = std::to_string(dyDimNum) + ", " + std::to_string(cosDimNum) +
        " and " + std::to_string(sinDimNum);
    OP_LOGE_FOR_INVALID_SHAPEDIMS_WITH_REASON("RotaryPositionEmbeddingGrad",
        "dy, cos and sin", dimMsg.c_str(),
        "The numbers of dimensions of input dy, cos and sin should all be 3D or 4D.");
    return ge::GRAPH_FAILED;
}