18 #include <onnxruntime_cxx_api.h>
41 if (!domain.
empty()) {
42 prop_name << domain <<
'.';
46 if (!graph_name.
empty()) {
47 prop_name << graph_name <<
'.';
52 return prop_name.
str();
60 for (
auto i = shape.
begin(); i != shape.
end() - 1; ++i) {
61 stream << *i <<
" x ";
63 stream << shape.
back();
70 if (property_id == PropertyId::create<OnnxProperty>()) {
82 const auto& models = onnx_config.
getModels();
84 for (
auto model_path : models) {
85 auto model = std::make_shared<OnnxModel>(model_path);
87 if (model->getInputType() != ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT) {
91 if (model->getInputShape().size() != 4) {
92 throw Elements::Exception() <<
"Expected 4 axes for the input layer, got " << model->getInputShape().size();
109 return prop.getData<T>(key);
110 },
"", model_info.
model->getModelPath()
116 switch (model_info.model->getOutputType()) {
117 case ONNX_TENSOR_ELEMENT_DATA_TYPE_FLOAT:
118 registerColumnConverter<float>(registry, model_info);
120 case ONNX_TENSOR_ELEMENT_DATA_TYPE_INT32:
121 registerColumnConverter<int32_t>(registry, model_info);
124 throw Elements::Exception() <<
"Unsupported output type: " << model_info.model->getOutputType();
void info(const std::string &logMessage)
void registerConfiguration()