载入中...
搜索中...
未找到
OnnxModel.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include "common/Result.h"
7
8#include <cstddef>
9#include <cstdint>
10#include <memory>
11#include <span>
12#include <string>
13#include <vector>
14
15namespace eve::tensor {
16class OnnxCompute;
18enum class OnnxElement : int { Float32 = 1, UInt8 = 2, Int8 = 3, Int32 = 6, Int64 = 7, Bool = 9 };
19
25struct OnnxTensor {
27 std::vector<int64_t> shape;
28 std::vector<uint8_t> bytes;
29};
32 std::string name;
34};
38 uint64_t seed = 0;
39 bool requireFinite = false;
40};
43 std::vector<OnnxNamedTensor> outputs;
44 size_t dispatches = 0;
46};
49 int64_t irVersion = 0;
50 size_t nodeCount = 0, initializerBytes = 0;
51 std::vector<std::string> inputs, outputs;
52 std::vector<std::string> unsupportedNodes;
53};
54
64public:
73 [[nodiscard]] static Result<std::unique_ptr<OnnxModel>> load(std::span<const uint8_t> bytes);
75 [[nodiscard]] OnnxModelInfo info() const;
83 [[nodiscard]] Result<std::vector<OnnxNamedTensor>> run(std::span<const OnnxNamedTensor> feeds,
84 std::span<const std::string> requested = {},
85 OnnxRunOptions options = {}) const;
86
96 [[nodiscard]] Result<OnnxGpuResult> runGpu(std::span<const OnnxNamedTensor> feeds, OnnxCompute& compute,
97 std::span<const std::string> requested = {},
98 OnnxRunOptions options = {}) const;
99
100private:
101 [[nodiscard]] Result<std::vector<OnnxNamedTensor>> runInternal(std::span<const OnnxNamedTensor> feeds,
102 std::span<const std::string> requested,
103 OnnxCompute* compute, OnnxRunOptions options) const;
104 struct Impl;
105 explicit OnnxModel(std::unique_ptr<Impl> impl);
106 std::unique_ptr<Impl> impl_;
107};
108} // namespace eve::tensor
void * impl
#define EVENGINE_API_DOMAINS
Definition Export.h:110
std::uint64_t bytes
std::weak_ptr< Run > run
Definition OnnxGpgpu.cpp:25
OnnxCompute * compute
Move-only, checked operation results for the common layer.
const SquirrelValueOptions & options
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Native ONNX import and CPU/GPU execution using tensor kernels, without ONNX Runtime.
Definition OnnxModel.h:63
~OnnxModel()
Destroy model-owned graph and packed initializers; outputs remain valid.
OnnxElement
ONNX wire element types; distinct from block-quantized Tensor storage.
Definition OnnxModel.h:18
Owning GPU execution output and completed dispatch count.
Definition OnnxModel.h:42
std::vector< OnnxNamedTensor > outputs
Definition OnnxModel.h:43
OnnxTransferStats transfers
Definition OnnxModel.h:45
Owning admission report; unsupported nodes remain inspectable but cannot execute.
Definition OnnxModel.h:48
std::vector< std::string > outputs
Definition OnnxModel.h:51
std::vector< std::string > inputs
Definition OnnxModel.h:51
std::vector< std::string > unsupportedNodes
Definition OnnxModel.h:52
Owning named feed/output value.
Definition OnnxModel.h:31
Per-call deterministic RNG and optional strict finite-output diagnostic.
Definition OnnxModel.h:37
Owning ONNX boundary tensor: row-major little-endian bytes and exact integer shape.
Definition OnnxModel.h:25
std::vector< int64_t > shape
Definition OnnxModel.h:27
std::vector< uint8_t > bytes
Definition OnnxModel.h:28
Actual transfers and submissions made during one GPU run.
Definition OnnxStorage.h:26
glm::uvec4 info