Skip to content

Commit

Permalink
[onert] Support block quantization in CircleLoader (Samsung#13884)
Browse files Browse the repository at this point in the history
This commit updates CircleLoader and BaseLoader to support block quantization.

ONE-DCO-1.0-Signed-off-by: Hyeongseok Oh <[email protected]>
  • Loading branch information
hseok-oh authored Sep 3, 2024
1 parent 8593953 commit b104d9c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion runtime/onert/core/src/loader/BaseLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ template <typename LoaderDomain> class BaseLoader

// Helper functions
ir::Activation convertActivation(ActivationFunctionType type);
ir::DataType tensorTypeToDataType(TensorType type);
virtual ir::DataType tensorTypeToDataType(const TensorType type);
ir::OperandIndex tensorIdxToOperandIdx(int32_t tensorIdx);
flexbuffers::Map getCustomOpAttrMap(const Operator *op);

Expand Down
11 changes: 11 additions & 0 deletions runtime/onert/core/src/loader/CircleLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ class CircleLoader final : public loader::BaseLoader<LoaderDomain>
}
}

protected:
ir::DataType tensorTypeToDataType(const TensorType type) override
{
if (type == TensorType::TensorType_Q4_0)
return ir::DataType::QUANT_GGML_Q4_0;
if (type == TensorType::TensorType_Q8_0)
return ir::DataType::QUANT_GGML_Q8_0;

return BaseLoader::tensorTypeToDataType(type);
}

private:
std::unique_ptr<ir::Graph> loadSubgraph(const circle::SubGraph *circle_subg) override
{
Expand Down

0 comments on commit b104d9c

Please sign in to comment.