2 * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __ONERT_IR_TYPEINFO_H__
18 #define __ONERT_IR_TYPEINFO_H__
23 #include "ir/DataType.h"
35 explicit TypeInfo(DataType type, float scale = 0, int32_t offset = 0)
36 : _type(type), _scale(scale), _offset(offset), _sparse(false)
41 DataType type() const { return _type; }
42 float scale() const { return _scale; }
43 int32_t offset() const { return _offset; }
44 bool sparse() const { return _sparse; }
45 const uint16_t *w1_segments() const { return _w1_segments.data(); }
46 const uint16_t *w1_indices() const { return _w1_indices.data(); }
49 void type(const DataType type) { _type = type; }
50 void sparse2DMetadata(std::vector<uint16_t> &&w1_segments, std::vector<uint16_t> &&w1_indices)
53 _w1_segments = w1_segments;
54 _w1_indices = w1_indices;
64 std::vector<uint16_t> _w1_segments;
65 std::vector<uint16_t> _w1_indices;
68 bool operator==(const TypeInfo &lhs, const TypeInfo &rhs);
69 bool operator!=(const TypeInfo &lhs, const TypeInfo &rhs);
74 #endif // __ONERT_IR_TYPEINFO_H__