Should avoid crash and exit in those functions, such as HasInputs and HasOutputs
Created by: Xreki
In some operators, such as reshape_op, some input is defined as dispensable. The change is from this commit.
HasInput("Shape")
is called here to check whether user sets it. However, in the implementation of HasInput, Inputs(name)
is called. And in the implementation of Inputs(name), an PADDLE_ENFORCE
statement is called to check whether the variable for Shape
is set. If not, the user codes will crash directly because of the following error:
unknown file: Failure
C++ exception with description "Type reshape's input Shape is not set at [/home/liuyiqun01/PaddlePaddle/Paddle/paddle/fluid/framework/operator.cc:224]
We should avoid crash and exit in those functions, such as HasInputs and HasOutputs.
In addition, in the inplementation of CheckAllInputOutputSet, we should also allow the unset of dispensable inputs and outputs.