forked from openvinotoolkit/openvino
-
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.
* update docs * add sign to intActivationTypes * add RTTI macro * update backend test * add type prp test * add visitor test * add visitor and type_prop test to CMakeList * add sign to constants.py * delete backend tests and create new reference tests * style fix * remoove sign backend test from CMakeList * create reference test for all supported types * remove boolean type from evaluate method
- Loading branch information
Showing
10 changed files
with
121 additions
and
73 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
80 changes: 80 additions & 0 deletions
80
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,80 @@ | ||
// 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) | ||
: pshape(shape), inType(iType), outType(oType), inputData(CreateBlob(iType, iValues)), refData(CreateBlob(oType, oValues)) {} | ||
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( | ||
SignParams(ngraph::PartialShape {6}, ngraph::element::f32, ngraph::element::f32, | ||
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::f16, ngraph::element::f16, | ||
std::vector<float16> {1, -2, 0, -4.8f, 4.8f, -0.0f}, | ||
std::vector<float16> {1, -1, 0, -1, 1, 0}), | ||
SignParams(ngraph::PartialShape {6}, ngraph::element::u64, ngraph::element::u64, | ||
std::vector<uint64_t> {1, 2, 0, 4, 4, 0}, | ||
std::vector<uint64_t> {1, 1, 0, 1, 1, 0}), | ||
SignParams(ngraph::PartialShape {6}, ngraph::element::u32, ngraph::element::u32, | ||
std::vector<uint32_t> {1, 2, 0, 4, 4, 0}, | ||
std::vector<uint32_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 |
---|---|---|
|
@@ -97,6 +97,7 @@ | |
'ShapeOf-3', | ||
'ShuffleChannels-1', | ||
'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
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); |