From 3664c5c0b5948ceb4d030a4f681af0fded8a5b55 Mon Sep 17 00:00:00 2001 From: pszmel Date: Mon, 10 May 2021 09:01:55 +0200 Subject: [PATCH 01/12] create type_prop tests --- ngraph/test/type_prop/unary_ops.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ngraph/test/type_prop/unary_ops.cpp b/ngraph/test/type_prop/unary_ops.cpp index f9c2160d2afe7b..3859dd7369d490 100644 --- a/ngraph/test/type_prop/unary_ops.cpp +++ b/ngraph/test/type_prop/unary_ops.cpp @@ -96,6 +96,6 @@ REGISTER_TYPED_TEST_CASE_P(UnaryOperator, dynamic_rank_input_shape_3D, dynamic_rank_input_shape_full); -using Types = ::testing::Types; +using Types = ::testing::Types; INSTANTIATE_TYPED_TEST_CASE_P(type_prop, UnaryOperator, Types); From 55dba7ffe11a5aee569d70862789911af774b31e Mon Sep 17 00:00:00 2001 From: pszmel Date: Mon, 10 May 2021 09:02:20 +0200 Subject: [PATCH 02/12] add visitors test --- ngraph/test/CMakeLists.txt | 1 + ngraph/test/visitors/op/floor.cpp | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 ngraph/test/visitors/op/floor.cpp diff --git a/ngraph/test/CMakeLists.txt b/ngraph/test/CMakeLists.txt index dd7f23d04d2eac..f90d83a2f8aec5 100644 --- a/ngraph/test/CMakeLists.txt +++ b/ngraph/test/CMakeLists.txt @@ -218,6 +218,7 @@ set(SRC visitors/op/elu.cpp visitors/op/extractimagepatches.cpp visitors/op/fake_quantize.cpp + visitors/op/floor.cpp visitors/op/grn.cpp visitors/op/group_conv.cpp visitors/op/interpolate.cpp diff --git a/ngraph/test/visitors/op/floor.cpp b/ngraph/test/visitors/op/floor.cpp new file mode 100644 index 00000000000000..3a4b026ab3e983 --- /dev/null +++ b/ngraph/test/visitors/op/floor.cpp @@ -0,0 +1,31 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "gtest/gtest.h" + +#include "ngraph/ngraph.hpp" +#include "ngraph/op/util/attr_types.hpp" +#include "ngraph/opsets/opset1.hpp" +#include "ngraph/opsets/opset3.hpp" +#include "ngraph/opsets/opset4.hpp" +#include "ngraph/opsets/opset5.hpp" + +#include "util/visitor.hpp" + +using namespace std; +using namespace ngraph; +using ngraph::test::NodeBuilder; +using ngraph::test::ValueMap; + +TEST(attributes, mod_op) +{ + NodeBuilder::get_ops().register_factory(); + auto A = make_shared(element::f32, Shape{5, 2}); + + auto floor = make_shared(A); + NodeBuilder builder(floor); + auto g_floor = as_type_ptr(builder.create()); + + EXPECT_EQ(g_mod->get_autob(), mod->get_autob()); +} From 1afa0186396da15e360d146380b52968de820464 Mon Sep 17 00:00:00 2001 From: pszmel Date: Tue, 11 May 2021 12:58:21 +0200 Subject: [PATCH 03/12] fix bug in visitor test --- ngraph/test/visitors/op/floor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ngraph/test/visitors/op/floor.cpp b/ngraph/test/visitors/op/floor.cpp index 3a4b026ab3e983..e47574b318ddb0 100644 --- a/ngraph/test/visitors/op/floor.cpp +++ b/ngraph/test/visitors/op/floor.cpp @@ -18,7 +18,7 @@ using namespace ngraph; using ngraph::test::NodeBuilder; using ngraph::test::ValueMap; -TEST(attributes, mod_op) +TEST(attributes, floor_op) { NodeBuilder::get_ops().register_factory(); auto A = make_shared(element::f32, Shape{5, 2}); @@ -27,5 +27,5 @@ TEST(attributes, mod_op) NodeBuilder builder(floor); auto g_floor = as_type_ptr(builder.create()); - EXPECT_EQ(g_mod->get_autob(), mod->get_autob()); + EXPECT_EQ(g_floor->get_autob(), floor->get_autob()); } From 64b7850284dce9cda7f805462ea4d9b5429f58c2 Mon Sep 17 00:00:00 2001 From: pszmel Date: Mon, 17 May 2021 22:14:27 +0200 Subject: [PATCH 04/12] add RTTI macro --- ngraph/core/include/ngraph/op/floor.hpp | 3 +-- ngraph/core/src/op/floor.cpp | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ngraph/core/include/ngraph/op/floor.hpp b/ngraph/core/include/ngraph/op/floor.hpp index 8cb99b158873fa..237cd68a4e73c1 100644 --- a/ngraph/core/include/ngraph/op/floor.hpp +++ b/ngraph/core/include/ngraph/op/floor.hpp @@ -16,8 +16,7 @@ namespace ngraph class NGRAPH_API Floor : public util::UnaryElementwiseArithmetic { public: - static constexpr NodeTypeInfo type_info{"Floor", 0}; - const NodeTypeInfo& get_type_info() const override { return type_info; } + NGRAPH_RTTI_DECLARATION; /// \brief Constructs a floor operation. Floor() = default; /// \brief Constructs a floor operation. diff --git a/ngraph/core/src/op/floor.cpp b/ngraph/core/src/op/floor.cpp index 74ace6debf7998..780c508d181000 100644 --- a/ngraph/core/src/op/floor.cpp +++ b/ngraph/core/src/op/floor.cpp @@ -12,8 +12,6 @@ using namespace std; using namespace ngraph; -constexpr NodeTypeInfo op::Floor::type_info; - op::Floor::Floor(const Output& arg) : UnaryElementwiseArithmetic(arg) { @@ -81,3 +79,5 @@ bool op::Floor::evaluate(const HostTensorVector& outputs, const HostTensorVector NGRAPH_OP_SCOPE(v0_Floor_evaluate); return floorop::evaluate_floor(inputs[0], outputs[0], shape_size(get_output_shape(0))); } + +NGRAPH_RTTI_DEFINITION(op::v0::Floor, "Floor", 0); \ No newline at end of file From b4bc3c65f129906dfd3b2ac27edc16b9b900f802 Mon Sep 17 00:00:00 2001 From: pszmel Date: Mon, 17 May 2021 22:14:55 +0200 Subject: [PATCH 05/12] fix bug in visitors test --- ngraph/test/visitors/op/floor.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ngraph/test/visitors/op/floor.cpp b/ngraph/test/visitors/op/floor.cpp index e47574b318ddb0..06987d43dc0671 100644 --- a/ngraph/test/visitors/op/floor.cpp +++ b/ngraph/test/visitors/op/floor.cpp @@ -7,20 +7,15 @@ #include "ngraph/ngraph.hpp" #include "ngraph/op/util/attr_types.hpp" #include "ngraph/opsets/opset1.hpp" -#include "ngraph/opsets/opset3.hpp" -#include "ngraph/opsets/opset4.hpp" -#include "ngraph/opsets/opset5.hpp" - #include "util/visitor.hpp" using namespace std; using namespace ngraph; using ngraph::test::NodeBuilder; -using ngraph::test::ValueMap; TEST(attributes, floor_op) { - NodeBuilder::get_ops().register_factory(); + NodeBuilder::get_ops().register_factory(); auto A = make_shared(element::f32, Shape{5, 2}); auto floor = make_shared(A); From ff8bda79986401d74fe61ac194b0294d61902be5 Mon Sep 17 00:00:00 2001 From: pszmel Date: Mon, 17 May 2021 22:21:15 +0200 Subject: [PATCH 06/12] add newline --- ngraph/core/src/op/floor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ngraph/core/src/op/floor.cpp b/ngraph/core/src/op/floor.cpp index 780c508d181000..1a58b997159534 100644 --- a/ngraph/core/src/op/floor.cpp +++ b/ngraph/core/src/op/floor.cpp @@ -80,4 +80,4 @@ bool op::Floor::evaluate(const HostTensorVector& outputs, const HostTensorVector return floorop::evaluate_floor(inputs[0], outputs[0], shape_size(get_output_shape(0))); } -NGRAPH_RTTI_DEFINITION(op::v0::Floor, "Floor", 0); \ No newline at end of file +NGRAPH_RTTI_DEFINITION(op::v0::Floor, "Floor", 0); From 9e2a9c53bc2e816a1abc0398cc24e9d29a1d0b58 Mon Sep 17 00:00:00 2001 From: pszmel Date: Tue, 18 May 2021 11:56:21 +0200 Subject: [PATCH 07/12] update spec --- docs/ops/arithmetic/Floor_1.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/ops/arithmetic/Floor_1.md b/docs/ops/arithmetic/Floor_1.md index f76c3b24752e8c..3343fcd8c95388 100644 --- a/docs/ops/arithmetic/Floor_1.md +++ b/docs/ops/arithmetic/Floor_1.md @@ -6,6 +6,13 @@ **Short description**: *Floor* performs element-wise floor operation with given tensor. +**Detailed description**: For each element from the input tensor calculates corresponding +element in the output tensor with the following formula: + +\f[ +a_{i} = floor(a_{i}) +\f] + **Attributes**: No attributes available. @@ -22,11 +29,6 @@ * *T*: any numeric type. -*Floor* does the following with the input tensor *a*: - -\f[ -a_{i} = floor(a_{i}) -\f] **Examples** From 1fc832b195ac19407c732f85f7002b2cb6845b59 Mon Sep 17 00:00:00 2001 From: pszmel Date: Tue, 18 May 2021 12:36:49 +0200 Subject: [PATCH 08/12] update spec --- docs/ops/arithmetic/Floor_1.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docs/ops/arithmetic/Floor_1.md b/docs/ops/arithmetic/Floor_1.md index 3343fcd8c95388..910ce43d5903b8 100644 --- a/docs/ops/arithmetic/Floor_1.md +++ b/docs/ops/arithmetic/Floor_1.md @@ -2,7 +2,7 @@ **Versioned name**: *Floor-1* -**Category**: Arithmetic unary operation +**Category**: Arithmetic unary operation **Short description**: *Floor* performs element-wise floor operation with given tensor. @@ -13,17 +13,15 @@ element in the output tensor with the following formula: a_{i} = floor(a_{i}) \f] -**Attributes**: - - No attributes available. +**Attributes**: *Floor* operation has no attributes. **Inputs** -* **1**: An tensor of type T. **Required.** +* **1**: A tensor of type *T* and arbitrary shape. **Required.** **Outputs** -* **1**: The result of element-wise floor operation. A tensor of type T. +* **1**: The result of element-wise floor operation. A tensor of type *T*. **Types** From ce0eee05a1473053aa90f7ba62624aeebe89c29e Mon Sep 17 00:00:00 2001 From: pszmel Date: Tue, 18 May 2021 13:34:34 +0200 Subject: [PATCH 09/12] update RTTI definition --- ngraph/core/src/op/floor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ngraph/core/src/op/floor.cpp b/ngraph/core/src/op/floor.cpp index 1a58b997159534..2947f60ff5e897 100644 --- a/ngraph/core/src/op/floor.cpp +++ b/ngraph/core/src/op/floor.cpp @@ -80,4 +80,4 @@ bool op::Floor::evaluate(const HostTensorVector& outputs, const HostTensorVector return floorop::evaluate_floor(inputs[0], outputs[0], shape_size(get_output_shape(0))); } -NGRAPH_RTTI_DEFINITION(op::v0::Floor, "Floor", 0); +NGRAPH_RTTI_DEFINITION(op::v0::Floor, "Floor", 0, util::UnaryElementwiseArithmetic); From ca4c46d76ec4b6a735e91fa354894a44e26238a7 Mon Sep 17 00:00:00 2001 From: pszmel Date: Tue, 18 May 2021 13:49:08 +0200 Subject: [PATCH 10/12] move RTTI definitioion to the top of he file --- ngraph/core/src/op/floor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ngraph/core/src/op/floor.cpp b/ngraph/core/src/op/floor.cpp index 2947f60ff5e897..89a6a5efda878d 100644 --- a/ngraph/core/src/op/floor.cpp +++ b/ngraph/core/src/op/floor.cpp @@ -12,6 +12,8 @@ using namespace std; using namespace ngraph; +NGRAPH_RTTI_DEFINITION(op::v0::Floor, "Floor", 0, util::UnaryElementwiseArithmetic); + op::Floor::Floor(const Output& arg) : UnaryElementwiseArithmetic(arg) { @@ -79,5 +81,3 @@ bool op::Floor::evaluate(const HostTensorVector& outputs, const HostTensorVector NGRAPH_OP_SCOPE(v0_Floor_evaluate); return floorop::evaluate_floor(inputs[0], outputs[0], shape_size(get_output_shape(0))); } - -NGRAPH_RTTI_DEFINITION(op::v0::Floor, "Floor", 0, util::UnaryElementwiseArithmetic); From ab165d7457df04009da780a30cddc061bb2e2977 Mon Sep 17 00:00:00 2001 From: jdanieck Date: Thu, 20 May 2021 13:15:14 +0200 Subject: [PATCH 11/12] Remove broadcast from attribute tests. --- ngraph/test/visitors/op/floor.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ngraph/test/visitors/op/floor.cpp b/ngraph/test/visitors/op/floor.cpp index 06987d43dc0671..57cd6011c67239 100644 --- a/ngraph/test/visitors/op/floor.cpp +++ b/ngraph/test/visitors/op/floor.cpp @@ -16,11 +16,11 @@ using ngraph::test::NodeBuilder; TEST(attributes, floor_op) { NodeBuilder::get_ops().register_factory(); - auto A = make_shared(element::f32, Shape{5, 2}); + const auto A = make_shared(element::f32, Shape{5, 2}); - auto floor = make_shared(A); + const auto floor = make_shared(A); NodeBuilder builder(floor); - auto g_floor = as_type_ptr(builder.create()); - EXPECT_EQ(g_floor->get_autob(), floor->get_autob()); + const auto expected_attr_count = 0; + EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); } From 6c7f93a8c7e6d61d602cd218269815d63ee19fff Mon Sep 17 00:00:00 2001 From: jdanieck Date: Thu, 20 May 2021 13:26:39 +0200 Subject: [PATCH 12/12] Add Floor-1 to summarize.py report. --- .../functional_test_utils/layer_tests_summary/utils/constants.py | 1 + 1 file changed, 1 insertion(+) diff --git a/inference-engine/tests/ie_test_utils/functional_test_utils/layer_tests_summary/utils/constants.py b/inference-engine/tests/ie_test_utils/functional_test_utils/layer_tests_summary/utils/constants.py index f2d02038c9a016..dba995a023b50d 100644 --- a/inference-engine/tests/ie_test_utils/functional_test_utils/layer_tests_summary/utils/constants.py +++ b/inference-engine/tests/ie_test_utils/functional_test_utils/layer_tests_summary/utils/constants.py @@ -28,6 +28,7 @@ 'ExperimentalDetectronPriorGridGenerator-6', 'ExperimentalDetectronROIFeatureExtractor-6', 'ExperimentalDetectronTopKROIs-6', + 'Floor-1' 'FloorMod-1' 'GRUSequence-5', 'Gather-1',