From ff265be51a8075a853f6f239b3716205530fb612 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=91=D0=B0=D1=80?= =?utf8?q?=D0=B0=D0=BD=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2/AI=20Tools=20Lab=20/S?= =?utf8?q?RR/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Fri, 23 Aug 2019 20:01:44 +0900 Subject: [PATCH] [mir] Remove Scalar class (#6810) `Scalar` class is redundant because `TensorVariant` is able to represent scalars. Signed-off-by: Sergei Barannikov --- compiler/mir/include/mir/Scalar.h | 95 --------------------------------------- 1 file changed, 95 deletions(-) delete mode 100644 compiler/mir/include/mir/Scalar.h diff --git a/compiler/mir/include/mir/Scalar.h b/compiler/mir/include/mir/Scalar.h deleted file mode 100644 index ee32bd9..0000000 --- a/compiler/mir/include/mir/Scalar.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2018 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_SCALAR_H_ -#define _MIR_SCALAR_H_ - -#include -#include -#include - -#include "mir/DataType.h" - -namespace mir -{ -/** - * @brief Scalar class - */ -class Scalar -{ -public: - /** - * @brief Class for Scalar values in modelIR - * @param data Data pointer - * @param data_type Data type - * @param data_size Data size - */ - explicit Scalar(const char *data, DataType data_type, unsigned data_size) - { // NOLINT(cppcoreguidelines-pro-type-member-init, hicpp-member-init) - assert(data_size <= _max_scalar_length); - _data_type = data_type; - memcpy(_data, data, data_size); - } - - /** - * @return Pointer on data - */ - char *getRawData() { return _data; } - - /** - * @return Data type - */ - DataType getDataType() { return _data_type; } - - /** - * @return Data size - */ - int getDataSize() const - { - switch (_data_type) - { - case DataType::UNKNOWN: - return -1; - case DataType::FLOAT32: - case DataType::INT32: - return 4; - case DataType::INT64: - return 8; - default: - assert(false); - } - } - /** - * @tparam T Class of returned object - * @return Object of T type - */ - template T get() const - { - assert(static_cast(sizeof(T)) <= getDataSize()); - T result; - memcpy(&result, _data, sizeof(T)); - return result; - } - -private: - static const unsigned int _max_scalar_length = 8; - DataType _data_type; - char _data[_max_scalar_length]; -}; - -} // namespace mir - -#endif //_MIR_SCALAR_H_ -- 2.7.4