1 // Copyright (C) 2020 Intel Corporation
2 // SPDX-License-Identifier: Apache-2.0
10 #include "ie_util_internal.hpp"
11 #include "low_precision_transformations/network_helper.hpp"
12 #include "low_precision_transformations/convolution.hpp"
13 #include "low_precision_transformations/scaleshift_to_convolution.hpp"
14 #include "functional_test_utils/layer_test_utils.hpp"
15 #include "low_precision_transformations/transformer.hpp"
17 namespace LayerTestsUtils {
20 InferenceEngine::Precision,
21 InferenceEngine::SizeVector,
23 InferenceEngine::details::LayerTransformation::Params> LayerTransformationParams;
25 class LayerTransformationParamsFactory {
27 static InferenceEngine::details::LayerTransformation::Params createParamsU8I8();
28 static InferenceEngine::details::LayerTransformation::Params createParamsU8U8();
29 static InferenceEngine::details::LayerTransformation::Params createParamsI8I8();
30 static InferenceEngine::details::LayerTransformation::Params createParams();
33 IE_SUPPRESS_DEPRECATED_START
35 class LayerTransformation : public LayerTestsUtils::LayerTestsCommon {
37 LayerTransformation();
39 static InferenceEngine::Blob::Ptr GenerateInput(
40 const InferenceEngine::Precision precision,
41 const InferenceEngine::TensorDesc& tensorDesc,
44 LayerTransformation();
46 InferenceEngine::details::LowPrecisionTransformations getLowPrecisionTransformations(
47 const InferenceEngine::details::LayerTransformation::Params& params) const;
49 InferenceEngine::details::LowPrecisionTransformer getLowPrecisionTransformer(
50 const InferenceEngine::details::LayerTransformation::Params& params) const;
52 InferenceEngine::CNNNetwork transform(InferenceEngine::details::LayerTransformation::Params& params);
54 InferenceEngine::CNNNetwork transform(const InferenceEngine::details::LowPrecisionTransformations& transformations);
56 static void checkPrecisions(const InferenceEngine::CNNLayer& layer, const InferenceEngine::Precision& expectedPrecision);
58 static void checkPrecisions(
59 const InferenceEngine::CNNLayer& layer,
60 const std::vector<std::vector<InferenceEngine::Precision>>& expectedInputPrecisions,
61 const std::vector<InferenceEngine::Precision>& expectedOutputPrecisions,
62 const bool asymmetricQuantizationOnData = false,
63 const bool asymmetricQuantizationOnWeights = false);
65 static std::pair<float, float> getQuantizationInterval(const InferenceEngine::Precision precision);
67 static std::string toString(const InferenceEngine::details::LayerTransformation::Params& params);
69 static InferenceEngine::Precision getDeviceInternalPrecision(const InferenceEngine::Precision precision);
72 IE_SUPPRESS_DEPRECATED_END
74 } // namespace LayerTestsUtils