HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
customregistry.h
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License.
3 
4 #pragma once
5 
6 #include "core/common/status.h"
11 
12 #if !defined(ORT_MINIMAL_BUILD)
14 #endif
15 
16 namespace onnxruntime {
17 
18 /**
19  Represents a registry that contains both custom kernels and custom schemas.
20 */
21 class CustomRegistry final {
22  public:
24  : kernel_registry_(std::make_shared<KernelRegistry>())
25 #if !defined(ORT_MINIMAL_BUILD)
26  ,
27  opschema_registry_(std::make_shared<onnxruntime::OnnxRuntimeOpSchemaRegistry>())
28 #endif
29  {
30  }
31 
32  /**
33  * Register a kernel definition together with kernel factory method to this session.
34  * If any conflict happened between registered kernel def and built-in kernel def,
35  * registered kernel will have higher priority.
36  * Call this before invoking Initialize().
37  * @return OK if success.
38  */
39  common::Status RegisterCustomKernel(KernelDefBuilder& kernel_def_builder, const KernelCreateFn& kernel_creator);
40 
42 
43  const std::shared_ptr<KernelRegistry>& GetKernelRegistry();
44 
45 #if !defined(ORT_MINIMAL_BUILD)
46  common::Status RegisterOpSet(std::vector<ONNX_NAMESPACE::OpSchema>& schemas, const std::string& domain,
47  int baseline_opset_version, int opset_version);
48 
49  const std::shared_ptr<onnxruntime::OnnxRuntimeOpSchemaRegistry>& GetOpschemaRegistry();
50 #endif
51 
52  private:
53  ORT_DISALLOW_COPY_ASSIGNMENT_AND_MOVE(CustomRegistry);
54  std::shared_ptr<KernelRegistry> kernel_registry_;
55 #if !defined(ORT_MINIMAL_BUILD)
56  std::shared_ptr<onnxruntime::OnnxRuntimeOpSchemaRegistry> opschema_registry_;
57 #endif
58 };
59 
60 } // namespace onnxruntime
const std::shared_ptr< KernelRegistry > & GetKernelRegistry()
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
common::Status RegisterOpSet(std::vector< ONNX_NAMESPACE::OpSchema > &schemas, const std::string &domain, int baseline_opset_version, int opset_version)
const std::shared_ptr< onnxruntime::OnnxRuntimeOpSchemaRegistry > & GetOpschemaRegistry()
common::Status RegisterCustomKernel(KernelDefBuilder &kernel_def_builder, const KernelCreateFn &kernel_creator)
std::function< Status(FuncManager &func_mgr, const OpKernelInfo &info, std::unique_ptr< OpKernel > &out)> KernelCreateFn
Definition: op_kernel.h:134
if(num_boxed_items<=0)
Definition: UT_RTreeImpl.h:697