-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revise sign #6581
Merged
Merged
Revise sign #6581
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
96abdd4
update docs
pszmel fefb704
add sign to intActivationTypes
pszmel ad0d5c4
add RTTI macro
pszmel e855ea7
update backend test
pszmel 1c5bba1
add type prp test
pszmel c672b1d
add visitor test
pszmel 77efc49
add visitor and type_prop test to CMakeList
pszmel c378e30
add sign to constants.py
pszmel 26383ee
Merge remote-tracking branch 'upstream/master' into revise_sign
pszmel dd55e7c
Merge remote-tracking branch 'upstream/master' into revise_sign
pszmel 46fc02b
Merge remote-tracking branch 'upstream/master' into revise_sign
pszmel eab6fa0
Merge remote-tracking branch 'upstream/master' into revise_sign
pszmel 38951c1
Merge remote-tracking branch 'upstream/master' into revise_sign
pszmel 6840276
Merge remote-tracking branch 'upstream/master' into revise_sign
pszmel e63d273
delete backend tests and create new reference tests
pszmel 57e64f2
style fix
pszmel 15aab0c
remoove sign backend test from CMakeList
pszmel 974d36e
create reference test for all supported types
pszmel 49cb141
Merge remote-tracking branch 'upstream/master' into revise_sign
pszmel 723ad2e
remove boolean type from evaluate method
pszmel 05ec6c3
Merge remote-tracking branch 'upstream/master' into revise_sign
pszmel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
75 changes: 75 additions & 0 deletions
75
docs/template_plugin/tests/functional/op_reference/sign.cpp
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,75 @@ | ||
// Copyright (C) 2018-2021 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include <ie_core.hpp> | ||
#include <ie_ngraph_utils.hpp> | ||
#include <ngraph/ngraph.hpp> | ||
#include <shared_test_classes/base/layer_test_utils.hpp> | ||
#include <tuple> | ||
|
||
#include "base_reference_test.hpp" | ||
|
||
using namespace ngraph; | ||
using namespace InferenceEngine; | ||
|
||
struct SignParams { | ||
template <class IT, class OT> | ||
SignParams(const ngraph::PartialShape& shape, const ngraph::element::Type& iType, const ngraph::element::Type& oType, const std::vector<IT>& iValues, | ||
const std::vector<OT>& oValues, size_t iSize = 0, size_t oSize = 0) | ||
: pshape(shape), inType(iType), outType(oType), inputData(CreateBlob(iType, iValues, iSize)), refData(CreateBlob(oType, oValues, oSize)) {} | ||
ngraph::PartialShape pshape; | ||
ngraph::element::Type inType; | ||
ngraph::element::Type outType; | ||
InferenceEngine::Blob::Ptr inputData; | ||
InferenceEngine::Blob::Ptr refData; | ||
}; | ||
|
||
class ReferenceSignLayerTest : public testing::TestWithParam<SignParams>, public CommonReferenceTest { | ||
public: | ||
void SetUp() override { | ||
auto params = GetParam(); | ||
function = CreateFunction(params.pshape, params.inType); | ||
inputData = {params.inputData}; | ||
refOutData = {params.refData}; | ||
} | ||
static std::string getTestCaseName(const testing::TestParamInfo<SignParams>& obj) { | ||
auto param = obj.param; | ||
std::ostringstream result; | ||
result << "shape=" << param.pshape << "_"; | ||
result << "iType=" << param.inType << "_"; | ||
result << "oType=" << param.outType; | ||
return result.str(); | ||
} | ||
|
||
private: | ||
static std::shared_ptr<Function> CreateFunction(const PartialShape& input_shape, const element::Type& input_type) { | ||
const auto in = std::make_shared<op::Parameter>(input_type, input_shape); | ||
const auto sign = std::make_shared<op::Sign>(in); | ||
return std::make_shared<Function>(NodeVector {sign}, ParameterVector {in}); | ||
} | ||
}; | ||
|
||
TEST_P(ReferenceSignLayerTest, CompareWithHardcodedRefs) { | ||
Exec(); | ||
} | ||
|
||
INSTANTIATE_TEST_SUITE_P( | ||
smoke_Sign_With_Hardcoded_Refs, ReferenceSignLayerTest, | ||
::testing::Values( | ||
// destination boolean | ||
SignParams(ngraph::PartialShape {6}, ngraph::element::f32, ngraph::element::f32, | ||
ilyachur marked this conversation as resolved.
Show resolved
Hide resolved
|
||
std::vector<float> {1, -2, 0, -4.8f, 4.8f, -0.0f}, | ||
std::vector<float> {1, -1, 0, -1, 1, 0}), | ||
SignParams(ngraph::PartialShape {6}, ngraph::element::i16, ngraph::element::i16, | ||
std::vector<int16_t> {1, -2, 0, -4, 4, -0}, | ||
std::vector<int16_t> {1, -1, 0, -1, 1, 0}), | ||
SignParams(ngraph::PartialShape {6}, ngraph::element::i32, ngraph::element::i32, | ||
std::vector<int32_t> {1, -2, 0, -4, 4, -0}, | ||
std::vector<int32_t> {1, -1, 0, -1, 1, 0}), | ||
SignParams(ngraph::PartialShape {6}, ngraph::element::i64, ngraph::element::i64, | ||
std::vector<int64_t> {1, -2, 0, -4, 4, -0}, | ||
std::vector<int64_t> {1, -1, 0, -1, 1, 0})), | ||
ReferenceSignLayerTest::getTestCaseName); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,6 +92,7 @@ | |
'ShapeOf-1', | ||
'ShapeOf-3', | ||
'Sigmoid-1', | ||
'Sign-1', | ||
'Sin-1', | ||
'Sinh-1' | ||
'SoftPlus-4', | ||
|
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
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 was deleted.
Oops, something went wrong.
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
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,9 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "unary_ops.hpp" | ||
|
||
using Type = ::testing::Types<ngraph::op::Sign>; | ||
|
||
INSTANTIATE_TYPED_TEST_SUITE_P(type_prop_sign, UnaryOperator, Type); |
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,11 @@ | ||
// Copyright (C) 2018-2021 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "unary_ops.hpp" | ||
using Type = ::testing::Types<UnaryOperatorType<ngraph::op::v0::Sign, element::f32>>; | ||
|
||
INSTANTIATE_TYPED_TEST_SUITE_P(visitor_without_attribute, | ||
UnaryOperatorVisitor, | ||
Type, | ||
UnaryOperatorTypeName); |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that you need to have
iSize
,oSize
. You always work with default typesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, removed.