Native ONNX import and CPU/GPU execution using tensor kernels, without ONNX Runtime. 更多...
#include <OnnxModel.h>
类 | |
| struct | Impl |
Public 成员函数 | |
| ~OnnxModel () | |
| Destroy model-owned graph and packed initializers; outputs remain valid. | |
| OnnxModelInfo | info () const |
| Return owning graph diagnostics; importing does not imply full operator support. | |
| Result< std::vector< OnnxNamedTensor > > | run (std::span< const OnnxNamedTensor > feeds, std::span< const std::string > requested={}, OnnxRunOptions options={}) const |
| Execute selected named values, or graph outputs when requested is empty. | |
| Result< OnnxGpuResult > | runGpu (std::span< const OnnxNamedTensor > feeds, OnnxCompute &compute, std::span< const std::string > requested={}, OnnxRunOptions options={}) const |
| Execute with GPU matrix, convolution, normalization, activation and resampling kernels. | |
静态 Public 成员函数 | |
| static Result< std::unique_ptr< OnnxModel > > | load (std::span< const uint8_t > bytes) |
| Import bounded in-memory ONNX ModelProto; copies all retained data. | |
详细描述
Native ONNX import and CPU/GPU execution using tensor kernels, without ONNX Runtime.
- 注解
- Owns immutable model data. Concurrent CPU run calls are independent; no script callbacks, global RNG or background threads. runGpu uses a caller-provided device on its owning thread. FP32 results use tolerance comparison. Seeded random excitation is local to a run. Loading is transactional. Unknown protobuf metadata is ignored, unknown operators are reported; unsupported semantic features fail explicitly, never become identity.
在文件 OnnxModel.h 第 63 行定义.
构造及析构函数说明
◆ ~OnnxModel()
|
default |
Destroy model-owned graph and packed initializers; outputs remain valid.
成员函数说明
◆ info()
| OnnxModelInfo eve::tensor::OnnxModel::info | ( | ) | const |
Return owning graph diagnostics; importing does not imply full operator support.
在文件 OnnxModel.cpp 第 12 行定义.
◆ load()
|
static |
Import bounded in-memory ONNX ModelProto; copies all retained data.
- 参数
-
bytes Borrowed input, not retained. Maximum 512 MiB, 100000 recursive nodes, graph depth 16, rank 6.
- 返回
- Owning model or ParseError/Unsupported/UnknownVersion; no partial publication.
- 注解
- Supports ONNX IR 3..10 and default-domain opset 13..17. External data is rejected.
在文件 OnnxModel.cpp 第 13 行定义.
引用了 bytes, eve::tensor::onnx_detail::Failure::code, eve::Diagnostic::error(), eve::Failed, impl , 以及 eve::tensor::onnx_detail::parse().
◆ run()
| Result< std::vector< OnnxNamedTensor > > eve::tensor::OnnxModel::run | ( | std::span< const OnnxNamedTensor > | feeds, |
| std::span< const std::string > | requested = {}, |
||
| OnnxRunOptions | options = {} |
||
| ) | const |
Execute selected named values, or graph outputs when requested is empty.
- 参数
-
feeds Borrowed inputs, valid only during this call; never mutated or retained. requested Borrowed output names; intermediate outputs may be selected for parity tests.
- 返回
- Owning outputs or structured node diagnostic; failed calls publish no outputs.
- 注解
- CPU only. Unsupported dependencies fail before executing the selected subgraph.
在文件 OnnxModel.cpp 第 26 行定义.
引用了 options.
◆ runGpu()
| Result< OnnxGpuResult > eve::tensor::OnnxModel::runGpu | ( | std::span< const OnnxNamedTensor > | feeds, |
| OnnxCompute & | compute, | ||
| std::span< const std::string > | requested = {}, |
||
| OnnxRunOptions | options = {} |
||
| ) | const |
Execute with GPU matrix, convolution, normalization, activation and resampling kernels.
- 注解
- Shape/index/control operations, padding and LSTM gates execute on CPU. Dynamic quantization reads three validation scalars; activations remain on GPU. Integer GEMM/Conv, LSTM projections, FP32 GEMM/ConvTranspose, elementwise math, Softmax, sum/mean reductions, normalization, Resize and CumSum execute on GPU. The borrowed compute provider must outlive this synchronous call; use its device thread. No automatic CPU retry occurs after a GPU error. Outputs own their storage.
在文件 OnnxModel.cpp 第 31 行定义.
引用了 bytes, compute, count, device, eve::tensor::OnnxCompute::endRun(), eve::Result< T >::failure(), inputs, options, r, scope, source, eve::Result< T >::success(), t , 以及 target.
该类的文档由以下文件生成:
- src/modules/tensor/OnnxModel.h
- src/modules/tensor/OnnxModel.cpp