Skip to main content

Dequant.h File

Dequant Node — CVU kernel that dequantizes INT8 to FP32 (scale + zero-point). More...

Included Headers

#include "builder/Node.h" #include "builder/NodeContractConfigurable.h" #include "builder/NodeContractProvider.h" #include <cstdint> #include <memory> #include <optional> #include <string> #include <vector>

Namespaces Index

namespacesimaai
namespaceneat
namespacenodes

Classes Index

structDequantOptions

Construction options for a Dequant Node. More...

classDequant

CVU kernel Node that dequantizes INT8 tensors to FP32 using scale + zero-point. More...

Description

Dequant Node — CVU kernel that dequantizes INT8 to FP32 (scale + zero-point).

Reads INT8 tensors and emits FP32 using the per-tensor scale and zero-point bound to the model. Inserted after MLA stages on the INT8 path so downstream postprocess (argmax, NMS, etc.) sees float values.

See Also

"The dtype contract" page in /concepts/dtype_contract

File Listing

The file content with the documentation metadata removed is:

1
12#pragma once
13
14#include "builder/Node.h"
15#include "builder/NodeContractConfigurable.h"
16#include "builder/NodeContractProvider.h"
17
18#include <cstdint>
19#include <memory>
20#include <optional>
21#include <string>
22#include <vector>
23
24namespace simaai::neat {
25class Model;
26struct CompiledDequantContract;
27struct CompiledProcessCvuContract;
28
36 DequantOptions() = default;
38 explicit DequantOptions(const simaai::neat::Model& model);
39
40 std::string element_name;
41 std::string stage_id;
42 bool model_managed = false;
43
44 std::optional<double>
46 std::optional<std::int64_t>
48 std::shared_ptr<const CompiledDequantContract>
50 std::shared_ptr<const CompiledProcessCvuContract>
53
54 int num_buffers = 0;
56 bool num_buffers_locked = false;
57};
58
70class Dequant final : public Node, public NodeContractProvider, public NodeContractConfigurable {
71public:
73 explicit Dequant(DequantOptions opt = {});
74 struct ConfigHolder;
75
77 std::string kind() const override {
78 return "Dequant";
79 }
81 NodeCapsBehavior caps_behavior() const override {
82 return NodeCapsBehavior::Static;
83 }
87 bool compile_node_contract(const ContractCompileInput& input, CompiledNodeContract* out,
88 std::string* err) const override;
90 void apply_compiled_contract(const CompiledNodeContract& contract, std::string* err) override;
91
93 std::string backend_fragment(int node_index) const override;
95 std::vector<std::string> element_names(int node_index) const override;
96
98 const DequantOptions& options() const {
99 return opt_;
100 }
101
102#ifdef SIMA_NEAT_INTERNAL
103 const std::optional<CompiledDequantContract>& compiled_contract_internal() const;
104#endif
105
106private:
107 DequantOptions opt_;
108 std::shared_ptr<ConfigHolder> config_holder_;
109};
110
111} // namespace simaai::neat
112
113namespace simaai::neat::nodes {
115std::shared_ptr<simaai::neat::Node> Dequant(DequantOptions opt = {});
116} // namespace simaai::neat::nodes

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.