diff --git a/includes/ocos.h b/includes/ocos.h index 68cc9d62..b84a068b 100644 --- a/includes/ocos.h +++ b/includes/ocos.h @@ -51,7 +51,7 @@ struct OrtTensorDimensions : std::vector { } int64_t Size() const { - int64_t s = 1.; + int64_t s = 1; for (auto it = begin(); it != end(); ++it) s *= *it; return s; diff --git a/includes/onnxruntime/onnxruntime_cxx_api.h b/includes/onnxruntime/onnxruntime_cxx_api.h index f62630d9..31436761 100644 --- a/includes/onnxruntime/onnxruntime_cxx_api.h +++ b/includes/onnxruntime/onnxruntime_cxx_api.h @@ -896,13 +896,36 @@ struct CustomOpBase : OrtCustomOp { OrtCustomOp::GetOutputTypeCount = [](const OrtCustomOp* this_) { return static_cast(this_)->GetOutputTypeCount(); }; OrtCustomOp::GetOutputType = [](const OrtCustomOp* this_, size_t index) { return static_cast(this_)->GetOutputType(index); }; - OrtCustomOp::KernelCompute = [](void* op_kernel, OrtKernelContext* context) { static_cast(op_kernel)->Compute(context); }; - OrtCustomOp::KernelDestroy = [](void* op_kernel) { delete static_cast(op_kernel); }; + OrtCustomOp::KernelCompute = [](void* op_kernel, OrtKernelContext* context) { static_cast(op_kernel)->Compute(context); }; +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(push) +#pragma warning(disable : 26409) +#endif + OrtCustomOp::KernelDestroy = [](void* op_kernel) { delete static_cast(op_kernel); }; +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(pop) +#endif OrtCustomOp::GetInputCharacteristic = [](const OrtCustomOp* this_, size_t index) { return static_cast(this_)->GetInputCharacteristic(index); }; OrtCustomOp::GetOutputCharacteristic = [](const OrtCustomOp* this_, size_t index) { return static_cast(this_)->GetOutputCharacteristic(index); }; } + template + TKernel* CreateKernelImpl(Args&&... args) const { +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(push) +#pragma warning(disable : 26409) +#endif + return new TKernel(std::forward(args)...); +#if defined(_MSC_VER) && !defined(__clang__) +#pragma warning(pop) +#endif + } + + void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { + return CreateKernelImpl(api); + } + // Default implementation of GetExecutionProviderType that returns nullptr to default to the CPU provider const char* GetExecutionProviderType() const { return nullptr; } diff --git a/operators/cv2/gaussian_blur.hpp b/operators/cv2/gaussian_blur.hpp index 4d191a49..19b1b84e 100644 --- a/operators/cv2/gaussian_blur.hpp +++ b/operators/cv2/gaussian_blur.hpp @@ -77,8 +77,4 @@ struct CustomOpGaussianBlur : Ort::CustomOpBase { - void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelInverse(api); - } - const char* GetName() const { return "Inverse"; } diff --git a/operators/math/negpos.hpp b/operators/math/negpos.hpp index 969b0985..ec73767e 100644 --- a/operators/math/negpos.hpp +++ b/operators/math/negpos.hpp @@ -40,10 +40,6 @@ struct KernelNegPos : BaseKernel { }; struct CustomOpNegPos : Ort::CustomOpBase { - void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelNegPos(api); - } - const char* GetName() const{ return "NegPos"; } diff --git a/operators/math/segement_extraction.cc b/operators/math/segement_extraction.cc index e6c5bcb6..aee5da3e 100644 --- a/operators/math/segement_extraction.cc +++ b/operators/math/segement_extraction.cc @@ -51,10 +51,6 @@ ONNXTensorElementDataType CustomOpSegmentExtraction::GetOutputType(size_t /*inde return ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64; }; -void* CustomOpSegmentExtraction::CreateKernel(const OrtApi& api, const OrtKernelInfo* /* info */) const { - return new KernelSegmentExtraction(api); -}; - const char* CustomOpSegmentExtraction::GetName() const { return "SegmentExtraction"; }; diff --git a/operators/math/segment_extraction.hpp b/operators/math/segment_extraction.hpp index 13c18a00..8ff1c720 100644 --- a/operators/math/segment_extraction.hpp +++ b/operators/math/segment_extraction.hpp @@ -16,6 +16,5 @@ struct CustomOpSegmentExtraction : Ort::CustomOpBase(n_elements); @@ -53,10 +50,6 @@ ONNXTensorElementDataType CustomOpRaggedTensorToSparse::GetOutputType(size_t /*i return ONNX_TENSOR_ELEMENT_DATA_TYPE_INT64; }; -void* CustomOpRaggedTensorToSparse::CreateKernel(const OrtApi& api, const OrtKernelInfo* /* info */) const { - return new KernelRaggedTensorToSparse(api); -}; - const char* CustomOpRaggedTensorToSparse::GetName() const { return "RaggedTensorToSparse"; }; @@ -135,7 +128,7 @@ ONNXTensorElementDataType CustomOpRaggedTensorToDense::GetOutputType(size_t /*in }; void* CustomOpRaggedTensorToDense::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelRaggedTensorToDense(api, info); + return CreateKernelImpl(api, info); }; const char* CustomOpRaggedTensorToDense::GetName() const { @@ -194,7 +187,7 @@ ONNXTensorElementDataType CustomOpStringRaggedTensorToDense::GetOutputType(size_ }; void* CustomOpStringRaggedTensorToDense::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelStringRaggedTensorToDense(api, info); + return CreateKernelImpl(api, info); }; const char* CustomOpStringRaggedTensorToDense::GetName() const { diff --git a/operators/text/op_ragged_tensor.hpp b/operators/text/op_ragged_tensor.hpp index 66a955ae..097be561 100644 --- a/operators/text/op_ragged_tensor.hpp +++ b/operators/text/op_ragged_tensor.hpp @@ -6,7 +6,9 @@ #include "ocos.h" struct KernelRaggedTensorToSparse : BaseKernel { - KernelRaggedTensorToSparse(const OrtApi& api); + KernelRaggedTensorToSparse(const OrtApi& api) + : BaseKernel(api) {} + void Compute(OrtKernelContext* context); }; @@ -15,7 +17,6 @@ struct CustomOpRaggedTensorToSparse : Ort::CustomOpBase { - void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const; const char* GetName() const; size_t GetInputTypeCount() const; ONNXTensorElementDataType GetInputType(size_t index) const; diff --git a/operators/text/string_ecmaregex_replace.cc b/operators/text/string_ecmaregex_replace.cc index d6416be1..5c0da254 100644 --- a/operators/text/string_ecmaregex_replace.cc +++ b/operators/text/string_ecmaregex_replace.cc @@ -71,7 +71,7 @@ void KernelStringECMARegexReplace::Compute(OrtKernelContext* context) { } void* CustomOpStringECMARegexReplace::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelStringECMARegexReplace(api, info); + return CreateKernelImpl(api, info); }; const char* CustomOpStringECMARegexReplace::GetName() const { return "StringECMARegexReplace"; }; diff --git a/operators/text/string_ecmaregex_split.cc b/operators/text/string_ecmaregex_split.cc index 2e9350f1..a29b423b 100644 --- a/operators/text/string_ecmaregex_split.cc +++ b/operators/text/string_ecmaregex_split.cc @@ -85,7 +85,7 @@ void KernelStringECMARegexSplitWithOffsets::Compute(OrtKernelContext* context) { } void* CustomOpStringECMARegexSplitWithOffsets::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelStringECMARegexSplitWithOffsets(api, info); + return CreateKernelImpl(api, info); }; const char* CustomOpStringECMARegexSplitWithOffsets::GetName() const { return "StringECMARegexSplitWithOffsets"; }; diff --git a/operators/text/string_hash.cc b/operators/text/string_hash.cc index 02254609..55d37a30 100644 --- a/operators/text/string_hash.cc +++ b/operators/text/string_hash.cc @@ -43,10 +43,6 @@ void KernelStringHash::Compute(OrtKernelContext* context) { } } -void* CustomOpStringHash::CreateKernel(const OrtApi& api, const OrtKernelInfo* /* info */) const { - return new KernelStringHash(api); -}; - const char* CustomOpStringHash::GetName() const { return "StringToHashBucket"; }; size_t CustomOpStringHash::GetInputTypeCount() const { @@ -106,10 +102,6 @@ void KernelStringHashFast::Compute(OrtKernelContext* context) { } } -void* CustomOpStringHashFast::CreateKernel(const OrtApi& api, const OrtKernelInfo* /* info */) const { - return new KernelStringHashFast(api); -}; - const char* CustomOpStringHashFast::GetName() const { return "StringToHashBucketFast"; }; size_t CustomOpStringHashFast::GetInputTypeCount() const { diff --git a/operators/text/string_hash.hpp b/operators/text/string_hash.hpp index 1f1ecae7..7d2c025c 100644 --- a/operators/text/string_hash.hpp +++ b/operators/text/string_hash.hpp @@ -12,7 +12,6 @@ struct KernelStringHash : BaseKernel { }; struct CustomOpStringHash : Ort::CustomOpBase { - void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const; const char* GetName() const; size_t GetInputTypeCount() const; ONNXTensorElementDataType GetInputType(size_t index) const; @@ -26,7 +25,6 @@ struct KernelStringHashFast : BaseKernel { }; struct CustomOpStringHashFast : Ort::CustomOpBase { - void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const; const char* GetName() const; size_t GetInputTypeCount() const; ONNXTensorElementDataType GetInputType(size_t index) const; diff --git a/operators/text/string_join.cc b/operators/text/string_join.cc index f44122da..975564ea 100644 --- a/operators/text/string_join.cc +++ b/operators/text/string_join.cc @@ -86,10 +86,6 @@ void KernelStringJoin::Compute(OrtKernelContext* context) { FillTensorDataString(api_, ort_, context, out, output); } -void* CustomOpStringJoin::CreateKernel(const OrtApi& api, const OrtKernelInfo* /* info */) const { - return new KernelStringJoin(api); -}; - const char* CustomOpStringJoin::GetName() const { return "StringJoin"; }; diff --git a/operators/text/string_join.hpp b/operators/text/string_join.hpp index 5ae9249e..54dbd33d 100644 --- a/operators/text/string_join.hpp +++ b/operators/text/string_join.hpp @@ -12,7 +12,6 @@ struct KernelStringJoin : BaseKernel { }; struct CustomOpStringJoin : Ort::CustomOpBase { - void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const; const char* GetName() const; size_t GetInputTypeCount() const; ONNXTensorElementDataType GetInputType(size_t index) const; diff --git a/operators/text/string_length.cc b/operators/text/string_length.cc index bb0706a3..7cd880b8 100644 --- a/operators/text/string_length.cc +++ b/operators/text/string_length.cc @@ -27,10 +27,6 @@ void KernelStringLength::Compute(OrtKernelContext* context) { } } -void* CustomOpStringLength::CreateKernel(const OrtApi& api, const OrtKernelInfo* /* info */) const { - return new KernelStringLength(api); -}; - const char* CustomOpStringLength::GetName() const { return "StringLength"; }; size_t CustomOpStringLength::GetInputTypeCount() const { diff --git a/operators/text/string_length.hpp b/operators/text/string_length.hpp index 5e093017..b01a74d4 100644 --- a/operators/text/string_length.hpp +++ b/operators/text/string_length.hpp @@ -12,7 +12,6 @@ struct KernelStringLength : BaseKernel { }; struct CustomOpStringLength : Ort::CustomOpBase { - void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const; const char* GetName() const; size_t GetInputTypeCount() const; ONNXTensorElementDataType GetInputType(size_t index) const; diff --git a/operators/text/string_lower.cc b/operators/text/string_lower.cc index 286c1fdd..3bbb4258 100644 --- a/operators/text/string_lower.cc +++ b/operators/text/string_lower.cc @@ -25,10 +25,6 @@ void KernelStringLower::Compute(OrtKernelContext* context) { FillTensorDataString(api_, ort_, context, X, output); } -void* CustomOpStringLower::CreateKernel(const OrtApi& api, const OrtKernelInfo* /* info */) const { - return new KernelStringLower(api); -}; - const char* CustomOpStringLower::GetName() const { return "StringLower"; }; size_t CustomOpStringLower::GetInputTypeCount() const { diff --git a/operators/text/string_lower.hpp b/operators/text/string_lower.hpp index fff17044..38f8b367 100644 --- a/operators/text/string_lower.hpp +++ b/operators/text/string_lower.hpp @@ -12,7 +12,6 @@ struct KernelStringLower : BaseKernel { }; struct CustomOpStringLower : Ort::CustomOpBase { - void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const; const char* GetName() const; size_t GetInputTypeCount() const; ONNXTensorElementDataType GetInputType(size_t index) const; diff --git a/operators/text/string_mapping.cc b/operators/text/string_mapping.cc index e39cc036..fa52bd6a 100644 --- a/operators/text/string_mapping.cc +++ b/operators/text/string_mapping.cc @@ -42,7 +42,7 @@ void KernelStringMapping::Compute(OrtKernelContext* context) { } void* CustomOpStringMapping::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelStringMapping(api, info); + return CreateKernelImpl(api, info); }; const char* CustomOpStringMapping::GetName() const { return "StringMapping"; }; diff --git a/operators/text/string_split.cc b/operators/text/string_split.cc index cef9bc34..efbae163 100644 --- a/operators/text/string_split.cc +++ b/operators/text/string_split.cc @@ -96,10 +96,6 @@ void KernelStringSplit::Compute(OrtKernelContext* context) { FillTensorDataString(api_, ort_, context, words, out_text); } -void* CustomOpStringSplit::CreateKernel(const OrtApi& api, const OrtKernelInfo* /* info */) const { - return new KernelStringSplit(api); -}; - const char* CustomOpStringSplit::GetName() const { return "StringSplit"; }; diff --git a/operators/text/string_split.hpp b/operators/text/string_split.hpp index f1eb15a2..b6c5e10f 100644 --- a/operators/text/string_split.hpp +++ b/operators/text/string_split.hpp @@ -12,7 +12,6 @@ struct KernelStringSplit : BaseKernel { }; struct CustomOpStringSplit : Ort::CustomOpBase { - void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const; const char* GetName() const; size_t GetInputTypeCount() const; ONNXTensorElementDataType GetInputType(size_t index) const; diff --git a/operators/text/string_to_vector.cc b/operators/text/string_to_vector.cc index 75c874cf..bac31922 100644 --- a/operators/text/string_to_vector.cc +++ b/operators/text/string_to_vector.cc @@ -133,7 +133,7 @@ void KernelStringToVector::Compute(OrtKernelContext* context) { } void* CustomOpStringToVector::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelStringToVector(api, info); + return CreateKernelImpl(api, info); }; const char* CustomOpStringToVector::GetName() const { return "StringToVector"; }; diff --git a/operators/text/string_upper.cc b/operators/text/string_upper.cc index 2713ef6b..8c1853ca 100644 --- a/operators/text/string_upper.cc +++ b/operators/text/string_upper.cc @@ -26,10 +26,6 @@ void KernelStringUpper::Compute(OrtKernelContext* context) { FillTensorDataString(api_, ort_, context, X, output); } -void* CustomOpStringUpper::CreateKernel(const OrtApi& api, const OrtKernelInfo* /* info */) const { - return new KernelStringUpper(api); -}; - const char* CustomOpStringUpper::GetName() const { return "StringUpper"; }; size_t CustomOpStringUpper::GetInputTypeCount() const { diff --git a/operators/text/string_upper.hpp b/operators/text/string_upper.hpp index 5a41e9e6..10cdbb5b 100644 --- a/operators/text/string_upper.hpp +++ b/operators/text/string_upper.hpp @@ -12,7 +12,6 @@ struct KernelStringUpper : BaseKernel { }; struct CustomOpStringUpper : Ort::CustomOpBase { - void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const; const char* GetName() const; size_t GetInputTypeCount() const; ONNXTensorElementDataType GetInputType(size_t index) const; diff --git a/operators/text/vector_to_string.cc b/operators/text/vector_to_string.cc index 70a765ec..1a5d1cb6 100644 --- a/operators/text/vector_to_string.cc +++ b/operators/text/vector_to_string.cc @@ -125,7 +125,7 @@ void KernelVectorToString::Compute(OrtKernelContext* context) { } void* CustomOpVectorToString::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelVectorToString(api, info); + return CreateKernelImpl(api, info); }; const char* CustomOpVectorToString::GetName() const { return "VectorToString"; }; diff --git a/operators/tokenizer/basic_tokenizer.cc b/operators/tokenizer/basic_tokenizer.cc index 2ea7e0af..19077bec 100644 --- a/operators/tokenizer/basic_tokenizer.cc +++ b/operators/tokenizer/basic_tokenizer.cc @@ -106,7 +106,7 @@ void KernelBasicTokenizer::Compute(OrtKernelContext* context) { } void* CustomOpBasicTokenizer::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelBasicTokenizer(api, info); + return CreateKernelImpl(api, info); }; const char* CustomOpBasicTokenizer::GetName() const { return "BasicTokenizer"; }; diff --git a/operators/tokenizer/bert_tokenizer.cc b/operators/tokenizer/bert_tokenizer.cc index e4d34296..69d7ba31 100644 --- a/operators/tokenizer/bert_tokenizer.cc +++ b/operators/tokenizer/bert_tokenizer.cc @@ -318,7 +318,7 @@ void KernelBertTokenizer::Compute(OrtKernelContext* context) { } void* CustomOpBertTokenizer::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelBertTokenizer(api, info); + return CreateKernelImpl(api, info); } const char* CustomOpBertTokenizer::GetName() const { return "BertTokenizer"; } @@ -374,7 +374,7 @@ void KernelHfBertTokenizer::Compute(OrtKernelContext* context) { } void* CustomOpHfBertTokenizer::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelHfBertTokenizer(api, info); + return CreateKernelImpl(api, info); } const char* CustomOpHfBertTokenizer::GetName() const { return "HfBertTokenizer"; } diff --git a/operators/tokenizer/bert_tokenizer_decoder.cc b/operators/tokenizer/bert_tokenizer_decoder.cc index 0b21c3bd..af156922 100644 --- a/operators/tokenizer/bert_tokenizer_decoder.cc +++ b/operators/tokenizer/bert_tokenizer_decoder.cc @@ -171,7 +171,7 @@ void KernelBertTokenizerDecoder::Compute(OrtKernelContext* context) { } void* CustomOpBertTokenizerDecoder::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelBertTokenizerDecoder(api, info); + return CreateKernelImpl(api, info); }; const char* CustomOpBertTokenizerDecoder::GetName() const { return "BertTokenizerDecoder"; }; diff --git a/operators/tokenizer/blingfire_sentencebreaker.cc b/operators/tokenizer/blingfire_sentencebreaker.cc index 2e93cc55..1ab2b716 100644 --- a/operators/tokenizer/blingfire_sentencebreaker.cc +++ b/operators/tokenizer/blingfire_sentencebreaker.cc @@ -79,7 +79,7 @@ void KernelBlingFireSentenceBreaker::Compute(OrtKernelContext* context) { } void* CustomOpBlingFireSentenceBreaker::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelBlingFireSentenceBreaker(api, info); + return CreateKernelImpl(api, info); }; const char* CustomOpBlingFireSentenceBreaker::GetName() const { return "BlingFireSentenceBreaker"; }; diff --git a/operators/tokenizer/gpt2_tokenizer.cc b/operators/tokenizer/gpt2_tokenizer.cc index 439afb99..eccf0b05 100644 --- a/operators/tokenizer/gpt2_tokenizer.cc +++ b/operators/tokenizer/gpt2_tokenizer.cc @@ -583,7 +583,7 @@ void KernelBpeTokenizer::Compute(OrtKernelContext* context) { } void* CustomOpBpeTokenizer::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelBpeTokenizer(api, info); + return CreateKernelImpl(api, info); } const char* CustomOpBpeTokenizer::GetName() const { diff --git a/operators/tokenizer/sentencepiece_tokenizer.cc b/operators/tokenizer/sentencepiece_tokenizer.cc index 173abd2b..29218538 100644 --- a/operators/tokenizer/sentencepiece_tokenizer.cc +++ b/operators/tokenizer/sentencepiece_tokenizer.cc @@ -101,7 +101,7 @@ void KernelSentencepieceTokenizer::Compute(OrtKernelContext* context) { } void* CustomOpSentencepieceTokenizer::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelSentencepieceTokenizer(api, info); + return CreateKernelImpl(api, info); }; const char* CustomOpSentencepieceTokenizer::GetName() const { diff --git a/operators/tokenizer/wordpiece_tokenizer.cc b/operators/tokenizer/wordpiece_tokenizer.cc index e11d18a3..1b77e9fb 100644 --- a/operators/tokenizer/wordpiece_tokenizer.cc +++ b/operators/tokenizer/wordpiece_tokenizer.cc @@ -163,7 +163,7 @@ void KernelWordpieceTokenizer::Compute(OrtKernelContext* context) { } void* CustomOpWordpieceTokenizer::CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelWordpieceTokenizer(api, info); + return CreateKernelImpl(api, info); }; const char* CustomOpWordpieceTokenizer::GetName() const { diff --git a/pyop/pykernel.h b/pyop/pykernel.h index 94d89698..ae9dfec3 100644 --- a/pyop/pykernel.h +++ b/pyop/pykernel.h @@ -61,7 +61,7 @@ struct PyCustomOpFactory : Ort::CustomOpBaseobj_id, opdef_->attrs); + return CreateKernelImpl(api, info, opdef_->obj_id, opdef_->attrs); }; const char* GetName() const { diff --git a/test/shared_test/test_ortops.cc b/test/shared_test/test_ortops.cc index fe77be99..34699e9e 100644 --- a/test/shared_test/test_ortops.cc +++ b/test/shared_test/test_ortops.cc @@ -52,9 +52,6 @@ struct KernelOne : BaseKernel { }; struct CustomOpOne : Ort::CustomOpBase { - void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelOne(api); - }; const char* GetName() const { return "CustomOpOne"; }; @@ -98,9 +95,6 @@ struct KernelTwo : BaseKernel { }; struct CustomOpTwo : Ort::CustomOpBase { - void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelTwo(api); - }; const char* GetName() const { return "CustomOpTwo"; }; @@ -146,8 +140,8 @@ struct KernelThree : BaseKernel { struct CustomOpThree : Ort::CustomOpBase { void* CreateKernel(const OrtApi& api, const OrtKernelInfo* info) const { - return new KernelThree(api, info); - }; + return CreateKernelImpl(api, info); + }; const char* GetName() const { return "CustomOpThree"; };