Unify SLTs classes of Convert and ConvertLike operations (#7129)
* update comparisiofiles to use const ref param * introduce conversion layer test definitions * adapt old tests to the new format * remove old duplicated conversion tests * fix "convertion" typo to "conversion" * fix style issues and abandon unnecessary changes * fix include order * update remaining conversion tests to use introduced class * fix gpu class test naming * bring back convert.hpp and convert_like.hpp files * bring back convert.hppcppd convert_like.cpp files * bring back single_layer_tests/convert.hpp file * add missing copyright info * fix issue with braces initiator for conversion types * add missing convert_like tests * add deprecated code macros * update deprecated code macro message * add missing space in deprecated code macro message * update skip ConvertLike tests ticket * update deprecated code to use IE macros * update remaining ngraph_deprecated macros to use IE macros
This commit is contained in:
parent
8550579b60
commit
3081fac758
@ -47,7 +47,7 @@ public:
|
|||||||
static std::string getTestCaseName(const testing::TestParamInfo<ConvertParams>& obj) {
|
static std::string getTestCaseName(const testing::TestParamInfo<ConvertParams>& obj) {
|
||||||
const auto& param = obj.param;
|
const auto& param = obj.param;
|
||||||
std::ostringstream result;
|
std::ostringstream result;
|
||||||
result << "convertionType=" << conversionNames[param.conversionType] << "_";
|
result << "conversionType=" << conversionNames[param.conversionType] << "_";
|
||||||
result << "shape=" << param.pshape << "_";
|
result << "shape=" << param.pshape << "_";
|
||||||
result << "iType=" << param.inType << "_";
|
result << "iType=" << param.inType << "_";
|
||||||
result << "oType=" << param.outType;
|
result << "oType=" << param.outType;
|
||||||
|
@ -2,13 +2,18 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "shared_test_classes/single_layer/convert.hpp"
|
#include "shared_test_classes/single_layer/conversion.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using namespace LayerTestsDefinitions;
|
using namespace LayerTestsDefinitions;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
const std::vector<ngraph::helpers::ConversionTypes> conversionOpTypes = {
|
||||||
|
ngraph::helpers::ConversionTypes::CONVERT,
|
||||||
|
ngraph::helpers::ConversionTypes::CONVERT_LIKE,
|
||||||
|
};
|
||||||
|
|
||||||
const std::vector<std::vector<size_t>> inShape = {{1, 2, 3, 4}};
|
const std::vector<std::vector<size_t>> inShape = {{1, 2, 3, 4}};
|
||||||
|
|
||||||
const std::vector<InferenceEngine::Precision> precisions = {
|
const std::vector<InferenceEngine::Precision> precisions = {
|
||||||
@ -21,18 +26,19 @@ const std::vector<InferenceEngine::Precision> precisions = {
|
|||||||
InferenceEngine::Precision::BF16, InferenceEngine::Precision::FP16,
|
InferenceEngine::Precision::BF16, InferenceEngine::Precision::FP16,
|
||||||
InferenceEngine::Precision::FP32, InferenceEngine::Precision::FP64};
|
InferenceEngine::Precision::FP32, InferenceEngine::Precision::FP64};
|
||||||
|
|
||||||
TEST_P(ConvertLayerTest, Serialize) {
|
TEST_P(ConversionLayerTest, Serialize) {
|
||||||
Serialize();
|
Serialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(
|
INSTANTIATE_TEST_SUITE_P(
|
||||||
smoke_Serialization_ConvertLayerTest, ConvertLayerTest,
|
smoke_Serialization_ConversionLayerTest, ConversionLayerTest,
|
||||||
::testing::Combine(::testing::Values(inShape),
|
::testing::Combine(::testing::ValuesIn(conversionOpTypes),
|
||||||
|
::testing::Values(inShape),
|
||||||
::testing::ValuesIn(precisions),
|
::testing::ValuesIn(precisions),
|
||||||
::testing::ValuesIn(precisions),
|
::testing::ValuesIn(precisions),
|
||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||||
ConvertLayerTest::getTestCaseName);
|
ConversionLayerTest::getTestCaseName);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
@ -0,0 +1,50 @@
|
|||||||
|
// Copyright (C) 2018-2021 Intel Corporation
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "common_test_utils/test_constants.hpp"
|
||||||
|
#include "single_layer_tests/conversion.hpp"
|
||||||
|
|
||||||
|
using namespace LayerTestsDefinitions;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
const std::vector<ngraph::helpers::ConversionTypes> conversionOpTypes = {
|
||||||
|
ngraph::helpers::ConversionTypes::CONVERT,
|
||||||
|
ngraph::helpers::ConversionTypes::CONVERT_LIKE,
|
||||||
|
};
|
||||||
|
|
||||||
|
const std::vector<std::vector<size_t>> inShape = {{1, 2, 3, 4}};
|
||||||
|
|
||||||
|
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||||
|
// Ticket: 59594
|
||||||
|
// InferenceEngine::Precision::I4,
|
||||||
|
InferenceEngine::Precision::I8,
|
||||||
|
InferenceEngine::Precision::I16,
|
||||||
|
InferenceEngine::Precision::I32,
|
||||||
|
InferenceEngine::Precision::I64,
|
||||||
|
// Ticket: 59594
|
||||||
|
// InferenceEngine::Precision::BIN,
|
||||||
|
// InferenceEngine::Precision::BOOL,
|
||||||
|
// InferenceEngine::Precision::U4,
|
||||||
|
InferenceEngine::Precision::U8,
|
||||||
|
InferenceEngine::Precision::U16,
|
||||||
|
// Ticket: 59594
|
||||||
|
// InferenceEngine::Precision::U32,
|
||||||
|
InferenceEngine::Precision::U64,
|
||||||
|
InferenceEngine::Precision::BF16,
|
||||||
|
InferenceEngine::Precision::FP16,
|
||||||
|
InferenceEngine::Precision::FP32};
|
||||||
|
|
||||||
|
INSTANTIATE_TEST_SUITE_P(smoke_ConversionLayerTest,
|
||||||
|
ConversionLayerTest,
|
||||||
|
::testing::Combine(::testing::ValuesIn(conversionOpTypes),
|
||||||
|
::testing::Values(inShape),
|
||||||
|
::testing::ValuesIn(netPrecisions),
|
||||||
|
::testing::ValuesIn(netPrecisions),
|
||||||
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
|
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||||
|
ConversionLayerTest::getTestCaseName);
|
||||||
|
} // namespace
|
@ -1,47 +0,0 @@
|
|||||||
// Copyright (C) 2018-2021 Intel Corporation
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "single_layer_tests/convert.hpp"
|
|
||||||
#include "common_test_utils/test_constants.hpp"
|
|
||||||
|
|
||||||
using namespace LayerTestsDefinitions;
|
|
||||||
using namespace InferenceEngine;
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
const std::vector<std::vector<size_t>> inShape = {{1, 2, 3, 4}};
|
|
||||||
|
|
||||||
const std::vector<Precision> precisions = {
|
|
||||||
// Ticket: 59594
|
|
||||||
// Precision::I4,
|
|
||||||
Precision::I8,
|
|
||||||
Precision::I16,
|
|
||||||
Precision::I32,
|
|
||||||
Precision::I64,
|
|
||||||
// Ticket: 59594
|
|
||||||
// Precision::BIN,
|
|
||||||
// Precision::BOOL,
|
|
||||||
// Precision::U4,
|
|
||||||
Precision::U8,
|
|
||||||
Precision::U16,
|
|
||||||
// Ticket: 59594
|
|
||||||
// Precision::U32,
|
|
||||||
Precision::U64,
|
|
||||||
Precision::BF16,
|
|
||||||
Precision::FP16,
|
|
||||||
Precision::FP32
|
|
||||||
};
|
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(smoke_ConvertLayerTest, ConvertLayerTest,
|
|
||||||
::testing::Combine(
|
|
||||||
::testing::Values(inShape),
|
|
||||||
::testing::ValuesIn(precisions),
|
|
||||||
::testing::ValuesIn(precisions),
|
|
||||||
::testing::Values(Layout::ANY),
|
|
||||||
::testing::Values(Layout::ANY),
|
|
||||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
|
||||||
ConvertLayerTest::getTestCaseName);
|
|
||||||
|
|
||||||
} // namespace
|
|
@ -1,33 +0,0 @@
|
|||||||
// Copyright (C) 2018-2021 Intel Corporation
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "single_layer_tests/convert_like.hpp"
|
|
||||||
#include "common_test_utils/test_constants.hpp"
|
|
||||||
|
|
||||||
using namespace LayerTestsDefinitions;
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
const std::vector<std::vector<size_t>> inShape = {{1, 2, 3, 4}};
|
|
||||||
|
|
||||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
|
||||||
InferenceEngine::Precision::FP32,
|
|
||||||
InferenceEngine::Precision::FP16,
|
|
||||||
InferenceEngine::Precision::U8,
|
|
||||||
InferenceEngine::Precision::I8,
|
|
||||||
};
|
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(smoke_NoReshape, ConvertLikeLayerTest,
|
|
||||||
::testing::Combine(
|
|
||||||
::testing::Values(inShape),
|
|
||||||
::testing::ValuesIn(netPrecisions),
|
|
||||||
::testing::Values(inShape),
|
|
||||||
::testing::ValuesIn(netPrecisions),
|
|
||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
|
||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
|
||||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
|
||||||
ConvertLikeLayerTest::getTestCaseName);
|
|
||||||
|
|
||||||
} // namespace
|
|
@ -29,8 +29,8 @@ std::vector<std::string> disabledTestPatterns() {
|
|||||||
R"(.*InferRequestPreprocessDynamicallyInSetBlobTest.*oPRC=0.*_oLT=1.*)",
|
R"(.*InferRequestPreprocessDynamicallyInSetBlobTest.*oPRC=0.*_oLT=1.*)",
|
||||||
// TODO: Issue: 34348
|
// TODO: Issue: 34348
|
||||||
R"(.*IEClassGetAvailableDevices.*)",
|
R"(.*IEClassGetAvailableDevices.*)",
|
||||||
// TODO: Issue: 25533
|
// TODO: Issue: 63469
|
||||||
R"(.*ConvertLikeLayerTest.*)",
|
R"(.*ConversionLayerTest.*ConvertLike.*)",
|
||||||
// TODO: Issue: 34055
|
// TODO: Issue: 34055
|
||||||
R"(.*ShapeOfLayerTest.*)",
|
R"(.*ShapeOfLayerTest.*)",
|
||||||
R"(.*ReluShapeOfSubgraphTest.*)",
|
R"(.*ReluShapeOfSubgraphTest.*)",
|
||||||
|
@ -2,26 +2,31 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <shared_test_classes/single_layer/convert.hpp>
|
#include <shared_test_classes/single_layer/conversion.hpp>
|
||||||
|
|
||||||
using namespace LayerTestsDefinitions;
|
using namespace LayerTestsDefinitions;
|
||||||
using namespace InferenceEngine;
|
using namespace InferenceEngine;
|
||||||
|
|
||||||
namespace CPULayerTestsDefinitions {
|
namespace CPULayerTestsDefinitions {
|
||||||
|
|
||||||
class ConvertCPULayerTest : public ConvertLayerTest {};
|
class ConvertCPULayerTest : public ConversionLayerTest {};
|
||||||
|
|
||||||
TEST_P(ConvertCPULayerTest, CompareWithRefs) {
|
TEST_P(ConvertCPULayerTest, CompareWithRefs) {
|
||||||
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
SKIP_IF_CURRENT_TEST_IS_DISABLED()
|
||||||
|
|
||||||
ConvertParamsTuple params = GetParam();
|
ConversionParamsTuple params = GetParam();
|
||||||
inPrc = std::get<1>(params);
|
inPrc = std::get<2>(params);
|
||||||
outPrc = std::get<2>(params);
|
outPrc = std::get<3>(params);
|
||||||
|
|
||||||
Run();
|
Run();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
const std::vector<ngraph::helpers::ConversionTypes> conversionOpTypes = {
|
||||||
|
ngraph::helpers::ConversionTypes::CONVERT,
|
||||||
|
ngraph::helpers::ConversionTypes::CONVERT_LIKE,
|
||||||
|
};
|
||||||
|
|
||||||
const std::vector<std::vector<size_t>> inShape = {{1, 2, 3, 4}};
|
const std::vector<std::vector<size_t>> inShape = {{1, 2, 3, 4}};
|
||||||
|
|
||||||
// List of precisions natively supported by mkldnn.
|
// List of precisions natively supported by mkldnn.
|
||||||
@ -33,24 +38,26 @@ const std::vector<Precision> precisions = {
|
|||||||
Precision::BF16
|
Precision::BF16
|
||||||
};
|
};
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(smoke_ConvertLayerTest_From_BF16, ConvertCPULayerTest,
|
INSTANTIATE_TEST_SUITE_P(smoke_ConversionLayerTest_From_BF16, ConvertCPULayerTest,
|
||||||
::testing::Combine(
|
::testing::Combine(
|
||||||
|
::testing::ValuesIn(conversionOpTypes),
|
||||||
::testing::Values(inShape),
|
::testing::Values(inShape),
|
||||||
::testing::Values(Precision::BF16),
|
::testing::Values(Precision::BF16),
|
||||||
::testing::ValuesIn(precisions),
|
::testing::ValuesIn(precisions),
|
||||||
::testing::Values(Layout::ANY),
|
::testing::Values(Layout::ANY),
|
||||||
::testing::Values(Layout::ANY),
|
::testing::Values(Layout::ANY),
|
||||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||||
ConvertLayerTest::getTestCaseName);
|
ConversionLayerTest::getTestCaseName);
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(smoke_ConvertLayerTest_To_BF16, ConvertCPULayerTest,
|
INSTANTIATE_TEST_SUITE_P(smoke_ConversionLayerTest_To_BF16, ConvertCPULayerTest,
|
||||||
::testing::Combine(
|
::testing::Combine(
|
||||||
|
::testing::ValuesIn(conversionOpTypes),
|
||||||
::testing::Values(inShape),
|
::testing::Values(inShape),
|
||||||
::testing::ValuesIn(precisions),
|
::testing::ValuesIn(precisions),
|
||||||
::testing::Values(Precision::BF16),
|
::testing::Values(Precision::BF16),
|
||||||
::testing::Values(Layout::ANY),
|
::testing::Values(Layout::ANY),
|
||||||
::testing::Values(Layout::ANY),
|
::testing::Values(Layout::ANY),
|
||||||
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
::testing::Values(CommonTestUtils::DEVICE_CPU)),
|
||||||
ConvertLayerTest::getTestCaseName);
|
ConversionLayerTest::getTestCaseName);
|
||||||
} // namespace
|
} // namespace
|
||||||
} // namespace CPULayerTestsDefinitions
|
} // namespace CPULayerTestsDefinitions
|
@ -4,12 +4,17 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "single_layer_tests/convert.hpp"
|
#include "single_layer_tests/conversion.hpp"
|
||||||
#include "common_test_utils/test_constants.hpp"
|
#include "common_test_utils/test_constants.hpp"
|
||||||
|
|
||||||
using namespace LayerTestsDefinitions;
|
using namespace LayerTestsDefinitions;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
const std::vector<ngraph::helpers::ConversionTypes> conversionOpTypes = {
|
||||||
|
ngraph::helpers::ConversionTypes::CONVERT,
|
||||||
|
ngraph::helpers::ConversionTypes::CONVERT_LIKE,
|
||||||
|
};
|
||||||
|
|
||||||
const std::vector<std::vector<size_t>> inShape = {{1, 2, 3, 4}};
|
const std::vector<std::vector<size_t>> inShape = {{1, 2, 3, 4}};
|
||||||
|
|
||||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
||||||
@ -19,14 +24,15 @@ const std::vector<InferenceEngine::Precision> netPrecisions = {
|
|||||||
InferenceEngine::Precision::I8,
|
InferenceEngine::Precision::I8,
|
||||||
};
|
};
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(smoke_NoReshape, ConvertLayerTest,
|
INSTANTIATE_TEST_SUITE_P(smoke_NoReshape, ConversionLayerTest,
|
||||||
::testing::Combine(
|
::testing::Combine(
|
||||||
|
::testing::ValuesIn(conversionOpTypes),
|
||||||
::testing::Values(inShape),
|
::testing::Values(inShape),
|
||||||
::testing::ValuesIn(netPrecisions),
|
::testing::ValuesIn(netPrecisions),
|
||||||
::testing::ValuesIn(netPrecisions),
|
::testing::ValuesIn(netPrecisions),
|
||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
::testing::Values(InferenceEngine::Layout::ANY),
|
||||||
::testing::Values(CommonTestUtils::DEVICE_GPU)),
|
::testing::Values(CommonTestUtils::DEVICE_GPU)),
|
||||||
ConvertLayerTest::getTestCaseName);
|
ConversionLayerTest::getTestCaseName);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
@ -1,33 +0,0 @@
|
|||||||
// Copyright (C) 2018-2021 Intel Corporation
|
|
||||||
// SPDX-License-Identifier: Apache-2.0
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "single_layer_tests/convert_like.hpp"
|
|
||||||
#include "common_test_utils/test_constants.hpp"
|
|
||||||
|
|
||||||
using namespace LayerTestsDefinitions;
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
const std::vector<std::vector<size_t>> inShape = {{1, 2, 3, 4}};
|
|
||||||
|
|
||||||
const std::vector<InferenceEngine::Precision> netPrecisions = {
|
|
||||||
InferenceEngine::Precision::FP32,
|
|
||||||
InferenceEngine::Precision::FP16,
|
|
||||||
InferenceEngine::Precision::U8,
|
|
||||||
InferenceEngine::Precision::I8,
|
|
||||||
};
|
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(smoke_NoReshape, ConvertLikeLayerTest,
|
|
||||||
::testing::Combine(
|
|
||||||
::testing::Values(inShape),
|
|
||||||
::testing::ValuesIn(netPrecisions),
|
|
||||||
::testing::Values(inShape),
|
|
||||||
::testing::ValuesIn(netPrecisions),
|
|
||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
|
||||||
::testing::Values(InferenceEngine::Layout::ANY),
|
|
||||||
::testing::Values(CommonTestUtils::DEVICE_GPU)),
|
|
||||||
ConvertLikeLayerTest::getTestCaseName);
|
|
||||||
|
|
||||||
} // namespace
|
|
@ -4,12 +4,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "shared_test_classes/single_layer/convert_like.hpp"
|
#include "shared_test_classes/single_layer/conversion.hpp"
|
||||||
|
|
||||||
namespace LayerTestsDefinitions {
|
namespace LayerTestsDefinitions {
|
||||||
|
TEST_P(ConversionLayerTest, CompareWithRefs) {
|
||||||
TEST_P(ConvertLikeLayerTest, CompareWithRefs) {
|
|
||||||
Run();
|
Run();
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LayerTestsDefinitions
|
} // namespace LayerTestsDefinitions
|
@ -4,6 +4,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <ie_api.h>
|
||||||
|
IE_SUPPRESS_DEPRECATED_START
|
||||||
|
|
||||||
#include "shared_test_classes/single_layer/convert.hpp"
|
#include "shared_test_classes/single_layer/convert.hpp"
|
||||||
|
|
||||||
namespace LayerTestsDefinitions {
|
namespace LayerTestsDefinitions {
|
||||||
@ -13,3 +16,5 @@ TEST_P(ConvertLayerTest, CompareWithRefs) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
} // namespace LayerTestsDefinitions
|
} // namespace LayerTestsDefinitions
|
||||||
|
|
||||||
|
IE_SUPPRESS_DEPRECATED_END
|
||||||
|
@ -36,6 +36,6 @@ protected:
|
|||||||
void SetUp() override;
|
void SetUp() override;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static std::string getTestCaseName(testing::TestParamInfo<ComparisonTestParams> obj);
|
static std::string getTestCaseName(const testing::TestParamInfo<ComparisonTestParams> &obj);
|
||||||
};
|
};
|
||||||
} // namespace LayerTestsDefinitions
|
} // namespace LayerTestsDefinitions
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
// Copyright (C) 2021 Intel Corporation
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <shared_test_classes/base/layer_test_utils.hpp>
|
||||||
|
|
||||||
|
#include "common_test_utils/common_utils.hpp"
|
||||||
|
#include "common_test_utils/test_common.hpp"
|
||||||
|
#include "common_test_utils/test_constants.hpp"
|
||||||
|
#include "ie_core.hpp"
|
||||||
|
|
||||||
|
namespace LayerTestsDefinitions {
|
||||||
|
|
||||||
|
static std::map<ngraph::helpers::ConversionTypes, std::string> conversionNames = {
|
||||||
|
{ngraph::helpers::ConversionTypes::CONVERT, "Convert"},
|
||||||
|
{ngraph::helpers::ConversionTypes::CONVERT_LIKE, "ConvertLike"}};
|
||||||
|
|
||||||
|
using ConversionParamsTuple = typename std::tuple<ngraph::helpers::ConversionTypes, // Convertion op type
|
||||||
|
std::vector<std::vector<size_t>>, // Input1 shapes
|
||||||
|
InferenceEngine::Precision, // Input1 precision
|
||||||
|
InferenceEngine::Precision, // Input2 precision
|
||||||
|
InferenceEngine::Layout, // Input layout
|
||||||
|
InferenceEngine::Layout, // Output layout
|
||||||
|
std::string>; // Device name
|
||||||
|
|
||||||
|
class ConversionLayerTest : public testing::WithParamInterface<ConversionParamsTuple>,
|
||||||
|
virtual public LayerTestsUtils::LayerTestsCommon {
|
||||||
|
public:
|
||||||
|
static std::string getTestCaseName(const testing::TestParamInfo<ConversionParamsTuple>& obj);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void SetUp() override;
|
||||||
|
};
|
||||||
|
} // namespace LayerTestsDefinitions
|
@ -23,8 +23,10 @@ using ConvertParamsTuple = typename std::tuple<
|
|||||||
InferenceEngine::Layout, // Output layout
|
InferenceEngine::Layout, // Output layout
|
||||||
std::string>; // Device name
|
std::string>; // Device name
|
||||||
|
|
||||||
class ConvertLayerTest : public testing::WithParamInterface<ConvertParamsTuple>,
|
class INFERENCE_ENGINE_DEPRECATED("This class is deprecated and will be removed soon. "
|
||||||
virtual public LayerTestsUtils::LayerTestsCommon {
|
"Please use new ConversionLayerTest class.") ConvertLayerTest :
|
||||||
|
public testing::WithParamInterface<ConvertParamsTuple>,
|
||||||
|
virtual public LayerTestsUtils::LayerTestsCommon {
|
||||||
public:
|
public:
|
||||||
static std::string getTestCaseName(const testing::TestParamInfo<ConvertParamsTuple> &obj);
|
static std::string getTestCaseName(const testing::TestParamInfo<ConvertParamsTuple> &obj);
|
||||||
|
|
||||||
|
@ -24,8 +24,10 @@ using ConvertLikeParamsTuple = typename std::tuple<
|
|||||||
InferenceEngine::Layout, // Output layout
|
InferenceEngine::Layout, // Output layout
|
||||||
std::string>; // Device name
|
std::string>; // Device name
|
||||||
|
|
||||||
class ConvertLikeLayerTest : public testing::WithParamInterface<ConvertLikeParamsTuple>,
|
class INFERENCE_ENGINE_DEPRECATED("This class is deprecated and will be removed soon. "
|
||||||
virtual public LayerTestsUtils::LayerTestsCommon {
|
"Please use new ConversionLayerTest class.") ConvertLikeLayerTest :
|
||||||
|
public testing::WithParamInterface<ConvertLikeParamsTuple>,
|
||||||
|
virtual public LayerTestsUtils::LayerTestsCommon {
|
||||||
public:
|
public:
|
||||||
static std::string getTestCaseName(const testing::TestParamInfo<ConvertLikeParamsTuple> &obj);
|
static std::string getTestCaseName(const testing::TestParamInfo<ConvertLikeParamsTuple> &obj);
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
using namespace LayerTestsDefinitions::ComparisonParams;
|
using namespace LayerTestsDefinitions::ComparisonParams;
|
||||||
|
|
||||||
namespace LayerTestsDefinitions {
|
namespace LayerTestsDefinitions {
|
||||||
std::string ComparisonLayerTest::getTestCaseName(testing::TestParamInfo<ComparisonTestParams> obj) {
|
std::string ComparisonLayerTest::getTestCaseName(const testing::TestParamInfo<ComparisonTestParams> &obj) {
|
||||||
InputShapesTuple inputShapes;
|
InputShapesTuple inputShapes;
|
||||||
InferenceEngine::Precision ngInputsPrecision;
|
InferenceEngine::Precision ngInputsPrecision;
|
||||||
ngraph::helpers::ComparisonTypes comparisonOpType;
|
ngraph::helpers::ComparisonTypes comparisonOpType;
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
// Copyright (C) 2021 Intel Corporation
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "shared_test_classes/single_layer/conversion.hpp"
|
||||||
|
|
||||||
|
#include "ngraph_functions/builders.hpp"
|
||||||
|
|
||||||
|
namespace LayerTestsDefinitions {
|
||||||
|
|
||||||
|
std::string ConversionLayerTest::getTestCaseName(const testing::TestParamInfo<ConversionParamsTuple>& obj) {
|
||||||
|
ngraph::helpers::ConversionTypes conversionOpType;
|
||||||
|
InferenceEngine::Precision inputPrecision, targetPrecision;
|
||||||
|
InferenceEngine::Layout inLayout, outLayout;
|
||||||
|
std::string targetName;
|
||||||
|
std::vector<std::vector<size_t>> inputShape;
|
||||||
|
std::tie(conversionOpType, inputShape, inputPrecision, targetPrecision, inLayout, outLayout, targetName) =
|
||||||
|
obj.param;
|
||||||
|
std::ostringstream result;
|
||||||
|
result << "conversionOpType=" << conversionNames[conversionOpType] << "_";
|
||||||
|
result << "IS=" << CommonTestUtils::vec2str(inputShape) << "_";
|
||||||
|
result << "inputPRC=" << inputPrecision.name() << "_";
|
||||||
|
result << "targetPRC=" << targetPrecision.name() << "_";
|
||||||
|
result << "inL=" << inLayout << "_";
|
||||||
|
result << "outL=" << outLayout << "_";
|
||||||
|
result << "trgDev=" << targetName;
|
||||||
|
return result.str();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConversionLayerTest::SetUp() {
|
||||||
|
ngraph::helpers::ConversionTypes conversionOpType;
|
||||||
|
InferenceEngine::Precision inputPrecision, targetPrecision;
|
||||||
|
std::vector<std::vector<size_t>> inputShape;
|
||||||
|
std::tie(conversionOpType, inputShape, inputPrecision, targetPrecision, inLayout, outLayout, targetDevice) =
|
||||||
|
GetParam();
|
||||||
|
|
||||||
|
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(inputPrecision);
|
||||||
|
auto targetPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(targetPrecision);
|
||||||
|
auto params = ngraph::builder::makeParams(ngPrc, inputShape);
|
||||||
|
auto conversion = ngraph::builder::makeConversion(params.front(), targetPrc, conversionOpType);
|
||||||
|
|
||||||
|
ngraph::ResultVector results{std::make_shared<ngraph::opset3::Result>(conversion)};
|
||||||
|
function = std::make_shared<ngraph::Function>(results, params, "Conversion");
|
||||||
|
}
|
||||||
|
} // namespace LayerTestsDefinitions
|
@ -2,6 +2,9 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <ie_api.h>
|
||||||
|
IE_SUPPRESS_DEPRECATED_START
|
||||||
|
|
||||||
#include "shared_test_classes/single_layer/convert.hpp"
|
#include "shared_test_classes/single_layer/convert.hpp"
|
||||||
|
|
||||||
namespace LayerTestsDefinitions {
|
namespace LayerTestsDefinitions {
|
||||||
@ -34,3 +37,5 @@ void ConvertLayerTest::SetUp() {
|
|||||||
function = std::make_shared<ngraph::Function>(results, params, "Convert");
|
function = std::make_shared<ngraph::Function>(results, params, "Convert");
|
||||||
}
|
}
|
||||||
} // namespace LayerTestsDefinitions
|
} // namespace LayerTestsDefinitions
|
||||||
|
|
||||||
|
IE_SUPPRESS_DEPRECATED_END
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
// SPDX-License-Identifier: Apache-2.0
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <ie_api.h>
|
||||||
|
IE_SUPPRESS_DEPRECATED_START
|
||||||
|
|
||||||
#include "shared_test_classes/single_layer/convert_like.hpp"
|
#include "shared_test_classes/single_layer/convert_like.hpp"
|
||||||
|
|
||||||
namespace LayerTestsDefinitions {
|
namespace LayerTestsDefinitions {
|
||||||
@ -36,3 +39,5 @@ void ConvertLikeLayerTest::SetUp() {
|
|||||||
function = std::make_shared<ngraph::Function>(results, params, "ConvertLike");
|
function = std::make_shared<ngraph::Function>(results, params, "ConvertLike");
|
||||||
}
|
}
|
||||||
} // namespace LayerTestsDefinitions
|
} // namespace LayerTestsDefinitions
|
||||||
|
|
||||||
|
IE_SUPPRESS_DEPRECATED_END
|
||||||
|
Loading…
Reference in New Issue
Block a user