diff --git a/src/core/reference/include/ngraph/runtime/opt_kernel/reshape.hpp b/src/core/reference/include/ngraph/runtime/opt_kernel/reshape.hpp deleted file mode 100644 index 33f2c5f9465..00000000000 --- a/src/core/reference/include/ngraph/runtime/opt_kernel/reshape.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include "ngraph/axis_vector.hpp" -#include "ngraph/shape.hpp" - -namespace ngraph { -namespace runtime { -namespace opt_kernel { -void reshape(const char* in, - char* out, - const Shape& in_shape, - const AxisVector& in_axis_order, - const Shape& out_shape, - size_t elem_size); -} -} // namespace runtime -} // namespace ngraph diff --git a/src/core/reference/include/openvino/reference/group_convolution_backprop_data.hpp b/src/core/reference/include/openvino/reference/group_convolution_backprop_data.hpp index 66d2a6f431d..5c410d044ce 100644 --- a/src/core/reference/include/openvino/reference/group_convolution_backprop_data.hpp +++ b/src/core/reference/include/openvino/reference/group_convolution_backprop_data.hpp @@ -98,35 +98,5 @@ void group_convolution_backprop_data(const T* in, } } } - -// DEPRECATED, can't be removed currently due to arm-plugin dependency -template ::type> -OPENVINO_DEPRECATED("group_convolution_backprop_data function without output_paddings is deprecated, " - "use the one with output_padding.") -void group_convolution_backprop_data(const INPUT* in, - const FILTER* f, - OUTPUT* out, - const Shape& in_shape, - const Shape& filter_shape, - const Shape& out_shape, - const Strides& strides, - const Strides& dilation, - const CoordinateDiff& pads_begin, - const CoordinateDiff& pads_end) { - const CoordinateDiff output_padding(in_shape.size() - 2, 0); - - group_convolution_backprop_data(in, - f, - out, - in_shape, - filter_shape, - out_shape, - strides, - dilation, - pads_begin, - pads_end, - output_padding); -} - } // namespace reference } // namespace ov diff --git a/src/core/reference/include/openvino/reference/matmul.hpp b/src/core/reference/include/openvino/reference/matmul.hpp index b4a09e0f276..32ced574949 100644 --- a/src/core/reference/include/openvino/reference/matmul.hpp +++ b/src/core/reference/include/openvino/reference/matmul.hpp @@ -9,8 +9,8 @@ #include #include -#include "ngraph/runtime/opt_kernel/reshape.hpp" #include "openvino/reference/broadcast.hpp" +#include "openvino/reference/reshape.hpp" namespace ov { namespace reference { @@ -100,12 +100,12 @@ void matmul(const T* arg0, std::vector tmp(shape_size(arg0_shape)); auto axis_vector = details::get_transpose_order(arg0_shape); std::swap(arg0_shape_tmp[arg0_rank - 1], arg0_shape_tmp[arg0_rank - 2]); - ngraph::runtime::opt_kernel::reshape(reinterpret_cast(arg0_data), - reinterpret_cast(tmp.data()), - arg0_shape, - axis_vector, - arg0_shape_tmp, - sizeof(T)); + reshape(reinterpret_cast(arg0_data), + reinterpret_cast(tmp.data()), + arg0_shape, + axis_vector, + arg0_shape_tmp, + sizeof(T)); arg0_new_data.swap(tmp); arg0_data = arg0_new_data.data(); } @@ -114,12 +114,12 @@ void matmul(const T* arg0, std::vector tmp(shape_size(arg1_shape)); auto axis_vector = details::get_transpose_order(arg1_shape); std::swap(arg1_shape_tmp[arg1_rank - 1], arg1_shape_tmp[arg1_rank - 2]); - ngraph::runtime::opt_kernel::reshape(reinterpret_cast(arg1_data), - reinterpret_cast(tmp.data()), - arg1_shape, - axis_vector, - arg1_shape_tmp, - sizeof(T)); + reshape(reinterpret_cast(arg1_data), + reinterpret_cast(tmp.data()), + arg1_shape, + axis_vector, + arg1_shape_tmp, + sizeof(T)); arg1_new_data.swap(tmp); arg1_data = arg1_new_data.data(); } diff --git a/src/core/reference/include/openvino/reference/range.hpp b/src/core/reference/include/openvino/reference/range.hpp index cc9cb2f643a..c8fb5c5084b 100644 --- a/src/core/reference/include/openvino/reference/range.hpp +++ b/src/core/reference/include/openvino/reference/range.hpp @@ -14,7 +14,7 @@ namespace ov { namespace reference { // Return type is `void`, only enabled if `T` is a built-in FP -// type, or nGraph's `bfloat16` or `float16` type. +// type, or OpenVINO's `bfloat16` or `float16` type. template typename std::enable_if::value || std::is_same::value || std::is_same::value>::type diff --git a/src/core/reference/include/openvino/reference/reshape.hpp b/src/core/reference/include/openvino/reference/reshape.hpp index b3cdd12df47..2e4cb37e163 100644 --- a/src/core/reference/include/openvino/reference/reshape.hpp +++ b/src/core/reference/include/openvino/reference/reshape.hpp @@ -9,11 +9,35 @@ namespace ov { namespace reference { -void reshape(const char* arg, + +/** + * @brief Basic reshape operation, without axes reorder. + * + * @param in Pointer to input data. + * @param out Pointer to output data. + * @param in_shape Input data shape. + * @param out_shape Output data shape. + * @param elem_size Single data element size im bytes. + */ +inline void reshape(const char* in, char* out, const Shape& in_shape, size_t elem_size) { + std::memcpy(out, in, shape_size(in_shape) * elem_size); +} + +/** + * @brief Permutes data shape and axes. + * + * @param in Pointer to input data. + * @param out Pointer to output data. + * @param in_shape Input data shape. + * @param axes_order Axes order. + * @param out_shape Output data shape. + * @param elem_size Single data element size im bytes. + */ +void reshape(const char* in, char* out, const Shape& in_shape, - const AxisVector& in_axis_order, + const AxisVector& axes_order, const Shape& out_shape, size_t elem_size); -} +} // namespace reference } // namespace ov diff --git a/src/core/reference/include/openvino/reference/reverse.hpp b/src/core/reference/include/openvino/reference/reverse.hpp index b4ea16c5013..2eeb6afff50 100644 --- a/src/core/reference/include/openvino/reference/reverse.hpp +++ b/src/core/reference/include/openvino/reference/reverse.hpp @@ -4,9 +4,8 @@ #pragma once -#include - -#include "openvino/reference/utils/coordinate_transform.hpp" +#include "openvino/core/axis_set.hpp" +#include "openvino/core/shape.hpp" namespace ov { namespace reference { diff --git a/src/core/reference/src/op/convert.cpp b/src/core/reference/src/op/convert.cpp index 2846802d6c4..f89cc28a813 100644 --- a/src/core/reference/src/op/convert.cpp +++ b/src/core/reference/src/op/convert.cpp @@ -7,7 +7,7 @@ #if defined(OPENVINO_ARCH_X86) || defined(OPENVINO_ARCH_X86_64) # include "jit_generator.hpp" -using namespace ngraph::runtime; +using namespace ov::runtime; #endif namespace ov { diff --git a/src/core/reference/src/op/depth_to_space.cpp b/src/core/reference/src/op/depth_to_space.cpp index 0a0d33596d4..19024002ea0 100644 --- a/src/core/reference/src/op/depth_to_space.cpp +++ b/src/core/reference/src/op/depth_to_space.cpp @@ -7,8 +7,8 @@ #include #include -#include "ngraph/runtime/opt_kernel/reshape.hpp" #include "openvino/core/except.hpp" +#include "openvino/reference/reshape.hpp" namespace ov { namespace reference { @@ -96,7 +96,7 @@ void depth_to_space(const char* const in, post_transpose_shape[axis_idx] = dispersed_shape[axes_order[axis_idx]]; } - ngraph::runtime::opt_kernel::reshape(in, out, dispersed_shape, axes_order, post_transpose_shape, elem_size); + reshape(in, out, dispersed_shape, axes_order, post_transpose_shape, elem_size); } } // namespace reference diff --git a/src/core/reference/src/op/einsum.cpp b/src/core/reference/src/op/einsum.cpp index abe8f8c14ba..271982c3986 100644 --- a/src/core/reference/src/op/einsum.cpp +++ b/src/core/reference/src/op/einsum.cpp @@ -249,14 +249,6 @@ Shape compute_matmul_output_shape(const Shape& common_sub_shape, return matmul_output_shape; } -/// @brief Prepares default order axis vector -/// -AxisVector get_default_order(size_t rank) { - AxisVector default_order(rank); - std::iota(begin(default_order), end(default_order), 0); - return default_order; -} - /// \brief Update a vector of inputs and subscripts by removing items for /// inputs with indices input_ind1 and input_ind2 and inserted new input and /// the corresponsing subscript in the tail @@ -296,15 +288,12 @@ ov::Tensor unsqueeze_input(const ov::Tensor& input, std::vector& unsque } auto output = ov::Tensor(input.get_element_type(), output_shape); - const auto order = get_default_order(input_shape.size()); const auto element_type = input.get_element_type(); - reference::reshape(reinterpret_cast(input.data()), - reinterpret_cast(output.data()), - input_shape, - order, - output_shape, - element_type.size()); + reshape(static_cast(input.data()), + static_cast(output.data()), + input_shape, + element_type.size()); return output; } @@ -653,14 +642,11 @@ ov::Tensor reshape_input_for_matmul(const ov::Tensor& input, const auto element_type = input.get_element_type(); const auto& input_shape = input.get_shape(); auto output = ov::Tensor(element_type, new_shape); - const auto order = get_default_order(input_shape.size()); - reference::reshape(reinterpret_cast(input.data()), - reinterpret_cast(output.data()), - input_shape, - order, - new_shape, - element_type.size()); + reshape(static_cast(input.data()), + static_cast(output.data()), + input_shape, + element_type.size()); return output; } @@ -930,13 +916,10 @@ void contract_two_inputs(ov::TensorVector& inputs, back_shape.insert(back_shape.end(), separate2_sub_shape.begin(), separate2_sub_shape.end()); auto contract_output = ov::Tensor(matmul_output.get_element_type(), back_shape); - const auto order = get_default_order(matmul_output.get_shape().size()); - reference::reshape(reinterpret_cast(matmul_output.data()), - reinterpret_cast(contract_output.data()), - matmul_output.get_shape(), - order, - back_shape, - matmul_output.get_element_type().size()); + reshape(static_cast(matmul_output.data()), + static_cast(contract_output.data()), + matmul_output.get_shape(), + matmul_output.get_element_type().size()); update_operands(inputs, input_subscripts, input_ind1, input_ind2, contract_output, resultant_subscript); } diff --git a/src/core/reference/src/op/jit_generator.cpp b/src/core/reference/src/op/jit_generator.cpp index 99f224dc68b..e0585ae442c 100644 --- a/src/core/reference/src/op/jit_generator.cpp +++ b/src/core/reference/src/op/jit_generator.cpp @@ -12,9 +12,9 @@ # include # include "jit_generator.hpp" -# include "ngraph/type/float16.hpp" +# include "openvino/core/type/float16.hpp" -namespace ngraph { +namespace ov { namespace runtime { namespace jit { using namespace Xbyak; @@ -186,6 +186,6 @@ void Generator::copy(const Xbyak::Reg64& dst, const Xbyak::Reg64& src, co } } // namespace jit } // namespace runtime -} // namespace ngraph +} // namespace ov #endif // OPENVINO_ARCH_X86 || OPENVINO_ARCH_X86_64 diff --git a/src/core/reference/src/op/jit_generator.hpp b/src/core/reference/src/op/jit_generator.hpp index 9e8900abf63..e6da95c0440 100644 --- a/src/core/reference/src/op/jit_generator.hpp +++ b/src/core/reference/src/op/jit_generator.hpp @@ -11,12 +11,9 @@ #include #include -namespace ngraph -{ - namespace runtime - { - namespace jit - { +namespace ov { +namespace runtime { +namespace jit { #ifdef XBYAK64 static const Xbyak::Operand::Code abi_save_gpr_regs[] = { Xbyak::Operand::RBX, @@ -94,4 +91,4 @@ namespace ngraph }; } } -} + } // namespace ov diff --git a/src/core/reference/src/op/reshape.cpp b/src/core/reference/src/op/reshape.cpp index dec23afda86..efbf0933fc3 100644 --- a/src/core/reference/src/op/reshape.cpp +++ b/src/core/reference/src/op/reshape.cpp @@ -8,12 +8,290 @@ #include #include "openvino/core/except.hpp" +#include "openvino/core/parallel.hpp" #include "openvino/reference/utils/coordinate_range.hpp" #include "openvino/reference/utils/coordinate_transform.hpp" namespace ov { namespace reference { namespace { +static size_t get_threshold() { + // TODO: find a better way, not hardcoded value + return (1 << 9) * parallel_get_num_threads(); +} + +static inline void copy_element(char* out, const char* in, size_t elem_size) { +#define CASE(type) \ + case sizeof(type): \ + *reinterpret_cast(out) = *reinterpret_cast(in); \ + break; + + switch (elem_size) { + CASE(int32_t) + CASE(int64_t) + CASE(int16_t) + CASE(int8_t) + default: + std::memcpy(out, in, elem_size); + break; + } +#undef CASE +} + +void reshape_2D(const char* in, + char* out, + const Shape& in_shape, + const AxisVector& axes_order, + const Shape& out_shape, + size_t elem_size) { + size_t num_elements = shape_size(in_shape); + if (num_elements <= get_threshold()) { + for (size_t i = 0; i < out_shape[0]; i++) { + size_t off = i; + for (size_t j = 0; j < out_shape[1]; j++) { + copy_element(out, in + off * elem_size, elem_size); + out += elem_size; + off += out_shape[0]; + } + } + } else { + ov::parallel_for2d(out_shape[0], out_shape[1], [in, out, &out_shape, elem_size](size_t i, size_t j) { + size_t in_off = j * out_shape[0] + i; + size_t out_off = i * out_shape[1] + j; + copy_element(out + out_off * elem_size, in + in_off * elem_size, elem_size); + }); + } +} + +static std::vector get_strides(size_t rank, size_t elem_size, const AxisVector& order, const Shape& in_shape) { + std::vector rev_order(rank); + for (size_t i = 0; i < rank; i++) { + rev_order[order[i]] = i; + } + + std::vector strides(rank); + strides[rev_order[rank - 1]] = elem_size; + for (size_t i = rank - 1; i > 0; i--) { + strides[rev_order[i - 1]] = strides[rev_order[i]] * in_shape[i]; + } + + return strides; +} + +void reshape_3D(const char* in, + char* out, + const Shape& in_shape, + const AxisVector& axes_order, + const Shape& out_shape, + size_t elem_size) { + size_t num_elements = shape_size(in_shape); + if (num_elements <= get_threshold()) { + const auto strides = get_strides(3, elem_size, axes_order, in_shape); + + size_t off_0 = 0; + for (size_t i = 0; i < out_shape[0]; i++) { + size_t off_1 = off_0; + for (size_t j = 0; j < out_shape[1]; j++) { + size_t in_off = off_1; + for (size_t k = 0; k < out_shape[2]; k++) { + copy_element(out, in + in_off, elem_size); + out += elem_size; + in_off += strides[2]; + } + off_1 += strides[1]; + } + off_0 += strides[0]; + } + } else { + ov::parallel_for3d(out_shape[0], + out_shape[1], + out_shape[2], + [in, out, axes_order, &in_shape, &out_shape, elem_size](size_t i, size_t j, size_t k) { + size_t in_indexes[3]; + in_indexes[axes_order[0]] = i; + in_indexes[axes_order[1]] = j; + in_indexes[axes_order[2]] = k; + size_t in_off = + (in_indexes[0] * in_shape[1] + in_indexes[1]) * in_shape[2] + in_indexes[2]; + size_t out_off = (i * out_shape[1] + j) * out_shape[2] + k; + copy_element(out + out_off * elem_size, in + in_off * elem_size, elem_size); + }); + } +} + +void reshape_4D(const char* in, + char* out, + const Shape& in_shape, + const AxisVector& axes_order, + const Shape& out_shape, + size_t elem_size) { + size_t num_elements = shape_size(in_shape); + if (num_elements <= get_threshold()) { + const auto strides = get_strides(4, elem_size, axes_order, in_shape); + + size_t off_0 = 0; + for (size_t i = 0; i < out_shape[0]; i++) { + size_t off_1 = off_0; + for (size_t j = 0; j < out_shape[1]; j++) { + size_t off_2 = off_1; + for (size_t k = 0; k < out_shape[2]; k++) { + size_t in_off = off_2; + for (size_t l = 0; l < out_shape[3]; l++) { + copy_element(out, in + in_off, elem_size); + out += elem_size; + in_off += strides[3]; + } + off_2 += strides[2]; + } + off_1 += strides[1]; + } + off_0 += strides[0]; + } + } else { + ov::parallel_for4d( + out_shape[0], + out_shape[1], + out_shape[2], + out_shape[3], + [in, out, axes_order, &in_shape, &out_shape, elem_size](size_t i, size_t j, size_t k, size_t l) { + size_t in_indexes[4]; + in_indexes[axes_order[0]] = i; + in_indexes[axes_order[1]] = j; + in_indexes[axes_order[2]] = k; + in_indexes[axes_order[3]] = l; + size_t in_off = + ((in_indexes[0] * in_shape[1] + in_indexes[1]) * in_shape[2] + in_indexes[2]) * in_shape[3] + + in_indexes[3]; + size_t out_off = ((i * out_shape[1] + j) * out_shape[2] + k) * out_shape[3] + l; + copy_element(out + out_off * elem_size, in + in_off * elem_size, elem_size); + }); + } +} + +void reshape_5D(const char* in, + char* out, + const Shape& in_shape, + const AxisVector& axes_order, + const Shape& out_shape, + size_t elem_size) { + size_t num_elements = shape_size(in_shape); + if (num_elements <= get_threshold()) { + const auto strides = get_strides(5, elem_size, axes_order, in_shape); + + size_t off_0 = 0; + for (size_t i = 0; i < out_shape[0]; i++) { + size_t off_1 = off_0; + for (size_t j = 0; j < out_shape[1]; j++) { + size_t off_2 = off_1; + for (size_t k = 0; k < out_shape[2]; k++) { + size_t off_3 = off_2; + for (size_t l = 0; l < out_shape[3]; l++) { + size_t in_off = off_3; + for (size_t m = 0; m < out_shape[4]; m++) { + copy_element(out, in + in_off, elem_size); + out += elem_size; + in_off += strides[4]; + } + off_3 += strides[3]; + } + off_2 += strides[2]; + } + off_1 += strides[1]; + } + off_0 += strides[0]; + } + } else { + ov::parallel_for5d( + out_shape[0], + out_shape[1], + out_shape[2], + out_shape[3], + out_shape[4], + [in, out, axes_order, &in_shape, &out_shape, elem_size](size_t i, size_t j, size_t k, size_t l, size_t m) { + size_t in_indexes[5]; + in_indexes[axes_order[0]] = i; + in_indexes[axes_order[1]] = j; + in_indexes[axes_order[2]] = k; + in_indexes[axes_order[3]] = l; + in_indexes[axes_order[4]] = m; + size_t in_off = + (((in_indexes[0] * in_shape[1] + in_indexes[1]) * in_shape[2] + in_indexes[2]) * in_shape[3] + + in_indexes[3]) * + in_shape[4] + + in_indexes[4]; + size_t out_off = (((i * out_shape[1] + j) * out_shape[2] + k) * out_shape[3] + l) * out_shape[4] + m; + copy_element(out + out_off * elem_size, in + in_off * elem_size, elem_size); + }); + } +} + +void reshape_6D(const char* in, + char* out, + const Shape& in_shape, + const AxisVector& axes_order, + const Shape& out_shape, + size_t elem_size) { + size_t num_elements = shape_size(in_shape); + if (num_elements <= get_threshold()) { + const auto strides = get_strides(6, elem_size, axes_order, in_shape); + + size_t off_0 = 0; + for (size_t i = 0; i < out_shape[0]; i++) { + size_t off_1 = off_0; + for (size_t j = 0; j < out_shape[1]; j++) { + size_t off_2 = off_1; + for (size_t k = 0; k < out_shape[2]; k++) { + size_t off_3 = off_2; + for (size_t l = 0; l < out_shape[3]; l++) { + size_t off_4 = off_3; + for (size_t m = 0; m < out_shape[4]; m++) { + size_t in_off = off_4; + for (size_t n = 0; n < out_shape[5]; n++) { + copy_element(out, in + in_off, elem_size); + out += elem_size; + in_off += strides[5]; + } + off_4 += strides[4]; + } + off_3 += strides[3]; + } + off_2 += strides[2]; + } + off_1 += strides[1]; + } + off_0 += strides[0]; + } + } else { + ov::parallel_for6d( + out_shape[0], + out_shape[1], + out_shape[2], + out_shape[3], + out_shape[4], + out_shape[5], + [=, &axes_order, &in_shape, &out_shape](size_t i, size_t j, size_t k, size_t l, size_t m, size_t n) { + size_t in_indexes[6]; + in_indexes[axes_order[0]] = i; + in_indexes[axes_order[1]] = j; + in_indexes[axes_order[2]] = k; + in_indexes[axes_order[3]] = l; + in_indexes[axes_order[4]] = m; + in_indexes[axes_order[5]] = n; + size_t in_off = + ((((in_indexes[0] * in_shape[1] + in_indexes[1]) * in_shape[2] + in_indexes[2]) * in_shape[3] + + in_indexes[3]) * + in_shape[4] + + in_indexes[4]) * + in_shape[5] + + in_indexes[5]; + size_t out_off = ((((i * out_shape[1] + j) * out_shape[2] + k) * out_shape[3] + l) * out_shape[4] + m) * + out_shape[5] + + n; + copy_element(out + out_off * elem_size, in + in_off * elem_size, elem_size); + }); + } +} + std::vector reorder(const std::vector& origin, const AxisVector& order) { std::vector reordered = origin; auto out = begin(reordered); @@ -24,31 +302,77 @@ std::vector reorder(const std::vector& origin, const AxisVector& } return reordered; } -} // namespace - -void reshape(const char* arg, - char* out, - const Shape& in_shape, - const AxisVector& in_axis_order, - const Shape& out_shape, - size_t elem_size) { - if (shape_size(in_shape) == 1) { - std::memcpy(out, arg, elem_size); - return; - } +void reshape_ND(const char* in, + char* out, + const Shape& in_shape, + const AxisVector& axes_order, + const Shape& out_shape, + size_t elem_size) { char* output = out; const char* const output_end = out + shape_size(out_shape) * elem_size; - const auto axis_strides = reorder(row_major_strides(in_shape), in_axis_order); - for (const auto& coordinate : CoordinateTransformBasic(reorder(in_shape, in_axis_order))) { + const auto axis_strides = reorder(row_major_strides(in_shape), axes_order); + for (const auto& coordinate : CoordinateTransformBasic(reorder(in_shape, axes_order))) { if (output >= output_end) { break; } const auto elem_offset = std::inner_product(begin(coordinate), end(coordinate), begin(axis_strides), 0ll); - const auto input = arg + elem_offset * elem_size; - std::memcpy(output, input, elem_size); + const auto input = in + elem_offset * elem_size; + copy_element(output, input, elem_size); output += elem_size; } } + +bool no_axis_reordering(const AxisVector& axis_order) { + auto tmp = axis_order; + std::sort(begin(tmp), end(tmp)); + tmp.erase(std::unique(begin(tmp), end(tmp)), end(tmp)); + return tmp == axis_order; +} +} // namespace + +void reshape(const char* in, + char* out, + const Shape& in_shape, + const AxisVector& axes_order, + const Shape& out_shape, + size_t elem_size) { + if (no_axis_reordering(axes_order)) { + std::memcpy(out, in, shape_size(in_shape) * elem_size); + return; + } + + if (shape_size(in_shape) == 1) { + copy_element(out, in, elem_size); + return; + } + + switch (in_shape.size()) { + case 0: + copy_element(out, in, elem_size); + break; + case 1: + std::memcpy(out, in, in_shape[0] * elem_size); + break; + case 2: + reshape_2D(in, out, in_shape, axes_order, out_shape, elem_size); + break; + case 3: + reshape_3D(in, out, in_shape, axes_order, out_shape, elem_size); + break; + case 4: + reshape_4D(in, out, in_shape, axes_order, out_shape, elem_size); + break; + case 5: + reshape_5D(in, out, in_shape, axes_order, out_shape, elem_size); + break; + case 6: + reshape_6D(in, out, in_shape, axes_order, out_shape, elem_size); + break; + default: + reshape_ND(in, out, in_shape, axes_order, out_shape, elem_size); + break; + } +} } // namespace reference } // namespace ov diff --git a/src/core/reference/src/op/shuffle_channels.cpp b/src/core/reference/src/op/shuffle_channels.cpp index 487d9511538..bc46c80afb0 100644 --- a/src/core/reference/src/op/shuffle_channels.cpp +++ b/src/core/reference/src/op/shuffle_channels.cpp @@ -4,7 +4,7 @@ #include "openvino/reference/shuffle_channels.hpp" -#include "ngraph/runtime/opt_kernel/reshape.hpp" +#include "openvino/reference/reshape.hpp" namespace ov { namespace reference { @@ -42,7 +42,7 @@ void shuffle_channels(const char* arg, reshaped_input_shape[1], reshaped_input_shape[3]}; AxisVector axis_vector{0, 2, 1, 3}; - ngraph::runtime::opt_kernel::reshape(arg, out, reshaped_input_shape, axis_vector, transposed_shape, elem_size); + reshape(arg, out, reshaped_input_shape, axis_vector, transposed_shape, elem_size); // Reshaped 4D tensor is interpreted as ND output tensor with original shape of data // input diff --git a/src/core/reference/src/op/space_to_depth.cpp b/src/core/reference/src/op/space_to_depth.cpp index 247efe39412..67790a7b56a 100644 --- a/src/core/reference/src/op/space_to_depth.cpp +++ b/src/core/reference/src/op/space_to_depth.cpp @@ -6,8 +6,8 @@ #include -#include "ngraph/runtime/opt_kernel/reshape.hpp" #include "openvino/core/except.hpp" +#include "openvino/reference/reshape.hpp" namespace ov { namespace reference { @@ -84,7 +84,7 @@ void space_to_depth(const char* const in, post_transpose_shape[axis_idx] = dispersed_shape[axes_order[axis_idx]]; } - ngraph::runtime::opt_kernel::reshape(in, out, dispersed_shape, axes_order, post_transpose_shape, elem_size); + reshape(in, out, dispersed_shape, axes_order, post_transpose_shape, elem_size); } } // namespace reference } // namespace ov diff --git a/src/core/reference/src/op/strided_slice.cpp b/src/core/reference/src/op/strided_slice.cpp index 2ff07ba8500..6e83305e653 100644 --- a/src/core/reference/src/op/strided_slice.cpp +++ b/src/core/reference/src/op/strided_slice.cpp @@ -9,17 +9,19 @@ #include #include "ngraph/runtime/aligned_buffer.hpp" -#include "ngraph/runtime/opt_kernel/reshape.hpp" +#include "openvino/reference/reshape.hpp" +#include "openvino/reference/reverse.hpp" +#include "openvino/reference/slice.hpp" -using namespace ov; -NGRAPH_SUPPRESS_DEPRECATED_START +namespace ov { +namespace reference { -void reference::strided_slice(const char* arg, - char* out, - const Shape& arg_shape, - const op::util::SlicePlan& sp, - size_t elem_type) { - auto hasZeroDims = [](const ov::Shape& shape) -> bool { +void strided_slice(const char* arg, + char* out, + const Shape& arg_shape, + const op::util::SlicePlan& sp, + size_t elem_type) { + auto hasZeroDims = [](const Shape& shape) -> bool { return std::any_of(shape.begin(), shape.end(), [](const size_t& dim) { return dim == 0; }); @@ -28,6 +30,7 @@ void reference::strided_slice(const char* arg, return; } + OPENVINO_SUPPRESS_DEPRECATED_START ngraph::runtime::AlignedBuffer slice_out_buffer(shape_size(sp.reshape_in_shape) * elem_type); slice(reinterpret_cast(arg), slice_out_buffer.get_ptr(), @@ -39,12 +42,7 @@ void reference::strided_slice(const char* arg, elem_type); ngraph::runtime::AlignedBuffer reshape_out_buffer(shape_size(sp.reshape_out_shape) * elem_type); - ngraph::runtime::opt_kernel::reshape(slice_out_buffer.get_ptr(), - reshape_out_buffer.get_ptr(), - sp.reshape_in_shape, - ngraph::get_default_order(sp.reshape_in_shape.size()), - sp.reshape_out_shape, - elem_type); + reshape(slice_out_buffer.get_ptr(), reshape_out_buffer.get_ptr(), sp.reshape_in_shape, elem_type); reverse(reshape_out_buffer.get_ptr(), out, @@ -52,4 +50,7 @@ void reference::strided_slice(const char* arg, sp.reshape_out_shape, sp.reverse_axes, elem_type); + OPENVINO_SUPPRESS_DEPRECATED_END } +} // namespace reference +} // namespace ov diff --git a/src/core/reference/src/op/transpose.cpp b/src/core/reference/src/op/transpose.cpp index 5b893ccc569..fbc38ebde38 100644 --- a/src/core/reference/src/op/transpose.cpp +++ b/src/core/reference/src/op/transpose.cpp @@ -9,8 +9,8 @@ #include #include -#include "ngraph/runtime/opt_kernel/reshape.hpp" #include "openvino/core/shape.hpp" +#include "openvino/reference/reshape.hpp" namespace ov { namespace reference { @@ -20,10 +20,10 @@ void transpose(const char* data, size_t element_size, const int64_t* axes_order, Shape out_shape) { - // To reuse opt_kernel::reshape axes order vector has to be converted to AxisVector + // To reuse reference::reshape axes order vector has to be converted to AxisVector // Negative axes are not supported, it is validated by transpose evaluate method std::vector axis_vector(axes_order, axes_order + data_shape.size()); - ngraph::runtime::opt_kernel::reshape(data, out, data_shape, axis_vector, out_shape, element_size); + reshape(data, out, data_shape, axis_vector, out_shape, element_size); } } // namespace reference } // namespace ov diff --git a/src/core/reference/src/runtime/opt_kernel/reshape.cpp b/src/core/reference/src/runtime/opt_kernel/reshape.cpp deleted file mode 100644 index e0ca720845c..00000000000 --- a/src/core/reference/src/runtime/opt_kernel/reshape.cpp +++ /dev/null @@ -1,375 +0,0 @@ -// Copyright (C) 2018-2023 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "ngraph/runtime/opt_kernel/reshape.hpp" - -#include -#include - -#include "openvino/core/parallel.hpp" -#include "openvino/reference/reshape.hpp" - -using namespace ngraph; - -namespace { -void reshape_in0(const char* in, - char* out, - const Shape& in_shape, - const AxisVector& in_axis_order, - const Shape& out_shape, - size_t elem_size) { - memcpy(out, in, elem_size); -} - -void reshape_in1(const char* in, - char* out, - const Shape& in_shape, - const AxisVector& in_axis_order, - const Shape& out_shape, - size_t elem_size) { - size_t size[1]; - size_t in_index[1]; - size_t* map_index[1]; - for (size_t i = 0; i < 1; i++) { - size[i] = in_shape[in_axis_order[i]]; - map_index[in_axis_order[i]] = &in_index[i]; - } - for (in_index[0] = 0; in_index[0] < size[0]; ++in_index[0]) { - memcpy(out, in + *map_index[0] * elem_size, elem_size); - out += elem_size; - } -} - -static size_t get_threshold() { - // TODO: find a better way, not hardcoded value - return (1 << 9) * parallel_get_num_threads(); -} - -static inline void copy_element(char* out, const char* in, size_t elem_size) { -#define CASE(type) \ - case sizeof(type): \ - *reinterpret_cast(out) = *reinterpret_cast(in); \ - break; - - switch (elem_size) { - CASE(int32_t) - CASE(int64_t) - CASE(int16_t) - CASE(int8_t) - default: - std::memcpy(out, in, elem_size); - break; - } -#undef CASE -} - -void reshape_in2(const char* in, - char* out, - const Shape& in_shape, - const AxisVector& in_axis_order, - const Shape& out_shape, - size_t elem_size) { - size_t num_elements = shape_size(in_shape); - if (num_elements <= get_threshold()) { - for (size_t i = 0; i < out_shape[0]; i++) { - size_t off = i; - for (size_t j = 0; j < out_shape[1]; j++) { - copy_element(out, in + off * elem_size, elem_size); - out += elem_size; - off += out_shape[0]; - } - } - } else { - ov::parallel_for2d(out_shape[0], out_shape[1], [in, out, &out_shape, elem_size](size_t i, size_t j) { - size_t in_off = j * out_shape[0] + i; - size_t out_off = i * out_shape[1] + j; - copy_element(out + out_off * elem_size, in + in_off * elem_size, elem_size); - }); - } -} - -static std::vector get_strides(size_t rank, size_t elem_size, const AxisVector& order, const Shape& in_shape) { - std::vector rev_order(rank); - for (size_t i = 0; i < rank; i++) { - rev_order[order[i]] = i; - } - - std::vector strides(rank); - strides[rev_order[rank - 1]] = elem_size; - for (size_t i = rank - 1; i > 0; i--) { - strides[rev_order[i - 1]] = strides[rev_order[i]] * in_shape[i]; - } - - return strides; -} - -void reshape_in3(const char* in, - char* out, - const Shape& in_shape, - const AxisVector& in_axis_order, - const Shape& out_shape, - size_t elem_size) { - size_t num_elements = shape_size(in_shape); - if (num_elements <= get_threshold()) { - const auto strides = get_strides(3, elem_size, in_axis_order, in_shape); - - size_t off_0 = 0; - for (size_t i = 0; i < out_shape[0]; i++) { - size_t off_1 = off_0; - for (size_t j = 0; j < out_shape[1]; j++) { - size_t in_off = off_1; - for (size_t k = 0; k < out_shape[2]; k++) { - copy_element(out, in + in_off, elem_size); - out += elem_size; - in_off += strides[2]; - } - off_1 += strides[1]; - } - off_0 += strides[0]; - } - } else { - ov::parallel_for3d(out_shape[0], - out_shape[1], - out_shape[2], - [in, out, in_axis_order, &in_shape, &out_shape, elem_size](size_t i, size_t j, size_t k) { - size_t in_indexes[3]; - in_indexes[in_axis_order[0]] = i; - in_indexes[in_axis_order[1]] = j; - in_indexes[in_axis_order[2]] = k; - size_t in_off = - (in_indexes[0] * in_shape[1] + in_indexes[1]) * in_shape[2] + in_indexes[2]; - size_t out_off = (i * out_shape[1] + j) * out_shape[2] + k; - copy_element(out + out_off * elem_size, in + in_off * elem_size, elem_size); - }); - } -} - -void reshape_in4(const char* in, - char* out, - const Shape& in_shape, - const AxisVector& in_axis_order, - const Shape& out_shape, - size_t elem_size) { - size_t num_elements = shape_size(in_shape); - if (num_elements <= get_threshold()) { - const auto strides = get_strides(4, elem_size, in_axis_order, in_shape); - - size_t off_0 = 0; - for (size_t i = 0; i < out_shape[0]; i++) { - size_t off_1 = off_0; - for (size_t j = 0; j < out_shape[1]; j++) { - size_t off_2 = off_1; - for (size_t k = 0; k < out_shape[2]; k++) { - size_t in_off = off_2; - for (size_t l = 0; l < out_shape[3]; l++) { - copy_element(out, in + in_off, elem_size); - out += elem_size; - in_off += strides[3]; - } - off_2 += strides[2]; - } - off_1 += strides[1]; - } - off_0 += strides[0]; - } - } else { - ov::parallel_for4d( - out_shape[0], - out_shape[1], - out_shape[2], - out_shape[3], - [in, out, in_axis_order, &in_shape, &out_shape, elem_size](size_t i, size_t j, size_t k, size_t l) { - size_t in_indexes[4]; - in_indexes[in_axis_order[0]] = i; - in_indexes[in_axis_order[1]] = j; - in_indexes[in_axis_order[2]] = k; - in_indexes[in_axis_order[3]] = l; - size_t in_off = - ((in_indexes[0] * in_shape[1] + in_indexes[1]) * in_shape[2] + in_indexes[2]) * in_shape[3] + - in_indexes[3]; - size_t out_off = ((i * out_shape[1] + j) * out_shape[2] + k) * out_shape[3] + l; - copy_element(out + out_off * elem_size, in + in_off * elem_size, elem_size); - }); - } -} - -void reshape_in5(const char* in, - char* out, - const Shape& in_shape, - const AxisVector& in_axis_order, - const Shape& out_shape, - size_t elem_size) { - size_t num_elements = shape_size(in_shape); - if (num_elements <= get_threshold()) { - const auto strides = get_strides(5, elem_size, in_axis_order, in_shape); - - size_t off_0 = 0; - for (size_t i = 0; i < out_shape[0]; i++) { - size_t off_1 = off_0; - for (size_t j = 0; j < out_shape[1]; j++) { - size_t off_2 = off_1; - for (size_t k = 0; k < out_shape[2]; k++) { - size_t off_3 = off_2; - for (size_t l = 0; l < out_shape[3]; l++) { - size_t in_off = off_3; - for (size_t m = 0; m < out_shape[4]; m++) { - copy_element(out, in + in_off, elem_size); - out += elem_size; - in_off += strides[4]; - } - off_3 += strides[3]; - } - off_2 += strides[2]; - } - off_1 += strides[1]; - } - off_0 += strides[0]; - } - } else { - ov::parallel_for5d( - out_shape[0], - out_shape[1], - out_shape[2], - out_shape[3], - out_shape[4], - [in, out, in_axis_order, &in_shape, &out_shape, elem_size](size_t i, - size_t j, - size_t k, - size_t l, - size_t m) { - size_t in_indexes[5]; - in_indexes[in_axis_order[0]] = i; - in_indexes[in_axis_order[1]] = j; - in_indexes[in_axis_order[2]] = k; - in_indexes[in_axis_order[3]] = l; - in_indexes[in_axis_order[4]] = m; - size_t in_off = - (((in_indexes[0] * in_shape[1] + in_indexes[1]) * in_shape[2] + in_indexes[2]) * in_shape[3] + - in_indexes[3]) * - in_shape[4] + - in_indexes[4]; - size_t out_off = (((i * out_shape[1] + j) * out_shape[2] + k) * out_shape[3] + l) * out_shape[4] + m; - copy_element(out + out_off * elem_size, in + in_off * elem_size, elem_size); - }); - } -} - -void reshape_in6(const char* in, - char* out, - const Shape& in_shape, - const AxisVector& in_axis_order, - const Shape& out_shape, - size_t elem_size) { - size_t num_elements = shape_size(in_shape); - if (num_elements <= get_threshold()) { - const auto strides = get_strides(6, elem_size, in_axis_order, in_shape); - - size_t off_0 = 0; - for (size_t i = 0; i < out_shape[0]; i++) { - size_t off_1 = off_0; - for (size_t j = 0; j < out_shape[1]; j++) { - size_t off_2 = off_1; - for (size_t k = 0; k < out_shape[2]; k++) { - size_t off_3 = off_2; - for (size_t l = 0; l < out_shape[3]; l++) { - size_t off_4 = off_3; - for (size_t m = 0; m < out_shape[4]; m++) { - size_t in_off = off_4; - for (size_t n = 0; n < out_shape[5]; n++) { - copy_element(out, in + in_off, elem_size); - out += elem_size; - in_off += strides[5]; - } - off_4 += strides[4]; - } - off_3 += strides[3]; - } - off_2 += strides[2]; - } - off_1 += strides[1]; - } - off_0 += strides[0]; - } - } else { - ov::parallel_for6d( - out_shape[0], - out_shape[1], - out_shape[2], - out_shape[3], - out_shape[4], - out_shape[5], - [in, out, in_axis_order, &in_shape, &out_shape, elem_size](size_t i, - size_t j, - size_t k, - size_t l, - size_t m, - size_t n) { - size_t in_indexes[6]; - in_indexes[in_axis_order[0]] = i; - in_indexes[in_axis_order[1]] = j; - in_indexes[in_axis_order[2]] = k; - in_indexes[in_axis_order[3]] = l; - in_indexes[in_axis_order[4]] = m; - in_indexes[in_axis_order[5]] = n; - size_t in_off = - ((((in_indexes[0] * in_shape[1] + in_indexes[1]) * in_shape[2] + in_indexes[2]) * in_shape[3] + - in_indexes[3]) * - in_shape[4] + - in_indexes[4]) * - in_shape[5] + - in_indexes[5]; - size_t out_off = ((((i * out_shape[1] + j) * out_shape[2] + k) * out_shape[3] + l) * out_shape[4] + m) * - out_shape[5] + - n; - copy_element(out + out_off * elem_size, in + in_off * elem_size, elem_size); - }); - } -} - -bool no_axis_reordering(const AxisVector& axis_order) { - auto tmp = axis_order; - std::sort(begin(tmp), end(tmp)); - tmp.erase(std::unique(begin(tmp), end(tmp)), end(tmp)); - return tmp == axis_order; -} - -} // namespace -void runtime::opt_kernel::reshape(const char* in, - char* out, - const Shape& in_shape, - const AxisVector& in_axis_order, - const Shape& out_shape, - size_t elem_size) { - if (no_axis_reordering(in_axis_order)) { - std::memcpy(out, in, shape_size(in_shape) * elem_size); - return; - } - - switch (in_shape.size()) { - case 0: - reshape_in0(in, out, in_shape, in_axis_order, out_shape, elem_size); - break; - case 1: - reshape_in1(in, out, in_shape, in_axis_order, out_shape, elem_size); - break; - case 2: - reshape_in2(in, out, in_shape, in_axis_order, out_shape, elem_size); - break; - case 3: - reshape_in3(in, out, in_shape, in_axis_order, out_shape, elem_size); - break; - case 4: - reshape_in4(in, out, in_shape, in_axis_order, out_shape, elem_size); - break; - case 5: - reshape_in5(in, out, in_shape, in_axis_order, out_shape, elem_size); - break; - case 6: - reshape_in6(in, out, in_shape, in_axis_order, out_shape, elem_size); - break; - default: - ov::reference::reshape(in, out, in_shape, in_axis_order, out_shape, elem_size); - break; - } -} diff --git a/src/core/src/op/batch_to_space.cpp b/src/core/src/op/batch_to_space.cpp index e9c4acb2253..da2c2c5fa70 100644 --- a/src/core/src/op/batch_to_space.cpp +++ b/src/core/src/op/batch_to_space.cpp @@ -16,10 +16,10 @@ #include "ngraph/builder/make_constant.hpp" #include "ngraph/node.hpp" #include "ngraph/opsets/opset3.hpp" -#include "ngraph/runtime/opt_kernel/reshape.hpp" #include "ngraph/shape.hpp" #include "openvino/op/util/precision_sensitive_attribute.hpp" #include "openvino/op/util/slice_plan.hpp" +#include "openvino/reference/reshape.hpp" #include "openvino/reference/strided_slice.hpp" using namespace std; @@ -110,12 +110,12 @@ bool batch_to_space_evaluate(const HostTensorVector& outputs, const HostTensorVe for (size_t block_idx = 1; block_idx < block_values_size; ++block_idx) { dispersed_shape[0] = block_values[block_idx]; dispersed_shape[1] /= block_values[block_idx]; - runtime::opt_kernel::reshape(flat_data, - dispersed_data.data(), - data_shape, - plain_axes_order, - dispersed_shape, - elem_size); + ov::reference::reshape(flat_data, + dispersed_data.data(), + data_shape, + plain_axes_order, + dispersed_shape, + elem_size); size_t val = 1; for (size_t axis_idx = 0; axis_idx <= block_values_size; ++axis_idx) { @@ -130,21 +130,21 @@ bool batch_to_space_evaluate(const HostTensorVector& outputs, const HostTensorVe post_transpose_shape[axis_idx] = dispersed_shape[axes_order[axis_idx]]; } - runtime::opt_kernel::reshape(dispersed_data.data(), - post_transpose_data.data(), - dispersed_shape, - axes_order, - post_transpose_shape, - elem_size); + ov::reference::reshape(dispersed_data.data(), + post_transpose_data.data(), + dispersed_shape, + axes_order, + post_transpose_shape, + elem_size); squeezed_shape[0] = dispersed_shape[1]; squeezed_shape[block_idx] *= block_values[block_idx]; dispersed_shape[block_idx + 1] = squeezed_shape[block_idx]; - runtime::opt_kernel::reshape(post_transpose_data.data(), - flat_data, - post_transpose_shape, - plain_axes_order, - squeezed_shape, - elem_size); + ov::reference::reshape(post_transpose_data.data(), + flat_data, + post_transpose_shape, + plain_axes_order, + squeezed_shape, + elem_size); data_shape = squeezed_shape; } diff --git a/src/core/src/op/reshape.cpp b/src/core/src/op/reshape.cpp index a20a4b5d3a0..279a06350ee 100644 --- a/src/core/src/op/reshape.cpp +++ b/src/core/src/op/reshape.cpp @@ -10,7 +10,6 @@ #include "bound_evaluate.hpp" #include "compare.hpp" #include "itt.hpp" -#include "ngraph/runtime/opt_kernel/reshape.hpp" #include "ngraph/util.hpp" #include "openvino/core/dimension_tracker.hpp" #include "openvino/core/validation_util.hpp" @@ -177,15 +176,10 @@ bool op::v1::Reshape::evaluate_reshape(ov::TensorVector& outputs, const ov::Tens OPENVINO_ASSERT(ov::PartialShape(output_shape).is_static()); outputs[0].set_shape(ov::PartialShape(output_shape).to_shape()); - OPENVINO_SUPPRESS_DEPRECATED_START - const AxisVector order = ngraph::get_default_order(inputs[0].get_shape()); - OPENVINO_SUPPRESS_DEPRECATED_END - ngraph::runtime::opt_kernel::reshape(static_cast(inputs[0].data()), - static_cast(outputs[0].data()), - inputs[0].get_shape(), - order, - outputs[0].get_shape(), - inputs[0].get_element_type().size()); + ov::reference::reshape(static_cast(inputs[0].data()), + static_cast(outputs[0].data()), + inputs[0].get_shape(), + inputs[0].get_element_type().size()); return true; } diff --git a/src/core/src/op/shuffle_channels.cpp b/src/core/src/op/shuffle_channels.cpp index 30de73691bb..50ffa228d33 100644 --- a/src/core/src/op/shuffle_channels.cpp +++ b/src/core/src/op/shuffle_channels.cpp @@ -11,7 +11,6 @@ #include "ngraph/attribute_visitor.hpp" #include "ngraph/builder/reshape.hpp" #include "ngraph/runtime/host_tensor.hpp" -#include "ngraph/runtime/opt_kernel/reshape.hpp" #include "ngraph/type/element_type.hpp" #include "ngraph/type/element_type_traits.hpp" #include "openvino/core/validation_util.hpp" diff --git a/src/core/src/op/space_to_batch.cpp b/src/core/src/op/space_to_batch.cpp index 634a0163f08..1747b6b6156 100644 --- a/src/core/src/op/space_to_batch.cpp +++ b/src/core/src/op/space_to_batch.cpp @@ -15,10 +15,10 @@ #include "ngraph/builder/make_constant.hpp" #include "ngraph/node.hpp" #include "ngraph/ops.hpp" -#include "ngraph/runtime/opt_kernel/reshape.hpp" #include "ngraph/shape.hpp" #include "openvino/op/util/precision_sensitive_attribute.hpp" #include "openvino/reference/pad.hpp" +#include "openvino/reference/reshape.hpp" using namespace std; using namespace ngraph; @@ -169,32 +169,32 @@ bool ngraph::op::v1::SpaceToBatch::evaluate_space_to_batch(const HostTensorVecto } } - ngraph::runtime::opt_kernel::reshape(flat_data.data(), - dispersed_data.data(), - data_shape, - plain_axes_order, - dispersed_shape, - elem_size); + ov::reference::reshape(flat_data.data(), + dispersed_data.data(), + data_shape, + plain_axes_order, + dispersed_shape, + elem_size); ov::Shape post_transpose_shape(axes_order.size()); for (size_t i = 0; i < axes_order.size(); ++i) { post_transpose_shape[i] = dispersed_shape[axes_order[i]]; } - ngraph::runtime::opt_kernel::reshape(dispersed_data.data(), - post_transpose_data.data(), - dispersed_shape, - axes_order, - post_transpose_shape, - elem_size); + ov::reference::reshape(dispersed_data.data(), + post_transpose_data.data(), + dispersed_shape, + axes_order, + post_transpose_shape, + elem_size); squeezed_shape[0] *= block_values[block_idx]; squeezed_shape[block_idx] /= block_values[block_idx]; - ngraph::runtime::opt_kernel::reshape(post_transpose_data.data(), - flat_data.data(), - post_transpose_shape, - plain_axes_order, - squeezed_shape, - elem_size); + ov::reference::reshape(post_transpose_data.data(), + flat_data.data(), + post_transpose_shape, + plain_axes_order, + squeezed_shape, + elem_size); data_shape = squeezed_shape; } diff --git a/src/core/tests/reshape_opt_kernel.cpp b/src/core/tests/reshape_opt_kernel.cpp index d23b25308a3..823f75cc39e 100644 --- a/src/core/tests/reshape_opt_kernel.cpp +++ b/src/core/tests/reshape_opt_kernel.cpp @@ -8,8 +8,8 @@ #include #include "common_test_utils/ndarray.hpp" -#include "ngraph/runtime/opt_kernel/reshape.hpp" #include "openvino/core/axis_vector.hpp" +#include "openvino/reference/reshape.hpp" using namespace ov; @@ -50,12 +50,12 @@ TEST_P(ReshapeOptKernel, reshape_opt_kernel) { for (size_t i = 0; i < out_shape.size(); i++) out_shape[i] = in_shape[axis_order[i]]; - ngraph::runtime::opt_kernel::reshape((const char*)p.input.data(), - (char*)output_buff.data(), - in_shape, - axis_order, - out_shape, - sizeof(ElementValue)); + ov::reference::reshape(static_cast(p.input.data()), + reinterpret_cast(output_buff.data()), + in_shape, + axis_order, + out_shape, + sizeof(ElementValue)); EXPECT_EQ(p.output.get_vector(), output_buff); }