diff --git a/inference-engine/src/cldnn_engine/ops/gather_elements.cpp b/inference-engine/src/cldnn_engine/ops/gather_elements.cpp index 7aa061c545dea7..52ddfe13479aa7 100644 --- a/inference-engine/src/cldnn_engine/ops/gather_elements.cpp +++ b/inference-engine/src/cldnn_engine/ops/gather_elements.cpp @@ -8,7 +8,7 @@ #include "ngraph/op/gather_elements.hpp" #include "ngraph/op/constant.hpp" -#include "api/gather_elements.hpp" +#include "cldnn/primitives/gather_elements.hpp" namespace CLDNNPlugin { diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/gather_elements.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/gather_elements.cpp index b4dad74bba3f6e..30b84f007f011b 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/gather_elements.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/gather_elements.cpp @@ -54,15 +54,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_set3, GatherElementsLayerTest, ::testing::Values(CommonTestUtils::DEVICE_CPU)), GatherElementsLayerTest::getTestCaseName); -<<<<<<< HEAD -<<<<<<< HEAD INSTANTIATE_TEST_SUITE_P(smoke_set4, GatherElementsLayerTest, -======= -INSTANTIATE_TEST_CASE_P(yunji_set2, GatherElementsLayerTest, ->>>>>>> Add cldnn unit test implementation -======= -INSTANTIATE_TEST_CASE_P(smoke_set4, GatherElementsLayerTest, ->>>>>>> Add functional test implementation ::testing::Combine( ::testing::Values(std::vector({3, 2, 3, 8})), // Data shape ::testing::Values(std::vector({2, 2, 3, 8})), // Indices shape @@ -72,19 +64,7 @@ INSTANTIATE_TEST_CASE_P(smoke_set4, GatherElementsLayerTest, ::testing::Values(CommonTestUtils::DEVICE_CPU)), GatherElementsLayerTest::getTestCaseName); -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD INSTANTIATE_TEST_SUITE_P(smoke_set5, GatherElementsLayerTest, -======= -INSTANTIATE_TEST_CASE_P(yunji_set3, GatherElementsLayerTest, ->>>>>>> Add cldnn unit test implementation -======= - -======= ->>>>>>> code clean up -INSTANTIATE_TEST_CASE_P(smoke_set5, GatherElementsLayerTest, ->>>>>>> Add functional test implementation ::testing::Combine( ::testing::Values(std::vector({3, 2, 3, 4, 8})), // Data shape ::testing::Values(std::vector({3, 2, 3, 5, 8})), // Indices shape @@ -93,4 +73,4 @@ INSTANTIATE_TEST_CASE_P(smoke_set5, GatherElementsLayerTest, ::testing::ValuesIn(iPrecisions), ::testing::Values(CommonTestUtils::DEVICE_CPU)), GatherElementsLayerTest::getTestCaseName); -} // namespace +} // namespace \ No newline at end of file diff --git a/inference-engine/thirdparty/clDNN/api/gather_elements.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/primitives/gather_elements.hpp similarity index 100% rename from inference-engine/thirdparty/clDNN/api/gather_elements.hpp rename to inference-engine/thirdparty/clDNN/api/cldnn/primitives/gather_elements.hpp diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.cpp index c4afc4c3ae1d82..092555014ef8f1 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_elements_kernel_ref.cpp @@ -155,7 +155,7 @@ KernelsData GatherElementsKernelRef::GetKernelsData(const Params& params, const auto dispatchData = SetDefault(newParams, options); auto cldnn_jit = GetJitConstants(newParams); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; FillCLKernelData(kernel, dispatchData, params.engineInfo, kernelName, jit, entry_point, "", false, false, 2, GetFusedPrimitiveInputsCount(params)); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/gather_elements_ref.cl b/inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/gather_elements_ref.cl index f7005f3450d6b4..5eedb0e1dcaba6 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/gather_elements_ref.cl +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/cl_kernels/gather_elements_ref.cl @@ -1,19 +1,9 @@ -// Copyright (c) 2021 Intel Corporation +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -#include "include/fetch.cl" -#include "include/include_all.cl" +#include "include/data_types.cl" +#include "include/fetch_data.cl" #define GET_UPDATES_INDEX(prefix, idx_order) CAT(prefix, _GET_INDEX)(idx_order) diff --git a/inference-engine/thirdparty/clDNN/src/gather_elements.cpp b/inference-engine/thirdparty/clDNN/src/gather_elements.cpp index 869c31e322e359..ddaa73c04a091b 100644 --- a/inference-engine/thirdparty/clDNN/src/gather_elements.cpp +++ b/inference-engine/thirdparty/clDNN/src/gather_elements.cpp @@ -17,7 +17,7 @@ #include "gather_elements_inst.h" #include "primitive_type_base.h" -#include "error_handler.h" +#include "cldnn/runtime/error_handler.hpp" #include "json_object.h" #include diff --git a/inference-engine/thirdparty/clDNN/src/gpu/gather_elements_gpu.cpp b/inference-engine/thirdparty/clDNN/src/gpu/gather_elements_gpu.cpp deleted file mode 100644 index a7de56fb6c7dd4..00000000000000 --- a/inference-engine/thirdparty/clDNN/src/gpu/gather_elements_gpu.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* -// Copyright (c) 2021 Intel Corporation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -*/ - -#include "gather_elements_inst.h" -#include "primitive_gpu_base.h" -#include "implementation_map.h" -#include "kernel_selector_helper.h" -#include "gather/gather_elements_kernel_selector.h" -#include "gather/gather_elements_kernel_ref.h" -#include "error_handler.h" - -using namespace cldnn; - -namespace cldnn { -namespace gpu { -kernel_selector::gather_elements_axis convert_axis(gather_elements::gather_elements_axis axis) { - switch (axis) { - case gather_elements::along_x: - return kernel_selector::gather_elements_axis::X; - case gather_elements::along_y: - return kernel_selector::gather_elements_axis::Y; - case gather_elements::along_z: - return kernel_selector::gather_elements_axis::Z; - case gather_elements::along_w: - return kernel_selector::gather_elements_axis::W; - case gather_elements::along_f: - return kernel_selector::gather_elements_axis::FEATURE; - case gather_elements::along_b: - return kernel_selector::gather_elements_axis::BATCH; - default: - return kernel_selector::gather_elements_axis::X; - } -} - -struct gather_elements_gpu : typed_primitive_gpu_impl { - using parent = typed_primitive_gpu_impl; - using parent::parent; - -public: - static primitive_impl* create(const gather_elements_node& arg) { - auto gather_elements_params = get_default_params(arg); - auto gather_elements_optional_params = - get_default_optional_params(arg.get_program()); - - gather_elements_params.axis = convert_axis(arg.get_primitive()->axis); - - gather_elements_params.inputs.push_back(convert_data_tensor(arg.input(1).get_output_layout())); - - auto& kernel_selector = kernel_selector::gather_elements_kernel_selector::Instance(); - auto best_kernels = kernel_selector.GetBestKernels(gather_elements_params, gather_elements_optional_params); - - CLDNN_ERROR_BOOL(arg.id(), - "Best_kernel.empty()", - best_kernels.empty(), - "Cannot find a proper kernel with this arguments"); - - auto gather_elements = new gather_elements_gpu(arg, best_kernels[0]); - - return gather_elements; - } -}; - -namespace detail { - -attach_gather_elements_gpu::attach_gather_elements_gpu() { - auto val_fw = gather_elements_gpu::create; - implementation_map::add(std::make_tuple(engine_types::ocl, data_types::f32, format::bfyx), val_fw); - implementation_map::add(std::make_tuple(engine_types::ocl, data_types::f16, format::bfyx), val_fw); - implementation_map::add(std::make_tuple(engine_types::ocl, data_types::i32, format::bfyx), val_fw); - - implementation_map::add(std::make_tuple(engine_types::ocl, data_types::f32, format::bfzyx), val_fw); - implementation_map::add(std::make_tuple(engine_types::ocl, data_types::f16, format::bfzyx), val_fw); - implementation_map::add(std::make_tuple(engine_types::ocl, data_types::i32, format::bfzyx), val_fw); - - implementation_map::add(std::make_tuple(engine_types::ocl, data_types::f32, format::bfwzyx), val_fw); - implementation_map::add(std::make_tuple(engine_types::ocl, data_types::f16, format::bfwzyx), val_fw); - implementation_map::add(std::make_tuple(engine_types::ocl, data_types::i32, format::bfwzyx), val_fw); -} - -} // namespace detail -} // namespace gpu -} // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/gather_elements.cpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/gather_elements.cpp new file mode 100644 index 00000000000000..beb4fbd1068dcd --- /dev/null +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/gather_elements.cpp @@ -0,0 +1,86 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "gather_elements_inst.h" +#include "primitive_base.hpp" +#include "impls/implementation_map.hpp" +#include "kernel_selector_helper.h" +#include "gather/gather_elements_kernel_selector.h" +#include "gather/gather_elements_kernel_ref.h" +#include "cldnn/runtime/error_handler.hpp" + +using namespace cldnn; + +namespace cldnn { +namespace ocl { +kernel_selector::gather_elements_axis convert_axis(gather_elements::gather_elements_axis axis) { + switch (axis) { + case gather_elements::along_x: + return kernel_selector::gather_elements_axis::X; + case gather_elements::along_y: + return kernel_selector::gather_elements_axis::Y; + case gather_elements::along_z: + return kernel_selector::gather_elements_axis::Z; + case gather_elements::along_w: + return kernel_selector::gather_elements_axis::W; + case gather_elements::along_f: + return kernel_selector::gather_elements_axis::FEATURE; + case gather_elements::along_b: + return kernel_selector::gather_elements_axis::BATCH; + default: + return kernel_selector::gather_elements_axis::X; + } +} + +struct gather_elements_impl : typed_primitive_impl_ocl { + using parent = typed_primitive_impl_ocl; + using parent::parent; + + std::unique_ptr clone() const override { + return make_unique(*this); + } + +public: + static primitive_impl* create(const gather_elements_node& arg) { + auto gather_elements_params = get_default_params(arg); + auto gather_elements_optional_params = + get_default_optional_params(arg.get_program()); + + gather_elements_params.axis = convert_axis(arg.get_primitive()->axis); + + gather_elements_params.inputs.push_back(convert_data_tensor(arg.input(1).get_output_layout())); + + auto& kernel_selector = kernel_selector::gather_elements_kernel_selector::Instance(); + auto best_kernels = kernel_selector.GetBestKernels(gather_elements_params, gather_elements_optional_params); + + CLDNN_ERROR_BOOL(arg.id(), + "Best_kernel.empty()", + best_kernels.empty(), + "Cannot find a proper kernel with this arguments"); + + auto gather_elements = new gather_elements_impl(arg, best_kernels[0]); + + return gather_elements; + } +}; + +namespace detail { + +attach_gather_elements_impl::attach_gather_elements_impl() { + implementation_map::add(impl_types::ocl, gather_elements_impl::create, { + std::make_tuple(data_types::f32, format::bfyx), + std::make_tuple(data_types::f16, format::bfyx), + std::make_tuple(data_types::i32, format::bfyx), + std::make_tuple(data_types::f32, format::bfzyx), + std::make_tuple(data_types::f16, format::bfzyx), + std::make_tuple(data_types::i32, format::bfzyx), + std::make_tuple(data_types::f32, format::bfwzyx), + std::make_tuple(data_types::f16, format::bfwzyx), + std::make_tuple(data_types::i32, format::bfwzyx), + }); +} + +} // namespace detail +} // namespace ocl +} // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/register.cpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/register.cpp index c62b64de62dff8..86a423a84713e6 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/ocl/register.cpp +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/register.cpp @@ -30,6 +30,7 @@ void register_implementations() { REGISTER_OCL(eltwise); REGISTER_OCL(fully_connected); REGISTER_OCL(gather); + REGISTER_OCL(gather_elements); REGISTER_OCL(gather_nd); REGISTER_OCL(gemm); REGISTER_OCL(lrn); diff --git a/inference-engine/thirdparty/clDNN/src/impls/ocl/register.hpp b/inference-engine/thirdparty/clDNN/src/impls/ocl/register.hpp index aaf2a777cde83a..dcd58574e52558 100644 --- a/inference-engine/thirdparty/clDNN/src/impls/ocl/register.hpp +++ b/inference-engine/thirdparty/clDNN/src/impls/ocl/register.hpp @@ -22,6 +22,7 @@ #include "cldnn/primitives/fully_connected.hpp" #include "cldnn/primitives/gather.hpp" #include "cldnn/primitives/gather_nd.hpp" +#include "cldnn/primitives/gather_elements.hpp" #include "cldnn/primitives/gemm.hpp" #include "cldnn/primitives/lrn.hpp" #include "cldnn/primitives/lstm.hpp" diff --git a/inference-engine/thirdparty/clDNN/src/include/gather_elements_inst.h b/inference-engine/thirdparty/clDNN/src/include/gather_elements_inst.h index 2b6952bdf6f015..ebefc9c032dea6 100644 --- a/inference-engine/thirdparty/clDNN/src/include/gather_elements_inst.h +++ b/inference-engine/thirdparty/clDNN/src/include/gather_elements_inst.h @@ -16,7 +16,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once -#include "api/gather_elements.hpp" +#include "cldnn/primitives/gather_elements.hpp" #include "primitive_inst.h" #include diff --git a/inference-engine/thirdparty/clDNN/tests/test_cases/fusings_gpu_test.cpp b/inference-engine/thirdparty/clDNN/tests/test_cases/fusings_gpu_test.cpp index 747f575bc47bb3..fb51f20a7ce107 100644 --- a/inference-engine/thirdparty/clDNN/tests/test_cases/fusings_gpu_test.cpp +++ b/inference-engine/thirdparty/clDNN/tests/test_cases/fusings_gpu_test.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -178,6 +179,7 @@ class BaseFusingTest : public ::testing::TestWithParam { description << " " << i.original_id << " " << i.kernel_id << std::endl; } SCOPED_TRACE(description.str()); + // Subtract reorders count to handle execution in different layouts when input/output reorders can be added in the graph ASSERT_EQ(fused.get_executed_primitives().size() - (count_reorder ? 0 : reorders_count_fused), p.expected_fused_primitives); ASSERT_EQ(not_fused.get_executed_primitives().size() - (count_reorder ? 0 : reorders_count_not_fused), p.expected_not_fused_primitives); ASSERT_EQ(outputs_ref.size(), outputs_fused.size()); @@ -8411,11 +8413,12 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, gather_nd_activation_scale_eltwise, gather_nd_test_params{ CASE_GATHER_ND_FP32_6D_2, 2, 5 }, gather_nd_test_params{ CASE_GATHER_ND_FP32_6D_3, 2, 5 }, gather_nd_test_params{ CASE_GATHER_ND_FP32_6D_4, 2, 5 }, -}), ); +})); + /* ----------------------------------------------------------------------------------------------------- */ -/* ------------------------------------------ GatherElements cases ------------------------------------------- */ +/* ------------------------------------------ GatherElements cases ------------------------------------- */ /* ----------------------------------------------------------------------------------------------------- */ struct gather_elements_test_params { data_types data_type; @@ -8525,7 +8528,7 @@ TEST_P(gather_elements_quantize, basic) { execute(p); } -INSTANTIATE_TEST_CASE_P(fusings_gpu, gather_elements_quantize, +INSTANTIATE_TEST_SUITE_P(fusings_gpu, gather_elements_quantize, ::testing::ValuesIn(std::vector{ gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP16_4D_1, 2, 3 }, gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP16_4D_2, 2, 3 }, @@ -8548,7 +8551,7 @@ INSTANTIATE_TEST_CASE_P(fusings_gpu, gather_elements_quantize, gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP32_6D_1, 2, 3 }, gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP32_6D_2, 2, 3 }, gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP32_6D_3, 2, 3 }, -}), ); +})); class gather_elements_scale_activation : public GatherElementsPrimitiveFusingTest {}; @@ -8567,7 +8570,7 @@ TEST_P(gather_elements_scale_activation, basic) { execute(p); } -INSTANTIATE_TEST_CASE_P(fusings_gpu, gather_elements_scale_activation, +INSTANTIATE_TEST_SUITE_P(fusings_gpu, gather_elements_scale_activation, ::testing::ValuesIn(std::vector{ gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP16_4D_1, 2, 4 }, gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP16_4D_2, 2, 4 }, @@ -8590,7 +8593,7 @@ INSTANTIATE_TEST_CASE_P(fusings_gpu, gather_elements_scale_activation, gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP32_6D_1, 2, 4 }, gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP32_6D_2, 2, 4 }, gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP32_6D_3, 2, 4 }, -}), ); +})); class gather_elements_activation_scale_eltwise : public GatherElementsPrimitiveFusingTest {}; @@ -8612,7 +8615,7 @@ TEST_P(gather_elements_activation_scale_eltwise, basic) { execute(p); } -INSTANTIATE_TEST_CASE_P(fusings_gpu, gather_elements_activation_scale_eltwise, +INSTANTIATE_TEST_SUITE_P(fusings_gpu, gather_elements_activation_scale_eltwise, ::testing::ValuesIn(std::vector{ gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP16_4D_1, 2, 5 }, gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP16_4D_2, 2, 5 }, @@ -8635,4 +8638,4 @@ INSTANTIATE_TEST_CASE_P(fusings_gpu, gather_elements_activation_scale_eltwise, gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP32_6D_1, 2, 5 }, gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP32_6D_2, 2, 5 }, gather_elements_test_params{ CASE_GATHER_ELEMENTS_FP32_6D_3, 2, 5 }, -}), ); +})); diff --git a/inference-engine/thirdparty/clDNN/tests/test_cases/gather_elements_gpu_test.cpp b/inference-engine/thirdparty/clDNN/tests/test_cases/gather_elements_gpu_test.cpp index 9b667b8e4ac72e..62f84fb7cb5600 100644 --- a/inference-engine/thirdparty/clDNN/tests/test_cases/gather_elements_gpu_test.cpp +++ b/inference-engine/thirdparty/clDNN/tests/test_cases/gather_elements_gpu_test.cpp @@ -1,43 +1,32 @@ -// Copyright (c) 2021 Intel Corporation +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 // -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -/////////////////////////////////////////////////////////////////////////////////////////////////// -#include +#include "test_utils.h" -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include -#include +#include using namespace cldnn; using namespace ::tests; -inline void DoTest(const engine& engine, - const cldnn::memory& input0, // data - const cldnn::memory& input1, // indices +inline void DoTest(engine& engine, + const cldnn::memory::ptr& input0, // data + const cldnn::memory::ptr& input1, // indices const std::vector& expected_results, const tensor& output_tensor, const cldnn::gather_elements::gather_elements_axis axis) { topology topology; - topology.add(input_layout("InputData", input0.get_layout())); - topology.add(input_layout("InputIndices", input1.get_layout())); + topology.add(input_layout("InputData", input0->get_layout())); + topology.add(input_layout("InputIndices", input1->get_layout())); topology.add( - gather_elements("gather_elements", "InputData", "InputIndices", input1.get_layout().format, output_tensor, axis) + gather_elements("gather_elements", "InputData", "InputIndices", input1->get_layout().format, output_tensor, axis) ); network network(engine, topology); @@ -46,7 +35,8 @@ inline void DoTest(const engine& engine, network.set_input_data("InputIndices", input1); auto outputs = network.execute(); auto output = outputs.at("gather_elements").get_memory(); - auto output_ptr = output.pointer(); + // auto output_ptr = output.pointer(); + cldnn::mem_lock output_ptr(output, get_test_stream()); for (size_t i = 0; i < expected_results.size(); ++i) { EXPECT_EQ(expected_results[i], float16_to_float32(output_ptr[i])); @@ -54,11 +44,11 @@ inline void DoTest(const engine& engine, } TEST(gather_elements_gpu_fp16, d3283_i2283_a0) { - const auto& engine = get_test_engine(); + auto& engine = get_test_engine(); auto axis = cldnn::gather_elements::gather_elements_axis::along_b; - auto input0 = memory::allocate(engine, { data_types::f16, format::bfyx, { 3, 2, 8, 3 } }); // data - auto input1 = memory::allocate(engine, { data_types::f16, format::bfyx, { 2, 2, 8, 3 } }); // indices + auto input0 = engine.allocate_memory({ data_types::f16, format::bfyx, { 3, 2, 8, 3 } }); // data + auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, { 2, 2, 8, 3 } }); // indices set_values(input0, { FLOAT16(0), FLOAT16(1), FLOAT16(8), FLOAT16(5), FLOAT16(5), FLOAT16(2), FLOAT16(0), FLOAT16(7), @@ -115,11 +105,11 @@ TEST(gather_elements_gpu_fp16, d3283_i2283_a0) { } TEST(gather_elements_gpu_fp16, d2235_i2235_a3) { - const auto& engine = get_test_engine(); + auto& engine = get_test_engine(); auto axis = cldnn::gather_elements::gather_elements_axis::along_x; - auto input0 = memory::allocate(engine, { data_types::f16, format::bfyx, { 2, 2, 3, 5 } }); // data - auto input1 = memory::allocate(engine, { data_types::f16, format::bfyx, { 2, 2, 3, 5 } }); // indices + auto input0 = engine.allocate_memory({ data_types::f16, format::bfyx, { 2, 2, 3, 5 } }); // data + auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, { 2, 2, 3, 5 } }); // indices set_values(input0, { FLOAT16(0), FLOAT16(1), FLOAT16(8), FLOAT16(5), FLOAT16(5), FLOAT16(2), @@ -193,11 +183,11 @@ TEST(gather_elements_gpu_fp16, d2235_i2235_a3) { } TEST(gather_elements_gpu_fp16, d1329_i1359_an1) { - const auto& engine = get_test_engine(); + auto& engine = get_test_engine(); auto axis = cldnn::gather_elements::gather_elements_axis::along_x; - auto input0 = memory::allocate(engine, { data_types::f16, format::bfyx, { 1, 3, 2, 9 } }); // data - auto input1 = memory::allocate(engine, { data_types::f16, format::bfyx, { 1, 3, 5, 9 } }); // indices + auto input0 = engine.allocate_memory({ data_types::f16, format::bfyx, { 1, 3, 2, 9 } }); // data + auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, { 1, 3, 5, 9 } }); // indices set_values(input0, { FLOAT16(0), FLOAT16(1), FLOAT16(8), FLOAT16(5), @@ -292,11 +282,11 @@ TEST(gather_elements_gpu_fp16, d1329_i1359_an1) { } TEST(gather_elements_gpu_fp16, d12853_i12923_a3) { - const auto& engine = get_test_engine(); + auto& engine = get_test_engine(); auto axis = cldnn::gather_elements::gather_elements_axis::along_y; - auto input0 = memory::allocate(engine, { data_types::f16, format::bfzyx, { 1, 2, 8, 5, 3 } }); // data - auto input1 = memory::allocate(engine, { data_types::f16, format::bfzyx, { 1, 2, 8, 2, 3 } }); // indices + auto input0 = engine.allocate_memory({ data_types::f16, format::bfzyx, { 1, 2, 8, 5, 3 } }); // data + auto input1 = engine.allocate_memory({ data_types::f16, format::bfzyx, { 1, 2, 8, 2, 3 } }); // indices set_values(input0, { FLOAT16(0), FLOAT16(1), FLOAT16(8), FLOAT16(5), FLOAT16(5), FLOAT16(2), FLOAT16(0), FLOAT16(7), @@ -365,11 +355,11 @@ TEST(gather_elements_gpu_fp16, d12853_i12923_a3) { } TEST(gather_elements_gpu_fp16, d25441_i22441_an4) { - const auto& engine = get_test_engine(); + auto& engine = get_test_engine(); auto axis = cldnn::gather_elements::gather_elements_axis::along_f; - auto input0 = memory::allocate(engine, { data_types::f16, format::bfzyx, { 2, 5, 4, 4, 1 } }); // data - auto input1 = memory::allocate(engine, { data_types::f16, format::bfzyx, { 2, 2, 4, 4, 1 } }); // indices + auto input0 = engine.allocate_memory({ data_types::f16, format::bfzyx, { 2, 5, 4, 4, 1 } }); // data + auto input1 = engine.allocate_memory({ data_types::f16, format::bfzyx, { 2, 2, 4, 4, 1 } }); // indices set_values(input0, { FLOAT16(0), FLOAT16(1), FLOAT16(8), FLOAT16(5), @@ -457,11 +447,11 @@ TEST(gather_elements_gpu_fp16, d25441_i22441_an4) { } TEST(gather_elements_gpu_fp16, d32843_i12843_a0) { - const auto& engine = get_test_engine(); + auto& engine = get_test_engine(); auto axis = cldnn::gather_elements::gather_elements_axis::along_b; - auto input0 = memory::allocate(engine, { data_types::f16, format::bfzyx, { 3, 2, 8, 4, 3 } }); // data - auto input1 = memory::allocate(engine, { data_types::f16, format::bfzyx, { 1, 2, 8, 4, 3 } }); // indices + auto input0 = engine.allocate_memory({ data_types::f16, format::bfzyx, { 3, 2, 8, 4, 3 } }); // data + auto input1 = engine.allocate_memory({ data_types::f16, format::bfzyx, { 1, 2, 8, 4, 3 } }); // indices set_values(input0, { FLOAT16(0), FLOAT16(1), FLOAT16(8), FLOAT16(5), FLOAT16(5), FLOAT16(2), FLOAT16(0), FLOAT16(7), @@ -597,11 +587,11 @@ TEST(gather_elements_gpu_fp16, d32843_i12843_a0) { } TEST(gather_elements_gpu_fp16, d223442_i226442_a5) { - const auto& engine = get_test_engine(); + auto& engine = get_test_engine(); auto axis = cldnn::gather_elements::gather_elements_axis::along_x; - auto input0 = memory::allocate(engine, { data_types::f16, format::bfwzyx, { 2, 2, 3, 4, 4, 2 } }); // data - auto input1 = memory::allocate(engine, { data_types::f16, format::bfwzyx, { 2, 2, 6, 4, 4, 2 } }); // indices + auto input0 = engine.allocate_memory({ data_types::f16, format::bfwzyx, { 2, 2, 3, 4, 4, 2 } }); // data + auto input1 = engine.allocate_memory({ data_types::f16, format::bfwzyx, { 2, 2, 6, 4, 4, 2 } }); // indices set_values(input0, { FLOAT16(0), FLOAT16(1), FLOAT16(8), @@ -1000,11 +990,11 @@ TEST(gather_elements_gpu_fp16, d223442_i226442_a5) { } TEST(gather_elements_gpu_fp16, d124251_i124221_an3) { - const auto& engine = get_test_engine(); + auto& engine = get_test_engine(); auto axis = cldnn::gather_elements::gather_elements_axis::along_z; - auto input0 = memory::allocate(engine, { data_types::f16, format::bfwzyx, { 1, 2, 4, 2, 5, 1 } }); // data - auto input1 = memory::allocate(engine, { data_types::f16, format::bfwzyx, { 1, 2, 4, 2, 2, 1 } }); // indices + auto input0 = engine.allocate_memory({ data_types::f16, format::bfwzyx, { 1, 2, 4, 2, 5, 1 } }); // data + auto input1 = engine.allocate_memory({ data_types::f16, format::bfwzyx, { 1, 2, 4, 2, 2, 1 } }); // indices set_values(input0, { FLOAT16(0), FLOAT16(1), FLOAT16(8), FLOAT16(5), @@ -1055,11 +1045,11 @@ TEST(gather_elements_gpu_fp16, d124251_i124221_an3) { } TEST(gather_elements_gpu_fp16, d233113_i233115_a2) { - const auto& engine = get_test_engine(); + auto& engine = get_test_engine(); auto axis = cldnn::gather_elements::gather_elements_axis::along_w; - auto input0 = memory::allocate(engine, { data_types::f16, format::bfwzyx, { 2, 3, 3, 1, 1, 3 } }); // data - auto input1 = memory::allocate(engine, { data_types::f16, format::bfwzyx, { 2, 3, 3, 1, 1, 5 } }); // indices + auto input0 = engine.allocate_memory({ data_types::f16, format::bfwzyx, { 2, 3, 3, 1, 1, 3 } }); // data + auto input1 = engine.allocate_memory({ data_types::f16, format::bfwzyx, { 2, 3, 3, 1, 1, 5 } }); // indices set_values(input0, { FLOAT16(0), FLOAT16(1), FLOAT16(8),