From bbf9b04d39eaf9a4ade63b4b8e6ea42c2913685d Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Fri, 17 May 2019 08:51:20 +0900 Subject: [PATCH] [loco] Introduce Domain enum class (#3500) * [loco] Introduce Domain enum class This commit introduces Domain enum class which denotes the kind of a loco value. Signed-off-by: Jonghyun Park * Update comment --- contrib/loco/include/loco/IR/Domain.h | 49 +++++++++++++++++++++++++++++++++++ contrib/loco/src/IR/Domain.cpp | 19 ++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 contrib/loco/include/loco/IR/Domain.h create mode 100644 contrib/loco/src/IR/Domain.cpp diff --git a/contrib/loco/include/loco/IR/Domain.h b/contrib/loco/include/loco/IR/Domain.h new file mode 100644 index 0000000..c7ee4fe --- /dev/null +++ b/contrib/loco/include/loco/IR/Domain.h @@ -0,0 +1,49 @@ +/* + * 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 __LOCO_IR_DOMAIN_H__ +#define __LOCO_IR_DOMAIN_H__ + +namespace loco +{ + +/** + * @brief Describe the kind of (N-dimensional) loco values + * + * loco is an intermediate representation for neural network compiler, which mainly focuses on + * N-dimensional values (usually referred to as Tensor). + * + * There are several special cases for N-dimensional values according to its usage. For example, + * vision community often refers to 4D array as "FeatureMap". + * + * It is definitely possible to represent all of these special cases using Tensor, but that scheme + * may introduces some confusion (e.g. NCHW vs NHWC issue). + * + * loco distinguishes these special cases from Tensor in order to reduce such confusion. + * + * This "Domain" enum class enumerates all of these special cases that loco supports. + */ +enum class Domain +{ + Unknown, + Tensor, + Feature, + /* ... */ +}; + +} // namespace loco + +#endif // __LOCO_IR_DOMAIN_H__ diff --git a/contrib/loco/src/IR/Domain.cpp b/contrib/loco/src/IR/Domain.cpp new file mode 100644 index 0000000..7bad047 --- /dev/null +++ b/contrib/loco/src/IR/Domain.cpp @@ -0,0 +1,19 @@ +/* + * 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. + */ + +#include "loco/IR/Domain.h" + +// NOTE This file validates "Domain.h". Please DO NOT remove this file. -- 2.7.4