OP_CHECK_IF
Description
Outputs a log and executes the return expression if the condition is true.
Prototype
OP_CHECK_IF(condition, log, return_expr)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
condition |
Input |
Condition check. |
log |
Input |
Log to be printed using OP_LOGE. |
return_expr |
Input |
A return expression. |
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 | auto axesTensor = context->GetInputTensor(1); OP_CHECK_NULL_WITH_CONTEXT(context, axesTensor); auto axesSize = static_cast<int32_t>(axesTensor->GetShapeSize()); OP_CHECK_IF( axesSize < 0, OP_LOGE(context->GetNodeName(), "axes num cannot be less than 0!"), return ge::GRAPH_FAILED); |
Parent topic: log