mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-06-09 00:30:53 +00:00
Remove onnxruntime_PYBIND_EXPORT_OPSCHEMA definition from onnxruntime (#15776)
This commit is contained in:
parent
41c082fdde
commit
ba7b83ff3c
7 changed files with 9 additions and 31 deletions
|
|
@ -20,10 +20,6 @@ file(GLOB onnxruntime_pybind_srcs CONFIGURE_DEPENDS
|
|||
${onnxruntime_pybind_srcs_pattern}
|
||||
)
|
||||
|
||||
if(NOT onnxruntime_PYBIND_EXPORT_OPSCHEMA)
|
||||
list(REMOVE_ITEM onnxruntime_pybind_srcs ${ONNXRUNTIME_ROOT}/python/onnxruntime_pybind_schema.cc)
|
||||
endif()
|
||||
|
||||
if(onnxruntime_ENABLE_TRAINING)
|
||||
list(REMOVE_ITEM onnxruntime_pybind_srcs ${ONNXRUNTIME_ROOT}/python/onnxruntime_pybind_module.cc)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -43,11 +43,9 @@ class KernelDef {
|
|||
*end = op_since_version_end_;
|
||||
}
|
||||
|
||||
#ifdef onnxruntime_PYBIND_EXPORT_OPSCHEMA
|
||||
const std::pair<int, int> SinceVersion() const {
|
||||
return std::pair<int, int>(op_since_version_start_, op_since_version_end_);
|
||||
}
|
||||
#endif
|
||||
|
||||
onnxruntime::ProviderType Provider() const {
|
||||
return provider_type_;
|
||||
|
|
|
|||
|
|
@ -73,12 +73,10 @@ class KernelRegistry {
|
|||
|
||||
bool IsEmpty() const { return kernel_creator_fn_map_.empty(); }
|
||||
|
||||
#ifdef onnxruntime_PYBIND_EXPORT_OPSCHEMA
|
||||
// This is used by the opkernel doc generator to enlist all registered operators for a given provider's opkernel
|
||||
const KernelCreateMap& GetKernelCreateMap() const {
|
||||
return kernel_creator_fn_map_;
|
||||
}
|
||||
#endif
|
||||
|
||||
private:
|
||||
// TryFindKernel implementation. Either kernel_type_str_resolver or type_constraints is provided.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
// This file is excluded from the build if onnxruntime_PYBIND_EXPORT_OPSCHEMA not defined
|
||||
|
||||
#include "python/onnxruntime_pybind_state_common.h"
|
||||
#include "core/framework/kernel_registry.h"
|
||||
|
|
@ -30,21 +29,19 @@ void addGlobalSchemaFunctions(pybind11::module& m) {
|
|||
}(),
|
||||
#endif
|
||||
#ifdef USE_ROCM
|
||||
onnxruntime::RocmProviderFactoryCreator::Create(
|
||||
[&]() {
|
||||
ROCMExecutionProviderInfo info{};
|
||||
info.device_id = cuda_device_id;
|
||||
info.gpu_mem_limit = gpu_mem_limit;
|
||||
info.arena_extend_strategy = arena_extend_strategy;
|
||||
info.external_allocator_info = external_allocator_info;
|
||||
return info;
|
||||
}()),
|
||||
[]() {
|
||||
OrtROCMProviderOptions provider_options;
|
||||
return onnxruntime::RocmProviderFactoryCreator::Create(&provider_options);
|
||||
}(),
|
||||
#endif
|
||||
#ifdef USE_DNNL
|
||||
onnxruntime::DnnlProviderFactoryCreator::Create(1),
|
||||
#endif
|
||||
#ifdef USE_OPENVINO
|
||||
onnxruntime::OpenVINOProviderFactoryCreator::Create(OrtOpenVINOProviderOptions()),
|
||||
[]() {
|
||||
OrtOpenVINOProviderOptions provider_options;
|
||||
return onnxruntime::OpenVINOProviderFactoryCreator::Create(&provider_options);
|
||||
}(),
|
||||
#endif
|
||||
#ifdef USE_TENSORRT
|
||||
onnxruntime::TensorrtProviderFactoryCreator::Create(0),
|
||||
|
|
@ -65,7 +62,7 @@ void addGlobalSchemaFunctions(pybind11::module& m) {
|
|||
onnxruntime::DMLProviderFactoryCreator::Create(0, /*skip_software_device_check*/ true),
|
||||
#endif
|
||||
#ifdef USE_NNAPI
|
||||
onnxruntime::NnapiProviderFactoryCreator::Create(0),
|
||||
onnxruntime::NnapiProviderFactoryCreator::Create(0, std::optional<std::string>()),
|
||||
#endif
|
||||
#ifdef USE_RKNPU
|
||||
onnxruntime::RknpuProviderFactoryCreator::Create(),
|
||||
|
|
|
|||
|
|
@ -1828,11 +1828,9 @@ void CreateInferencePybindStateModule(py::module& m) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef onnxruntime_PYBIND_EXPORT_OPSCHEMA
|
||||
addGlobalSchemaFunctions(m);
|
||||
addOpSchemaSubmodule(m);
|
||||
addOpKernelSubmodule(m);
|
||||
#endif
|
||||
}
|
||||
|
||||
void InitArray() {
|
||||
|
|
|
|||
|
|
@ -399,13 +399,11 @@ void addIoBindingMethods(pybind11::module& m);
|
|||
|
||||
void addSparseTensorMethods(pybind11::module& m);
|
||||
|
||||
#ifdef onnxruntime_PYBIND_EXPORT_OPSCHEMA
|
||||
void addGlobalSchemaFunctions(pybind11::module& m);
|
||||
|
||||
void addOpKernelSubmodule(pybind11::module& m);
|
||||
|
||||
void addOpSchemaSubmodule(pybind11::module& m);
|
||||
#endif
|
||||
|
||||
const char* GetDeviceName(const OrtDevice& device);
|
||||
|
||||
|
|
|
|||
|
|
@ -1294,13 +1294,6 @@ def generate_build_tree(
|
|||
"-Donnxruntime_USE_FULL_PROTOBUF=ON",
|
||||
]
|
||||
|
||||
if args.gen_doc:
|
||||
if args.enable_training:
|
||||
raise BuildError("--gen_doc is not supported along with --enable_training")
|
||||
add_default_definition(cmake_extra_defines, "onnxruntime_PYBIND_EXPORT_OPSCHEMA", "ON")
|
||||
else:
|
||||
add_default_definition(cmake_extra_defines, "onnxruntime_PYBIND_EXPORT_OPSCHEMA", "OFF")
|
||||
|
||||
if args.enable_lazy_tensor:
|
||||
import torch
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue