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.
[LPT] Convolution regression tests (openvinotoolkit#543)
* [LPT] Base test infrastructure extending & Convolution test * [LPT] LPT test infrastructure refactoring
- Loading branch information
Showing
20 changed files
with
409 additions
and
94 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
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
39 changes: 39 additions & 0 deletions
39
...n/cpu/shared_tests_instances/low_precision_transformations/convolution_transformation.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,39 @@ | ||
// Copyright (C) 2019 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include <vector> | ||
|
||
#include "low_precision_transformations/convolution_transformation.hpp" | ||
#include "common_test_utils/test_constants.hpp" | ||
|
||
using namespace LayerTestsDefinitions; | ||
|
||
namespace { | ||
const std::vector<InferenceEngine::Precision> netPrecisions = { | ||
InferenceEngine::Precision::FP32, | ||
InferenceEngine::Precision::FP16 | ||
}; | ||
|
||
const std::vector<InferenceEngine::details::LayerTransformation::Params> trasformationParamValues = { | ||
LayerTestsUtils::LayerTransformationParamsFactory::createParams() | ||
}; | ||
|
||
const std::vector<bool> fqOnActivationsValues = { true, false }; | ||
|
||
const std::vector<bool> fqOnWeightsValues = { true, false }; | ||
|
||
INSTANTIATE_TEST_CASE_P(LPT, ConvolutionTransformation, | ||
::testing::Combine( | ||
::testing::ValuesIn(netPrecisions), | ||
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), | ||
::testing::Values(CommonTestUtils::DEVICE_CPU), | ||
::testing::ValuesIn(trasformationParamValues), | ||
::testing::ValuesIn(fqOnActivationsValues), | ||
::testing::ValuesIn(fqOnWeightsValues)), | ||
ConvolutionTransformation::getTestCaseName); | ||
} // namespace | ||
|
||
|
||
|
||
|
49 changes: 49 additions & 0 deletions
49
.../plugin/cpu/shared_tests_instances/low_precision_transformations/layer_transformation.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,49 @@ | ||
// Copyright (C) 2020 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include <memory> | ||
#include <tuple> | ||
#include <vector> | ||
#include <string> | ||
|
||
#include <ie_core.hpp> | ||
|
||
#include "common_test_utils/common_utils.hpp" | ||
#include "functional_test_utils/plugin_cache.hpp" | ||
#include "functional_test_utils/layer_test_utils.hpp" | ||
#include "functional_test_utils/blob_utils.hpp" | ||
|
||
#include "ngraph_functions/pass/convert_prc.hpp" | ||
|
||
#include "ie_util_internal.hpp" | ||
#include "functional_test_utils/low_precision_transformations/layer_transformation.hpp" | ||
#include "low_precision_transformations/convolution.hpp" | ||
#include "low_precision_transformations/scaleshift_to_convolution.hpp" | ||
|
||
|
||
namespace LayerTestsUtils { | ||
|
||
InferenceEngine::details::LowPrecisionTransformations LayerTransformation::getLowPrecisionTransformations( | ||
const InferenceEngine::details::LayerTransformation::Params& params) const { | ||
return InferenceEngine::details::LowPrecisionTransformer::getAllTransformations(params). | ||
add<InferenceEngine::details::ConvolutionTransformation>(InferenceEngine::details::LayerTransformation::Params(params). | ||
setPrecisionsOnActivations({ InferenceEngine::Precision::U8 }), "Convolution"). | ||
addCleanup<InferenceEngine::details::ScaleShiftToConvolutionTransformation>( | ||
InferenceEngine::details::LayerTransformation::Params(params).setPrecisionsOnActivations({ InferenceEngine::Precision::U8 }), | ||
"ScaleShift"); | ||
} | ||
|
||
InferenceEngine::details::LayerTransformation::Params LayerTransformationParamsFactory::createParams() { | ||
return InferenceEngine::details::LayerTransformation::Params( | ||
true, | ||
true, | ||
true, | ||
InferenceEngine::details::LayerTransformation::QuantizedTensorAlignment::UpdateLevel, | ||
InferenceEngine::details::LayerTransformation::QuantizedTensorAlignment::None, | ||
true, | ||
true, | ||
true); | ||
} | ||
|
||
} // namespace LayerTestsUtils |
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
39 changes: 39 additions & 0 deletions
39
...n/gpu/shared_tests_instances/low_precision_transformations/convolution_transformation.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,39 @@ | ||
// Copyright (C) 2019 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include <vector> | ||
|
||
#include "low_precision_transformations/convolution_transformation.hpp" | ||
#include "common_test_utils/test_constants.hpp" | ||
|
||
using namespace LayerTestsDefinitions; | ||
|
||
namespace { | ||
const std::vector<InferenceEngine::Precision> netPrecisions = { | ||
InferenceEngine::Precision::FP32, | ||
InferenceEngine::Precision::FP16 | ||
}; | ||
|
||
const std::vector<InferenceEngine::details::LayerTransformation::Params> trasformationParamValues = { | ||
LayerTestsUtils::LayerTransformationParamsFactory::createParams() | ||
}; | ||
|
||
const std::vector<bool> fqOnActivationsValues = { true, false }; | ||
|
||
const std::vector<bool> fqOnWeightsValues = { true, false }; | ||
|
||
INSTANTIATE_TEST_CASE_P(LPT, ConvolutionTransformation, | ||
::testing::Combine( | ||
::testing::ValuesIn(netPrecisions), | ||
::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), | ||
::testing::Values(CommonTestUtils::DEVICE_GPU), | ||
::testing::ValuesIn(trasformationParamValues), | ||
::testing::ValuesIn(fqOnActivationsValues), | ||
::testing::ValuesIn(fqOnWeightsValues)), | ||
ConvolutionTransformation::getTestCaseName); | ||
} // namespace | ||
|
||
|
||
|
||
|
43 changes: 43 additions & 0 deletions
43
.../plugin/gpu/shared_tests_instances/low_precision_transformations/layer_transformation.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,43 @@ | ||
// Copyright (C) 2020 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include <memory> | ||
#include <tuple> | ||
#include <vector> | ||
#include <string> | ||
|
||
#include <ie_core.hpp> | ||
|
||
#include "common_test_utils/common_utils.hpp" | ||
#include "functional_test_utils/plugin_cache.hpp" | ||
#include "functional_test_utils/layer_test_utils.hpp" | ||
#include "functional_test_utils/blob_utils.hpp" | ||
|
||
#include "ngraph_functions/pass/convert_prc.hpp" | ||
|
||
#include "ie_util_internal.hpp" | ||
#include "functional_test_utils/low_precision_transformations/layer_transformation.hpp" | ||
#include "low_precision_transformations/convolution.hpp" | ||
#include "low_precision_transformations/scaleshift_to_convolution.hpp" | ||
|
||
|
||
namespace LayerTestsUtils { | ||
|
||
InferenceEngine::details::LowPrecisionTransformations LayerTransformation::getLowPrecisionTransformations( | ||
const InferenceEngine::details::LayerTransformation::Params& params) const { | ||
return InferenceEngine::details::LowPrecisionTransformer::getAllTransformations(params); | ||
} | ||
|
||
InferenceEngine::details::LayerTransformation::Params LayerTransformationParamsFactory::createParams() { | ||
return InferenceEngine::details::LayerTransformation::Params( | ||
true, | ||
true, | ||
true, | ||
InferenceEngine::details::LayerTransformation::QuantizedTensorAlignment::UpdateLevel, | ||
InferenceEngine::details::LayerTransformation::QuantizedTensorAlignment::None, | ||
true, | ||
true, | ||
true); | ||
} | ||
} // namespace LayerTestsUtils |
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
36 changes: 36 additions & 0 deletions
36
...tional/plugin/shared/include/low_precision_transformations/convolution_transformation.hpp
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,36 @@ | ||
// Copyright (C) 2019 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
#include <memory> | ||
|
||
#include "functional_test_utils/low_precision_transformations/layer_transformation.hpp" | ||
|
||
namespace LayerTestsDefinitions { | ||
|
||
typedef std::tuple< | ||
InferenceEngine::Precision, | ||
InferenceEngine::SizeVector, | ||
std::string, | ||
InferenceEngine::details::LayerTransformation::Params, | ||
bool, // fqOnActivations | ||
bool // fqOnWeights | ||
> ConvolutionTransformationParams; | ||
|
||
class ConvolutionTransformation : | ||
public testing::WithParamInterface<ConvolutionTransformationParams>, | ||
public LayerTestsUtils::LayerTransformation { | ||
public: | ||
static std::string getTestCaseName(testing::TestParamInfo<ConvolutionTransformationParams> obj); | ||
|
||
protected: | ||
void SetUp() override; | ||
|
||
private: | ||
void validate(); | ||
}; | ||
|
||
} // namespace LayerTestsDefinitions |
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
Oops, something went wrong.