summaryrefslogtreecommitdiff
path: root/runtime/onert/core/include/ir/TypeInfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/onert/core/include/ir/TypeInfo.h')
-rw-r--r--runtime/onert/core/include/ir/TypeInfo.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/runtime/onert/core/include/ir/TypeInfo.h b/runtime/onert/core/include/ir/TypeInfo.h
index 07d82b6a7..3f7eab4c0 100644
--- a/runtime/onert/core/include/ir/TypeInfo.h
+++ b/runtime/onert/core/include/ir/TypeInfo.h
@@ -18,6 +18,7 @@
#define __ONERT_IR_TYPEINFO_H__
#include <cstdint>
+#include <vector>
#include "ir/DataType.h"
@@ -32,7 +33,7 @@ public:
TypeInfo() = delete;
explicit TypeInfo(DataType type, float scale = 0, int32_t offset = 0)
- : _type(type), _scale(scale), _offset(offset)
+ : _type(type), _scale(scale), _offset(offset), _sparse(false)
{
}
@@ -40,14 +41,28 @@ public:
DataType type() const { return _type; }
float scale() const { return _scale; }
int32_t offset() const { return _offset; }
+ bool sparse() const { return _sparse; }
+ const uint16_t *w1_segments() const { return _w1_segments.data(); }
+ const uint16_t *w1_indices() const { return _w1_indices.data(); }
public:
void type(const DataType type) { _type = type; }
+ void sparse2DMetadata(std::vector<uint16_t> &&w1_segments, std::vector<uint16_t> &&w1_indices)
+ {
+ _sparse = true;
+ _w1_segments = w1_segments;
+ _w1_indices = w1_indices;
+ }
private:
DataType _type;
+ // for quantization
float _scale;
int32_t _offset;
+ // for sparsity
+ bool _sparse;
+ std::vector<uint16_t> _w1_segments;
+ std::vector<uint16_t> _w1_indices;
};
bool operator==(const TypeInfo &lhs, const TypeInfo &rhs);