OP_LOGE_FOR_INVALID_DTYPE

Description

Records and reports a parameter data type error. If the specified parameter data type of an operator is not as expected, an error log is generated and the error code EZ0019 is reported.

Prototype

OP_LOGE_FOR_INVALID_DTYPE(entityName, paramName, incorrectDtype, correctDtype)

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, INT32). The type can be const char* or std::string.

correctDtype

Input

Expected data type (for example, FLOAT16). 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
// Expected output: Parameter softmax of SoftmaxGrad has incorrect dtype INT32. It should be
//          FLOAT, FLOAT16 or BF16.
if (dtype_ != ge::DT_FLOAT && dtype_ != ge::DT_FLOAT16 && dtype_ != ge::DT_BF16) {
    OP_LOGE_FOR_INVALID_DTYPE("SoftmaxGrad", "softmax",
        Ops::Base::ToString(dtype_).c_str(), "FLOAT, FLOAT16 or BF16");
    return ge::GRAPH_FAILED;
}