Is there a difference between how python and c api and c++ wrapper accessing the contributed operators? #11726
-
I am trying to figure out how python access the c++ contributed operators. Quesiont1: How python access the contributed operators?
Question2: Could the C++ wrapper access the contributed operators embedded within onnxruntime.dll? Question3: Is C API essential for accessing the contributed operators embedded within onnxruntime.dll? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
If it is impossible to access the contributed operators from c++ wrapper, then one must bring the contributed operator codes into custom operator codes. I hope this will not be the only path |
Beta Was this translation helpful? Give feedback.
-
Only in 1.12 that it is possible to create native operator using c api /** \brief: Create onnxruntime native operator
*
* \param[in] kernel info
* \param[in] operator name
* \param[in] operator domain
* \param[in] operator opset
* \param[in] name of the type contraints, such as "T" or "T1"
* \param[in] type of each contraints
* \param[in] number of contraints
* \param[in] attributes used to initialize the operator
* \param[in] number of the attributes
* \param[out] operator that has been created
*
* \since Version 1.12.
*/
ORT_API2_STATUS(CreateOp,
_In_ const OrtKernelInfo* info,
_In_ const char* op_name,
_In_ const char* domain,
_In_ int version,
_In_opt_ const char** type_constraint_names,
_In_opt_ const ONNXTensorElementDataType* type_constraint_values,
_In_opt_ int type_constraint_count,
_In_opt_ const OrtOpAttr* const* attr_values,
_In_opt_ int attr_count,
_Outptr_ OrtOp** ort_op);
/** \brief: Invoke the operator created by OrtApi::CreateOp
* The inputs must follow the order as specified in onnx specification
*
* \param[in] kernel context
* \param[in] operator that has been created
* \param[in] inputs
* \param[in] number of inputs
* \param[in] outputs
* \param[in] number of outputs
*
* \since Version 1.12.
*/
ORT_API2_STATUS(InvokeOp,
_In_ const OrtKernelContext* context,
_In_ const OrtOp* ort_op,
_In_ const OrtValue* const* input_values,
_In_ int input_count,
_Inout_ OrtValue* const* output_values,
_In_ int output_count);
|
Beta Was this translation helpful? Give feedback.
-
Both CreateOp and InvokeOp in c api are not wrapped yet in c++ wrapper. It seems some how python is assessing these contributed operators independent of the c api |
Beta Was this translation helpful? Give feedback.
Both CreateOp and InvokeOp in c api are not wrapped yet in c++ wrapper.
It seems it is not possible even in c api to invoke the embedded contributed operator
It seems some how python is assessing these contributed operators independent of the c api