diff options
Diffstat (limited to 'compiler/mir/include/mir/TensorType.h')
-rw-r--r-- | compiler/mir/include/mir/TensorType.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/compiler/mir/include/mir/TensorType.h b/compiler/mir/include/mir/TensorType.h new file mode 100644 index 000000000..98797d687 --- /dev/null +++ b/compiler/mir/include/mir/TensorType.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _MIR_TENSOR_TYPE_H_ +#define _MIR_TENSOR_TYPE_H_ + +#include "mir/DataType.h" +#include "mir/Quantization.h" +#include "mir/Shape.h" + +namespace mir +{ + +class TensorType final +{ +public: + TensorType() = default; + + TensorType(DataType element_type, const Shape &shape) : _element_type(element_type), _shape(shape) + { + } + + TensorType(DataType element_type, const Shape &shape, const AffineQuantization &quant) + : _element_type(element_type), _shape(shape), _quantization(quant) + { + } + + DataType getElementType() const { return _element_type; } + + const Shape &getShape() const { return _shape; } + + const AffineQuantization &getQuantization() const { return _quantization; } + void setQuantization(const AffineQuantization &quant) { _quantization = quant; } + bool isQuantized() const { return !_quantization.empty(); } + +private: + DataType _element_type = DataType::UNKNOWN; + Shape _shape; + AffineQuantization _quantization; +}; + +} // namespace mir +#endif // _MIR_TENSOR_TYPE_H_ |