From ed8d3b72d301518939f973caac9a07879ae04779 Mon Sep 17 00:00:00 2001 From: Edward Shogulin Date: Thu, 4 Mar 2021 16:05:02 +0300 Subject: [PATCH] [LPT] GPU support3DTensorOnActivations - tests (#4576) --- .../mat_mul_with_constant_transformation.cpp | 53 +++++++++++++++++-- .../mat_mul_with_constant_transformation.cpp | 14 +++++ .../src/mat_mul_function.cpp | 6 ++- 3 files changed, 68 insertions(+), 5 deletions(-) diff --git a/inference-engine/tests/functional/inference_engine/lp_transformations/mat_mul_with_constant_transformation.cpp b/inference-engine/tests/functional/inference_engine/lp_transformations/mat_mul_with_constant_transformation.cpp index afa62b70b3f..8a0d8000c2c 100644 --- a/inference-engine/tests/functional/inference_engine/lp_transformations/mat_mul_with_constant_transformation.cpp +++ b/inference-engine/tests/functional/inference_engine/lp_transformations/mat_mul_with_constant_transformation.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // @@ -79,7 +79,10 @@ inline std::ostream& operator << (std::ostream& out, const MatMullTransformation } inline std::ostream& operator << (std::ostream& out, const MatMullTransformationTestValues& values) { - return out << "_" << values.actual << "_" << values.expected; + return out << "_" << + values.params.support3DTensorOnActivations << "_" << + values.actual << "_" << + values.expected; } typedef std::tuple< @@ -201,6 +204,28 @@ std::vector testValues = { } }, + // support3DTensorOnActivations = false for 3D tensor + { + LayerTransformation::createParamsU8I8().setSupport3DTensorOnActivations(false), + { + { 1, 384, 1024 }, + ngraph::element::u8, + { ngraph::element::f32, {}, { 0.02f } }, + { std::vector(1024 * 1024, 1.f), ngraph::element::f32, { 1024, 1024 } }, + { 255, { 1, 1 }, {0.f}, {254.f}, {-12.7f}, {12.7} } + }, + { + { 1, 384, 1024 }, + ngraph::element::u8, + { ngraph::element::f32, {}, { 0.02f } }, + { std::vector(1024 * 1024, 1.f), ngraph::element::f32, { 1024, 1024 } }, + ngraph::element::i8, + {}, + { 255, { 1, 1 }, {0.f}, {254.f}, {-12.7f}, {12.7} }, + {} + } + }, + // 3D: U8 & I8 { LayerTransformation::createParamsU8I8(), @@ -429,6 +454,28 @@ std::vector testValues = { } }, + // support3DTensorOnActivations = false, but 2D tensor is used + { + LayerTransformation::createParamsU8I8().setSupport3DTensorOnActivations(false), + { + { 1, 2048 }, + ngraph::element::u8, + { ngraph::element::f32, {}, { 0.02f } }, + { std::vector(2048 * 1000, 1.f), ngraph::element::f32, { 2048, 1000 }}, + { 255, { 1, 1 }, {0.f}, {254.f}, {-12.7f}, {12.7} }, + {} + }, + { + { 1, 2048 }, + ngraph::element::u8, + {}, + { std::vector(2048 * 1000, -126), ngraph::element::i8, { 2048, 1000 }}, + ngraph::element::i8, + { {}, {}, { 0.02f * 0.1f } }, + {} + } + }, + // 2D: I8 & I8 { LayerTransformation::createParamsI8I8(), @@ -542,7 +589,7 @@ std::vector testValues = { {}, {} } - }, + } }; INSTANTIATE_TEST_CASE_P( diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mat_mul_with_constant_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mat_mul_with_constant_transformation.cpp index 61eeca5e7c7..d5c34f31f81 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mat_mul_with_constant_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mat_mul_with_constant_transformation.cpp @@ -20,6 +20,8 @@ std::vector testValues = { { std::vector(4 * 2, 2.f), ngraph::element::f32, ngraph::Shape{ 2, 4 } }, { 256ul, {{1}, {1}, {2, 1}, {2, 1}}, {-128.f}, {127.f}, {-128.f, -12.8f}, {127.f, 12.7f} }, { {}, {}, {} }, + "result_result", + "FP32" }, { { 2, 3, 4 }, @@ -27,6 +29,8 @@ std::vector testValues = { { std::vector(4 * 2, 2.f), ngraph::element::i8, ngraph::Shape{ 2, 4 } }, {}, { ngraph::element::f32, {}, {0.1f} }, + "result_result", + "FP32" }, { { 1, 3, 4 }, @@ -34,6 +38,8 @@ std::vector testValues = { { std::vector(4 * 2, 2.f), ngraph::element::f32, ngraph::Shape{ 2, 4 } }, { 256ul, {{1}, {1}, {2, 1}, {2, 1}}, {-128.f}, {127.f}, {-128.f, -12.8f}, {127.f, 12.7f} }, { {}, {}, {} }, + "result_result", + "FP32" }, { { 1, 1, 3, 4 }, @@ -41,6 +47,8 @@ std::vector testValues = { { std::vector(4 * 2, 2.f), ngraph::element::f32, ngraph::Shape{ 2, 4 } }, { 256ul, {{1}, {1}, {2, 1}, {2, 1}}, {-128.f}, {127.f}, {-128.f, -12.8f}, {127.f, 12.7f} }, { {}, {}, {} }, + "matMul", + "U8" }, { { 1, 1, 3, 4 }, @@ -48,6 +56,8 @@ std::vector testValues = { { std::vector(4 * 2, 2.f), ngraph::element::i8, ngraph::Shape{ 2, 4 } }, {}, { ngraph::element::f32, {}, {{0.1f, 0.01}, ngraph::element::f32, ngraph::Shape{ 2, 1 }} }, + "matMul", + "U8" }, { { 1, 3, 4 }, @@ -55,6 +65,8 @@ std::vector testValues = { { std::vector(4 * 4, 2.f), ngraph::element::f32, ngraph::Shape{ 4, 4 } }, { 256ul, {{1}, {1}, {1}, {1}}, {-128.f}, {127.f}, {-128.f}, {127.f} }, { {}, {}, {} }, + "result_result", + "FP32" }, { { 2, 3 }, @@ -62,6 +74,8 @@ std::vector testValues = { { std::vector{1, 2, 3, 4, 5, 6}, ngraph::element::f32, ngraph::Shape{ 2, 3 } }, { 256ul, {{1}, {1}, {1}, {1}}, {-128.f}, {127.f}, {-12.8f}, {12.7f} }, { {}, {}, {} }, + "matMul", + "U8" }, { { 2, 3 }, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_function.cpp index e71604ae8f3..32552885ef9 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_function.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020 Intel Corporation +// Copyright (C) 2020-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // @@ -327,7 +327,9 @@ std::shared_ptr MatMulFunction::getOriginal( true); matMul->set_friendly_name("matMul"); - const auto result = std::make_shared(matMul); + const std::shared_ptr result = std::make_shared(matMul); + result->set_friendly_name("result"); + std::shared_ptr function = std::make_shared( ngraph::ResultVector{ result }, std::vector> { input },