GetInferenceContextPtr
Description
Obtains the inference context for inferShape passing from the current operator, for example, the shape and data type of the upstream operator.
Prototype
const ge::InferenceContext *GetInferenceContextPtr() const
Parameters
None
Returns
Pointer to InferenceContext
Restrictions
None
Example
ge::graphStatus InferShapeForResourceOp(InferShapeContext *context) {
auto inference_ctx = context->GetInferenceContextPtr(); // Obtain InferenceContext for resource operators.
if (inference_ctx == nullptr) {
// Defensive programming. In an undesirable scenario, an error is printed and a failure message is returned.
return ge::GRAPH_FAILED;
}
// ...
}
Parent topic: InferShapeContext