From: 박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 Date: Wed, 5 Dec 2018 04:12:09 +0000 (+0900) Subject: [enco] Introduce extended coco IR (#2496) X-Git-Tag: nncc_backup~1199 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fc322a57dbd6ae14a748a8d31be1b58f4d27dff9;p=platform%2Fcore%2Fml%2Fnnfw.git [enco] Introduce extended coco IR (#2496) This commit introduces a placeholder for extended coco IR entities. The current implementation includes only one extended instruction (ANNDepthConcatF). Signed-off-by: Jonghyun Park --- diff --git a/contrib/enco/core/src/coex/IR.h b/contrib/enco/core/src/coex/IR.h new file mode 100644 index 0000000..a80d64e --- /dev/null +++ b/contrib/enco/core/src/coex/IR.h @@ -0,0 +1,56 @@ +/* + * 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 __ENCO_COEX_IR_H__ +#define __ENCO_COEX_IR_H__ + +#include + +/** + * @brief Concatenate feature maps along "depth" dimension through Andoird NN API + */ +class ANNDepthConcatF : public coco::Instr, + public coco::Object::Producer, + public coco::Object::Consumer +{ +public: + ANNDepthConcatF() : _out{this}, _fst{this}, _snd{this} + { + // DO NOTHING + } + +public: + coco::Instr *loc(void) override { return this; } + +public: + coco::Object *out(void) const { return _out.value(); } + void out(coco::Object *o) { _out.value(o); } + + coco::Object *fst(void) const { return _fst.value(); } + void fst(coco::Object *o) { _fst.value(o); } + + coco::Object *snd(void) const { return _snd.value(); } + void snd(coco::Object *o) { _snd.value(o); } + +private: + coco::Def _out; + + // TODO Support variadic-length inputs + coco::Use _fst; + coco::Use _snd; +}; + +#endif // __ENCO_COEX_IR_H__ diff --git a/contrib/enco/core/src/coex/IR.test.cpp b/contrib/enco/core/src/coex/IR.test.cpp new file mode 100644 index 0000000..9d8389a --- /dev/null +++ b/contrib/enco/core/src/coex/IR.test.cpp @@ -0,0 +1,28 @@ +/* + * 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. + */ + +#include "IR.h" + +#include + +TEST(IRTest, ANNDepthConcatF_default_constructor) +{ + ANNDepthConcatF ins; + + ASSERT_EQ(ins.out(), nullptr); + ASSERT_EQ(ins.fst(), nullptr); + ASSERT_EQ(ins.snd(), nullptr); +}