forked from Samsung/ONE
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [luci] ReduceProd IR This will introduce IR for ReduceProd Op ONE-DCO-1.0-Signed-off-by: SaeHie Park <[email protected]> * remove unused header ONE-DCO-1.0-Signed-off-by: SaeHie Park <[email protected]>
- Loading branch information
1 parent
90c92db
commit f971386
Showing
4 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
compiler/luci/lang/include/luci/IR/Nodes/CircleReduceProd.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2020 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 __LUCI_IR_CIRCLE_REDUCE_PROD_H__ | ||
#define __LUCI_IR_CIRCLE_REDUCE_PROD_H__ | ||
|
||
#include "luci/IR/CircleNodeDecl.h" | ||
#include "luci/IR/CircleOpcode.h" | ||
|
||
#include "luci/IR/LuciNodeMixins.h" | ||
|
||
namespace luci | ||
{ | ||
|
||
/** | ||
* @brief REDUCE_PROD in Circle | ||
*/ | ||
class CircleReduceProd final : public FixedArityNode<2, CircleNodeImpl<CircleOpcode::REDUCE_PROD>> | ||
{ | ||
public: | ||
loco::Node *input(void) const { return at(0)->node(); } | ||
void input(loco::Node *node) { at(0)->node(node); } | ||
|
||
loco::Node *reduction_indices(void) const { return at(1)->node(); } | ||
void reduction_indices(loco::Node *node) { at(1)->node(node); } | ||
|
||
public: | ||
bool keep_dims(void) const { return _keep_dims; } | ||
void keep_dims(bool keep_dims) { _keep_dims = keep_dims; } | ||
|
||
private: | ||
bool _keep_dims = false; | ||
}; | ||
|
||
} // namespace luci | ||
|
||
#endif // __LUCI_IR_CIRCLE_REDUCE_PROD_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright (c) 2020 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 "luci/IR/Nodes/CircleReduceProd.h" | ||
|
||
#include "luci/IR/CircleDialect.h" | ||
|
||
#include <gtest/gtest.h> | ||
|
||
TEST(CircleReduceProdTest, constructor) | ||
{ | ||
luci::CircleReduceProd reduce_prod_node; | ||
|
||
ASSERT_EQ(luci::CircleDialect::get(), reduce_prod_node.dialect()); | ||
ASSERT_EQ(luci::CircleOpcode::REDUCE_PROD, reduce_prod_node.opcode()); | ||
|
||
ASSERT_EQ(nullptr, reduce_prod_node.input()); | ||
ASSERT_EQ(nullptr, reduce_prod_node.reduction_indices()); | ||
|
||
ASSERT_FALSE(reduce_prod_node.keep_dims()); | ||
} |