|
| 1 | +// Copyright (C) 2018-2023 Intel Corporation |
| 2 | +// SPDX-License-Identifier: Apache-2.0 |
| 3 | +// |
| 4 | + |
| 5 | +#include <shared_test_classes/base/ov_subgraph.hpp> |
| 6 | +#include <ngraph_functions/builders.hpp> |
| 7 | +#include "test_utils/cpu_test_utils.hpp" |
| 8 | +#include <cpp_interfaces/interface/ie_internal_plugin_config.hpp> |
| 9 | + |
| 10 | +using namespace ov::test; |
| 11 | +using namespace CPUTestUtils; |
| 12 | + |
| 13 | +namespace CPULayerTestsDefinitions { |
| 14 | +using InsertConvertI64I32CPUTestParams = std::tuple<ElementType, InputShape>; |
| 15 | + |
| 16 | +class InsertConvertI64I32CPUTest : public testing::WithParamInterface<InsertConvertI64I32CPUTestParams>, |
| 17 | + virtual public SubgraphBaseTest, |
| 18 | + public CPUTestsBase { |
| 19 | +public: |
| 20 | + static std::string getTestCaseName(const testing::TestParamInfo<InsertConvertI64I32CPUTestParams>& obj) { |
| 21 | + ElementType inType; |
| 22 | + InputShape inputShape; |
| 23 | + std::tie(inType, inputShape) = obj.param; |
| 24 | + |
| 25 | + std::ostringstream result; |
| 26 | + result << "IS=" << inputShape << "_"; |
| 27 | + result << "Prc=" << inType; |
| 28 | + return result.str(); |
| 29 | + } |
| 30 | + |
| 31 | +protected: |
| 32 | + void SetUp() override { |
| 33 | + targetDevice = CommonTestUtils::DEVICE_CPU; |
| 34 | + configuration[InferenceEngine::PluginConfigInternalParams::KEY_CPU_NATIVE_I64] = InferenceEngine::PluginConfigParams::YES; |
| 35 | + |
| 36 | + InputShape inputShape; |
| 37 | + std::tie(inType, inputShape) = this->GetParam(); |
| 38 | + |
| 39 | + init_input_shapes({inputShape}); |
| 40 | + auto inputParams = ngraph::builder::makeDynamicParams(inType, inputDynamicShapes); |
| 41 | + auto nonZero = std::make_shared<ov::op::v3::NonZero>(inputParams[0]); |
| 42 | + |
| 43 | + ov::ResultVector results{std::make_shared<ov::op::v0::Result>(nonZero)}; |
| 44 | + function = std::make_shared<ov::Model>(results, inputParams, "insertConvertI64I32"); |
| 45 | + } |
| 46 | +}; |
| 47 | + |
| 48 | +TEST_P(InsertConvertI64I32CPUTest, CompareWithRefs) { |
| 49 | + run(); |
| 50 | + CheckNumberOfNodesWithType(compiledModel, "Convert", 2); |
| 51 | +} |
| 52 | + |
| 53 | +const InputShape inputShapes = { |
| 54 | + {}, {{1, 3, 32, 32}} |
| 55 | +}; |
| 56 | + |
| 57 | +INSTANTIATE_TEST_SUITE_P(smoke_CustomOp, |
| 58 | + InsertConvertI64I32CPUTest, |
| 59 | + ::testing::Combine(::testing::Values(ElementType::i64), ::testing::Values(inputShapes)), |
| 60 | + InsertConvertI64I32CPUTest::getTestCaseName); |
| 61 | + |
| 62 | +} // namespace CPULayerTestsDefinitions |
0 commit comments