From b2110b352cdac699cc2719d6251206e2edba37f6 Mon Sep 17 00:00:00 2001 From: Vladimir Paramuzov Date: Sat, 19 Mar 2022 11:11:07 +0300 Subject: [PATCH] [GPU] Update data structures for conv/pool/deconv params (#9641) --- .../primitives/binary_convolution.hpp | 14 +- .../intel_gpu/primitives/convolution.hpp | 184 ++--- .../intel_gpu/primitives/deconvolution.hpp | 43 +- .../include/intel_gpu/primitives/pooling.hpp | 68 +- .../include/intel_gpu/runtime/utils.hpp | 9 + .../intel_gpu/src/graph/arg_max_min.cpp | 2 +- .../intel_gpu/src/graph/average_unpooling.cpp | 2 +- .../src/graph/binary_convolution.cpp | 38 +- .../intel_gpu/src/graph/convolution.cpp | 72 +- .../intel_gpu/src/graph/deconvolution.cpp | 48 +- .../src/graph/deformable_convolution.cpp | 7 +- .../graph_optimizer/eltwise_remove_stride.cpp | 11 +- .../graph_optimizer/eltwise_shrinking.cpp | 14 +- .../graph_optimizer/handle_input_padding.cpp | 97 ++- .../graph_optimizer/pre_replace_deconv.cpp | 35 +- .../graph/graph_optimizer/prepare_padding.cpp | 95 ++- .../prepare_primitive_fusing.cpp | 7 +- .../graph/impls/ocl/binary_convolution.cpp | 20 +- .../src/graph/impls/ocl/convolution.cpp | 20 +- .../src/graph/impls/ocl/deconvolution.cpp | 21 +- .../impls/ocl/deformable_convolution.cpp | 23 +- .../intel_gpu/src/graph/impls/ocl/pooling.cpp | 74 +- .../graph/impls/onednn/convolution_onednn.cpp | 9 +- .../impls/onednn/deconvolution_onednn.cpp | 9 +- .../src/graph/impls/onednn/pooling_onednn.cpp | 9 +- .../graph/include/sliding_window_utils.hpp | 447 +++++++++++ ..._utils.h => sliding_window_utils_legacy.h} | 0 .../intel_gpu/src/graph/layout_optimizer.cpp | 21 +- .../intel_gpu/src/graph/max_unpooling.cpp | 2 +- src/plugins/intel_gpu/src/graph/pooling.cpp | 47 +- src/plugins/intel_gpu/src/graph/program.cpp | 15 +- .../intel_gpu/src/plugin/ops/convolution.cpp | 179 +++-- .../intel_gpu/src/plugin/ops/pooling.cpp | 124 ++- .../binary_convolution_fusion_test.cpp | 38 +- .../tests/fusions/convolution_fusion_test.cpp | 227 +++--- .../fusions/deconvolution_fusion_test.cpp | 174 ++-- .../tests/fusions/pooling_fusion_test.cpp | 85 +- .../module_tests/reorder_inputs_test.cpp | 6 +- .../test_module_fusing_reorder.cpp | 6 +- .../test_cases/average_unpooling_gpu_test.cpp | 34 +- .../binary_convolution_gpu_test.cpp | 34 +- .../test_cases/concatenation_gpu_test.cpp | 70 +- .../tests/test_cases/convolution_gpu_test.cpp | 756 +++++++++--------- .../test_cases/deconvolution_gpu_test.cpp | 210 ++--- .../test_cases/depth_concatenate_gpu_test.cpp | 26 +- .../test_cases/max_unpooling_gpu_test.cpp | 42 +- .../tests/test_cases/memory_test.cpp | 28 +- .../tests/test_cases/pooling_gpu_test.cpp | 364 +++++---- .../test_cases/removing_output_node_test.cpp | 10 +- .../tests/test_cases/reorder_gpu_test.cpp | 61 +- .../tests/test_cases/streams_test.cpp | 28 +- .../tests/test_cases/topology_test.cpp | 30 +- .../intel_gpu/tests/test_utils/test_utils.h | 12 +- 53 files changed, 2325 insertions(+), 1682 deletions(-) create mode 100644 src/plugins/intel_gpu/src/graph/include/sliding_window_utils.hpp rename src/plugins/intel_gpu/src/graph/include/{sliding_window_utils.h => sliding_window_utils_legacy.h} (100%) diff --git a/src/plugins/intel_gpu/include/intel_gpu/primitives/binary_convolution.hpp b/src/plugins/intel_gpu/include/intel_gpu/primitives/binary_convolution.hpp index ab9d7784b6d..a92b1a57caa 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/primitives/binary_convolution.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/primitives/binary_convolution.hpp @@ -5,6 +5,8 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once #include "primitive.hpp" +#include "openvino/core/coordinate_diff.hpp" +#include "openvino/core/strides.hpp" #include namespace cldnn { @@ -36,9 +38,9 @@ struct binary_convolution : public primitive_base { binary_convolution(const primitive_id& id, const primitive_id& input, const std::vector& weights, - tensor stride = {1, 1, 1, 1}, - tensor pad = {0, 0, 0, 0}, - tensor dilation = {1, 1, 1, 1}, + ov::Strides stride = {1, 1}, + ov::CoordinateDiff pad = {0, 0}, + ov::Strides dilation = {1, 1}, tensor output_size = {0, 0, 0, 0}, int groups = 1, float pad_value = 0.0f, @@ -55,13 +57,13 @@ struct binary_convolution : public primitive_base { weights(weights) {} /// @brief Defines logical pad value added to input tensor - tensor pad; + ov::CoordinateDiff pad; /// @brief Defines shift in input buffer between adjacent calculations of output values. - tensor stride; + ov::Strides stride; /// @brief Defines gaps in the input - dilation rate k=1 is normal binary_convolution, k=2 means skipping one pixel per input, k=4 means skipping 3 pixels. /// As an example in one dimension, a filter w of size 3 would compute over input x the following: w[0]*x[0] + w[1]*x[1] + w[2]*x[2] for dilation of 1. /// For dilation 2 the filter would instead compute w[0]*x[0] + w[1]*x[2] + w[2]*x[4]. - tensor dilation; + ov::Strides dilation; /// @brief User-defined output data size of the primitive (w/o padding). tensor output_size; /// @brief Number of feature groups (grouped convolution). If more than 1 then weights/bias count needs to be 1. diff --git a/src/plugins/intel_gpu/include/intel_gpu/primitives/convolution.hpp b/src/plugins/intel_gpu/include/intel_gpu/primitives/convolution.hpp index aa92acbcd74..ab3073ab7e2 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/primitives/convolution.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/primitives/convolution.hpp @@ -5,6 +5,8 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once #include "primitive.hpp" +#include "openvino/core/strides.hpp" +#include "openvino/core/coordinate_diff.hpp" #include namespace cldnn { @@ -47,9 +49,9 @@ struct convolution : public primitive_base { const std::vector& weights, const std::vector& bias, uint32_t groups, - tensor stride, - tensor pad, - tensor dilation, + ov::Strides stride, + ov::CoordinateDiff pad, + ov::Strides dilation, tensor output_size, data_types output_type, bool grouped_weights_shape, @@ -63,8 +65,8 @@ struct convolution : public primitive_base { output_size(output_size), groups(groups), deformable_groups(1), - padding_above(tensor(0)), - padding_below(tensor(0)), + padding_above(stride.size(), 0), + padding_below(stride.size(), 0), grouped_weights_shape(grouped_weights_shape), weights(weights), bias(bias), @@ -98,9 +100,9 @@ struct convolution : public primitive_base { const std::vector& a_zero_point, uint32_t groups, data_types output_data_type, - tensor stride, - tensor pad, - tensor dilation, + ov::Strides stride, + ov::CoordinateDiff pad, + ov::Strides dilation, tensor output_size, bool grouped_weights_shape, const primitive_id& ext_prim_id = "", @@ -113,8 +115,8 @@ struct convolution : public primitive_base { output_size(output_size), groups(groups), deformable_groups(1), - padding_above(tensor(0)), - padding_below(tensor(0)), + padding_above(stride.size(), 0), + padding_below(stride.size(), 0), grouped_weights_shape(grouped_weights_shape), weights(weights), bias(bias), @@ -155,9 +157,9 @@ struct convolution : public primitive_base { const std::vector& compensation, uint32_t groups, data_types output_data_type, - tensor stride, - tensor pad, - tensor dilation, + ov::Strides stride, + ov::CoordinateDiff pad, + ov::Strides dilation, tensor output_size, bool grouped_weights_shape, const primitive_id& ext_prim_id = "", @@ -170,8 +172,8 @@ struct convolution : public primitive_base { output_size(output_size), groups(groups), deformable_groups(1), - padding_above(tensor(0)), - padding_below(tensor(0)), + padding_above(stride.size(), 0), + padding_below(stride.size(), 0), grouped_weights_shape(grouped_weights_shape), weights(weights), bias(bias), @@ -203,9 +205,9 @@ struct convolution : public primitive_base { const primitive_id& input, const std::vector& weights, const std::vector& bias, - tensor stride = {1, 1, 1, 1}, - tensor pad = tensor(0), - tensor dilation = {1, 1, 1, 1}, + ov::Strides stride = {1, 1}, + ov::CoordinateDiff pad = {0, 0}, + ov::Strides dilation = {1, 1}, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) : primitive_base(id, {input}, ext_prim_id, output_padding), @@ -215,8 +217,8 @@ struct convolution : public primitive_base { with_output_size(false), groups(1), deformable_groups(1), - padding_above(tensor(0)), - padding_below(tensor(0)), + padding_above(stride.size(), 0), + padding_below(stride.size(), 0), grouped_weights_shape(false), weights(weights), bias(bias), @@ -246,11 +248,11 @@ struct convolution : public primitive_base { const primitive_id& input, const std::vector& weights, const std::vector& bias, - tensor stride, - tensor pad, - tensor dilation, - tensor padding_above, - tensor padding_below, + ov::Strides stride, + ov::CoordinateDiff pad, + ov::Strides dilation, + ov::CoordinateDiff padding_above, + ov::CoordinateDiff padding_below, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) : primitive_base(id, {input}, ext_prim_id, output_padding), @@ -293,11 +295,11 @@ struct convolution : public primitive_base { const std::vector& weights, const std::vector& bias, uint32_t groups, - tensor stride, - tensor pad, - tensor dilation, - tensor padding_above, - tensor padding_below, + ov::Strides stride, + ov::CoordinateDiff pad, + ov::Strides dilation, + ov::CoordinateDiff padding_above, + ov::CoordinateDiff padding_below, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) : primitive_base(id, {input}, ext_prim_id, output_padding), @@ -339,9 +341,9 @@ struct convolution : public primitive_base { const std::vector& weights, const std::vector& bias, uint32_t groups, - tensor stride = {1, 1, 1, 1}, - tensor pad = tensor(0), - tensor dilation = {1, 1, 1, 1}, + ov::Strides stride = {1, 1}, + ov::CoordinateDiff pad = {0, 0}, + ov::Strides dilation = {1, 1}, bool grouped_weights_shape = false, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) @@ -352,8 +354,8 @@ struct convolution : public primitive_base { with_output_size(false), groups(groups), deformable_groups(1), - padding_above(tensor(0)), - padding_below(tensor(0)), + padding_above(stride.size(), 0), + padding_below(stride.size(), 0), grouped_weights_shape(grouped_weights_shape), weights(weights), bias(bias), @@ -382,9 +384,9 @@ struct convolution : public primitive_base { convolution(const primitive_id& id, const primitive_id& input, const std::vector& weights, - tensor stride = {1, 1, 1, 1}, - tensor pad = tensor(0), - tensor dilation = {1, 1, 1, 1}, + ov::Strides stride = {1, 1}, + ov::CoordinateDiff pad = {0, 0}, + ov::Strides dilation = {1, 1}, bool grouped_weights_shape = false, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) @@ -395,8 +397,8 @@ struct convolution : public primitive_base { with_output_size(false), groups(1), deformable_groups(1), - padding_above(tensor(0)), - padding_below(tensor(0)), + padding_above(stride.size(), 0), + padding_below(stride.size(), 0), grouped_weights_shape(grouped_weights_shape), weights(weights), bias(std::vector(0)), @@ -422,11 +424,11 @@ struct convolution : public primitive_base { convolution(const primitive_id& id, const primitive_id& input, const std::vector& weights, - tensor stride, - tensor pad, - tensor dilation, - tensor padding_above, - tensor padding_below, + ov::Strides stride, + ov::CoordinateDiff pad, + ov::Strides dilation, + ov::CoordinateDiff padding_above, + ov::CoordinateDiff padding_below, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) : primitive_base(id, {input}, ext_prim_id, output_padding), @@ -465,11 +467,11 @@ struct convolution : public primitive_base { const primitive_id& input, const std::vector& weights, uint32_t groups, - tensor stride, - tensor pad, - tensor dilation, - tensor padding_above, - tensor padding_below, + ov::Strides stride, + ov::CoordinateDiff pad, + ov::Strides dilation, + ov::CoordinateDiff padding_above, + ov::CoordinateDiff padding_below, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) : primitive_base(id, {input}, ext_prim_id, output_padding), @@ -506,9 +508,9 @@ struct convolution : public primitive_base { const primitive_id& input, const std::vector& weights, uint32_t groups, - tensor stride = {1, 1, 1, 1}, - tensor pad = tensor(0), - tensor dilation = {1, 1, 1, 1}, + ov::Strides stride = {1, 1}, + ov::CoordinateDiff pad = {0, 0}, + ov::Strides dilation = {1, 1}, bool grouped_weights_shape = false, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) @@ -519,8 +521,8 @@ struct convolution : public primitive_base { with_output_size(false), groups(groups), deformable_groups(1), - padding_above(tensor(0)), - padding_below(tensor(0)), + padding_above(stride.size(), 0), + padding_below(stride.size(), 0), grouped_weights_shape(grouped_weights_shape), weights(weights), bias(std::vector(0)), @@ -547,9 +549,9 @@ struct convolution : public primitive_base { const primitive_id& input, const std::vector& weights, const std::vector& bias, - tensor stride, - tensor pad, - tensor dilation, + ov::Strides stride, + ov::CoordinateDiff pad, + ov::Strides dilation, tensor output_size, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) @@ -561,8 +563,8 @@ struct convolution : public primitive_base { output_size(output_size), groups(1), deformable_groups(1), - padding_above(tensor(0)), - padding_below(tensor(0)), + padding_above(stride.size(), 0), + padding_below(stride.size(), 0), grouped_weights_shape(false), weights(weights), bias(bias), @@ -590,9 +592,9 @@ struct convolution : public primitive_base { convolution(const primitive_id& id, const primitive_id& input, const std::vector& weights, - tensor stride, - tensor pad, - tensor dilation, + ov::Strides stride, + ov::CoordinateDiff pad, + ov::Strides dilation, tensor output_size, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) @@ -604,8 +606,8 @@ struct convolution : public primitive_base { output_size(output_size), groups(1), deformable_groups(1), - padding_above(tensor(0)), - padding_below(tensor(0)), + padding_above(stride.size(), 0), + padding_below(stride.size(), 0), grouped_weights_shape(false), weights(weights), bias(std::vector(0)), @@ -638,9 +640,9 @@ struct convolution : public primitive_base { const std::vector& bias, uint32_t groups, uint32_t deformable_groups, - tensor stride, - tensor pad, - tensor dilation, + ov::Strides stride, + ov::CoordinateDiff pad, + ov::Strides dilation, tensor output_size, bool bilinear_interpolation_pad = false, const primitive_id& ext_prim_id = "", @@ -653,8 +655,8 @@ struct convolution : public primitive_base { output_size(output_size), groups(groups), deformable_groups(deformable_groups), - padding_above(tensor(0)), - padding_below(tensor(0)), + padding_above(stride.size(), 0), + padding_below(stride.size(), 0), deformable_mode {true}, bilinear_interpolation_pad(bilinear_interpolation_pad), grouped_weights_shape(false), @@ -690,9 +692,9 @@ struct convolution : public primitive_base { const std::vector& weights, const std::vector& bias, tensor output_size, - tensor stride = {1, 1, 1, 1}, - tensor pad = tensor(0), - tensor dilation = {1, 1, 1, 1}, + ov::Strides stride = {1, 1}, + ov::CoordinateDiff pad = {0, 0}, + ov::Strides dilation = {1, 1}, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) { return convolution(id, @@ -726,9 +728,9 @@ struct convolution : public primitive_base { const primitive_id& input, const std::vector& weights, tensor output_size, - tensor stride = {1, 1, 1, 1}, - tensor pad = tensor(0), - tensor dilation = {1, 1, 1, 1}, + ov::Strides stride = {1, 1}, + ov::CoordinateDiff pad = {0, 0}, + ov::Strides dilation = {1, 1}, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) { return convolution(id, @@ -743,13 +745,13 @@ struct convolution : public primitive_base { } /// @brief Defines logical pad value added to input tensor. - tensor pad; + ov::CoordinateDiff pad; /// @brief Defines shift in input buffer between adjacent calculations of output values. - tensor stride; + ov::Strides stride; /// @brief Defines gaps in the input - dilation rate k=1 is normal convolution, k=2 means skipping one pixel per input, k=4 means skipping 3 pixels. /// As an example in one dimension, a filter w of size 3 would compute over input x the following: w[0]*x[0] + w[1]*x[1] + w[2]*x[2] for dilation of 1. /// For dilation 2 the filter would instead compute w[0]*x[0] + w[1]*x[2] + w[2]*x[4]. - tensor dilation; + ov::Strides dilation; /// @brief Indicates that the primitive has user-defined output size (non-zero value). bool with_output_size; /// @brief User-defined output data size of the primitive (w/o padding). @@ -760,9 +762,9 @@ struct convolution : public primitive_base { /// by channel dimension. uint32_t deformable_groups; /// @param padding_above Defines a padding added to input image on left (x axis) and top (y axis). - tensor padding_above; + ov::CoordinateDiff padding_above; /// @param padding_below Defines a padding added to input image on right (x axis) and bottom (y axis). - tensor padding_below; + ov::CoordinateDiff padding_below; /// @param deformable_mode. bool deformable_mode {false}; /// if bilinear_interpolation_pad is true and the sampling location is within one pixel outside of the feature map boundary, @@ -806,9 +808,9 @@ struct deformable_interp : public primitive_base { const std::vector& inputs, uint32_t groups, uint32_t deformable_groups, - tensor stride, - tensor pad, - tensor dilation, + ov::Strides stride, + ov::CoordinateDiff pad, + ov::Strides dilation, tensor output_size, tensor kernel_size, bool bilinear_interpolation_pad, @@ -822,18 +824,18 @@ struct deformable_interp : public primitive_base { kernel_size(kernel_size), groups(groups), deformable_groups(deformable_groups), - padding_above(tensor(0)), - padding_below(tensor(0)), + padding_above(stride.size(), 0), + padding_below(stride.size(), 0), bilinear_interpolation_pad {bilinear_interpolation_pad} {} /// @brief Defines logical pad value added to input tensor. - tensor pad; + ov::CoordinateDiff pad; /// @brief Defines shift in input buffer between adjacent calculations of output values. - tensor stride; + ov::Strides stride; /// @brief Defines gaps in the input - dilation rate k=1 is normal convolution, k=2 means skipping one pixel per input, k=4 means skipping 3 pixels. /// As an example in one dimension, a filter w of size 3 would compute over input x the following: w[0]*x[0] + w[1]*x[1] + w[2]*x[2] for dilation of 1. /// For dilation 2 the filter would instead compute w[0]*x[0] + w[1]*x[2] + w[2]*x[4]. - tensor dilation; + ov::Strides dilation; /// @brief Size of output tensor. tensor output_size; /// @brief Size of weights tensor. @@ -844,9 +846,9 @@ struct deformable_interp : public primitive_base { /// by channel dimension. uint32_t deformable_groups; /// @param padding_above Defines a padding added to input image on left (x axis) and top (y axis). - tensor padding_above; + ov::CoordinateDiff padding_above; /// @param padding_below Defines a padding added to input image on right (x axis) and bottom (y axis). - tensor padding_below; + ov::CoordinateDiff padding_below; /// @brief if bilinear_interpolation_pad is true and the sampling location is within one pixel outside /// of the feature map boundary, then bilinear interpolation is performed on the zero padded feature map. bool bilinear_interpolation_pad {false}; diff --git a/src/plugins/intel_gpu/include/intel_gpu/primitives/deconvolution.hpp b/src/plugins/intel_gpu/include/intel_gpu/primitives/deconvolution.hpp index 0588cd55bcf..9904bc29b27 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/primitives/deconvolution.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/primitives/deconvolution.hpp @@ -5,6 +5,9 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #pragma once #include "primitive.hpp" + +#include "openvino/core/strides.hpp" +#include "openvino/core/coordinate_diff.hpp" #include namespace cldnn { @@ -34,8 +37,8 @@ struct deconvolution : public primitive_base { const primitive_id& input, const std::vector& weights, const std::vector& bias, - tensor stride = {1, 1, 1, 1}, - tensor pad = {0, 0, 0, 0}, + ov::Strides stride = {1, 1}, + ov::CoordinateDiff pad = {0, 0}, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) : primitive_base(id, {input}, ext_prim_id, output_padding), @@ -61,8 +64,8 @@ struct deconvolution : public primitive_base { const std::vector& weights, const std::vector& bias, uint32_t groups, - tensor stride = {1, 1, 1, 1}, - tensor pad = {0, 0, 0, 0}, + ov::Strides stride = {1, 1}, + ov::CoordinateDiff pad = {0, 0}, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) : primitive_base(id, {input}, ext_prim_id, output_padding), @@ -85,8 +88,8 @@ struct deconvolution : public primitive_base { deconvolution(const primitive_id& id, const primitive_id& input, const std::vector& weights, - tensor stride = {1, 1, 1, 1}, - tensor pad = {0, 0, 0, 0}, + ov::Strides stride = {1, 1}, + ov::CoordinateDiff pad = {0, 0}, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) : primitive_base(id, {input}, ext_prim_id, output_padding), @@ -111,8 +114,8 @@ struct deconvolution : public primitive_base { const primitive_id& input, const std::vector &weights, uint32_t groups, - tensor stride = {1, 1, 1, 1}, - tensor pad = {0, 0, 0, 0}, + ov::Strides stride = {1, 1}, + ov::CoordinateDiff pad = {0, 0}, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) : primitive_base(id, {input}, ext_prim_id, output_padding), @@ -138,8 +141,8 @@ struct deconvolution : public primitive_base { const primitive_id& input, const std::vector& weights, const std::vector& bias, - tensor stride, - tensor pad, + ov::Strides stride, + ov::CoordinateDiff pad, tensor output_size, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) @@ -169,8 +172,8 @@ struct deconvolution : public primitive_base { const std::vector& weights, const std::vector& bias, uint32_t groups, - tensor stride, - tensor pad, + ov::Strides stride, + ov::CoordinateDiff pad, tensor output_size, bool grouped_weights_shape, const primitive_id& ext_prim_id = "", @@ -197,8 +200,8 @@ struct deconvolution : public primitive_base { deconvolution(const primitive_id& id, const primitive_id& input, const std::vector& weights, - tensor stride, - tensor pad, + ov::Strides stride, + ov::CoordinateDiff pad, tensor output_size, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) @@ -228,8 +231,8 @@ struct deconvolution : public primitive_base { const std::vector& weights, const std::vector& bias, tensor output_size, - tensor stride = {1, 1, 1, 1}, - tensor pad = {0, 0, 0, 0}, + ov::Strides stride = {1, 1}, + ov::CoordinateDiff pad = {0, 0}, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) { return deconvolution(id, @@ -257,8 +260,8 @@ struct deconvolution : public primitive_base { const primitive_id& input, const std::vector& weights, tensor output_size, - tensor stride = {1, 1, 1, 1}, - tensor pad = {0, 0, 0, 0}, + ov::Strides stride = {1, 1}, + ov::CoordinateDiff pad = {0, 0}, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) { return deconvolution(id, @@ -272,9 +275,9 @@ struct deconvolution : public primitive_base { } /// @brief Defines logical pad value added to input tensor. - tensor pad; + ov::CoordinateDiff pad; /// @brief Defines shift in input buffer between adjacent calculations of output values. - tensor stride; + ov::Strides stride; /// @brief Indicates that the primitive has user-defined output size (non-zero value). bool with_output_size; /// @brief User-defined output data size of the primitive (w/o padding). diff --git a/src/plugins/intel_gpu/include/intel_gpu/primitives/pooling.hpp b/src/plugins/intel_gpu/include/intel_gpu/primitives/pooling.hpp index d40090f2aba..7d8c224fabb 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/primitives/pooling.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/primitives/pooling.hpp @@ -7,6 +7,9 @@ #include "primitive.hpp" #include +#include "openvino/core/shape.hpp" +#include "openvino/core/strides.hpp" + namespace cldnn { /// @addtogroup cpp_api C++ API /// @{ @@ -46,9 +49,9 @@ struct pooling : public primitive_base { pooling(const primitive_id& id, const primitive_id& input, pooling_mode mode, - const tensor& size, - const tensor& stride, - const tensor& pad = {0, 0, 0, 0}, + const ov::Shape& size, + const ov::Strides& stride, + const ov::Shape& pad = {0, 0}, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) : primitive_base(id, {input}, ext_prim_id, output_padding), @@ -58,7 +61,8 @@ struct pooling : public primitive_base { pad(pad), stride(stride), size(size), - with_output_size(false) {} + with_output_size(false), + pad_end(size.size(), 0) {} /// @brief Constructs pooling primitive with argmax. /// @param id This primitive id. @@ -74,9 +78,9 @@ struct pooling : public primitive_base { const primitive_id& input, const primitive_id& argmax, pooling_mode mode, - const tensor& size, - const tensor& stride, - const tensor& pad = {0, 0, 0, 0}, + const ov::Shape& size, + const ov::Strides& stride, + const ov::Shape& pad = {0, 0}, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) : primitive_base(id, {input}, ext_prim_id, output_padding), @@ -86,7 +90,8 @@ struct pooling : public primitive_base { pad(pad), stride(stride), size(size), - with_output_size(false) {} + with_output_size(false), + pad_end(size.size(), 0) {} /// @brief Constructs pooling primitive (computes input paddings to match output size). /// @param id This primitive id. @@ -99,9 +104,9 @@ struct pooling : public primitive_base { pooling(const primitive_id& id, const primitive_id& input, pooling_mode mode, - const tensor& size, - const tensor& stride, - const tensor& pad, + const ov::Shape& size, + const ov::Strides& stride, + const ov::Shape& pad, tensor output_size, const data_types output_data_type, const primitive_id& ext_prim_id = "", @@ -114,7 +119,8 @@ struct pooling : public primitive_base { stride(stride), size(size), with_output_size(true), - output_size(output_size) {} + output_size(output_size), + pad_end(size.size(), 0) {} /// @brief Constructs pooling primitive with argmax (computes input paddings to match output size). /// @param id This primitive id. @@ -130,9 +136,9 @@ struct pooling : public primitive_base { const primitive_id& input, const primitive_id& argmax, pooling_mode mode, - const tensor& size, - const tensor& stride, - const tensor& pad, + const ov::Shape& size, + const ov::Strides& stride, + const ov::Shape& pad, tensor output_size, const primitive_id& ext_prim_id = "", const padding& output_padding = padding()) @@ -144,7 +150,8 @@ struct pooling : public primitive_base { stride(stride), size(size), with_output_size(true), - output_size(output_size) {} + output_size(output_size), + pad_end(size.size(), 0) {} /// @brief Constructs pooling primitive with kernel size equal to the spatial dimension of input tensor. /// @param id This primitive id. @@ -159,10 +166,11 @@ struct pooling : public primitive_base { argmax(""), mode(static_cast(mode)), global_pooling(true), - pad(0, 0, 0, 0), - stride(1, 1, 1, 1), - size(0, 0, 0, 0), - with_output_size(false) {} + pad({0, 0}), + stride({1, 1}), + size({0, 0}), + with_output_size(false), + pad_end(size.size(), 0) {} /// @brief Constructs pooling primitive that supports MaxPool features from opset8 (dilation and indices output). /// @param id This primitive id. @@ -179,11 +187,11 @@ struct pooling : public primitive_base { pooling(const primitive_id& id, const primitive_id& input, const primitive_id& indices_output, - const tensor& size, - const tensor& stride, - const tensor& dilation, - const tensor& pad, - const tensor& pad_end, + const ov::Shape& size, + const ov::Strides& stride, + const ov::Strides& dilation, + const ov::Shape& pad, + const ov::Shape& pad_end, int64_t axis, data_types index_element_type, tensor output_size, @@ -217,19 +225,19 @@ struct pooling : public primitive_base { /// @brief Global pooling (kernel size is equal to the spatial dimension of input tensor) bool global_pooling; /// @brief Defines logical pad value added to input tensor. - tensor pad; + ov::Shape pad; /// @brief Defines shift in input buffer between adjacent calculations of output values. - tensor stride; + ov::Strides stride; /// @brief Defines index of next pixel to select when pooling - tensor dilation; + ov::Strides dilation; /// @brief Pooling kernel size. - tensor size; + ov::Shape size; /// @brief Indicates that the primitive has user-defined output size (non-zero value). bool with_output_size; /// @brief User-defined output data size of the primitive (w/o padding). tensor output_size; /// @brief Defines a shift, relative to the end of padding shape. - tensor pad_end; + ov::Shape pad_end; /// @brief first dimension of input that should be used to calculate the upper bound of index output int64_t axis = 0; /// @brief type of index output diff --git a/src/plugins/intel_gpu/include/intel_gpu/runtime/utils.hpp b/src/plugins/intel_gpu/include/intel_gpu/runtime/utils.hpp index 63745630455..9546d94d218 100644 --- a/src/plugins/intel_gpu/include/intel_gpu/runtime/utils.hpp +++ b/src/plugins/intel_gpu/include/intel_gpu/runtime/utils.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include namespace cldnn { @@ -171,6 +172,14 @@ inline bool any_not_zero(const std::vector vec) { return std::any_of(vec.begin(), vec.end(), [](const T& val) { return val != 0; }); } +// Helpers to get string for types that have operator<< defined +template +inline std::string to_string(const T& v) { + std::stringstream s; + s << v; + return s.str(); +} + /// @} /// @endcond /// @} diff --git a/src/plugins/intel_gpu/src/graph/arg_max_min.cpp b/src/plugins/intel_gpu/src/graph/arg_max_min.cpp index 27a4e9584d9..6dc6da3e223 100644 --- a/src/plugins/intel_gpu/src/graph/arg_max_min.cpp +++ b/src/plugins/intel_gpu/src/graph/arg_max_min.cpp @@ -4,7 +4,7 @@ #include "arg_max_min_inst.h" #include "primitive_type_base.h" -#include "sliding_window_utils.h" +#include "sliding_window_utils_legacy.h" #include "intel_gpu/runtime/error_handler.hpp" #include "json_object.h" #include diff --git a/src/plugins/intel_gpu/src/graph/average_unpooling.cpp b/src/plugins/intel_gpu/src/graph/average_unpooling.cpp index 7f0e6c8698b..94d03b18a17 100644 --- a/src/plugins/intel_gpu/src/graph/average_unpooling.cpp +++ b/src/plugins/intel_gpu/src/graph/average_unpooling.cpp @@ -4,7 +4,7 @@ #include "average_unpooling_inst.h" #include "primitive_type_base.h" -#include "sliding_window_utils.h" +#include "sliding_window_utils_legacy.h" #include "intel_gpu/runtime/error_handler.hpp" #include "json_object.h" #include diff --git a/src/plugins/intel_gpu/src/graph/binary_convolution.cpp b/src/plugins/intel_gpu/src/graph/binary_convolution.cpp index 799d6d7e6be..3f490550c41 100644 --- a/src/plugins/intel_gpu/src/graph/binary_convolution.cpp +++ b/src/plugins/intel_gpu/src/graph/binary_convolution.cpp @@ -7,7 +7,6 @@ #include "convolution_inst.h" #include "reorder_inst.h" #include "primitive_type_base.h" -#include "sliding_window_utils.h" #include "intel_gpu/runtime/error_handler.hpp" #include "json_object.h" #include @@ -54,10 +53,10 @@ std::string binary_convolution_inst::to_string(binary_convolution_node const& no std::stringstream primitive_description; json_composite conv_info; - conv_info.add("stride", strd.to_string()); - conv_info.add("pad", desc->pad.to_string()); + conv_info.add("stride", cldnn::to_string(strd)); + conv_info.add("pad", cldnn::to_string(desc->pad)); conv_info.add("split", split); - conv_info.add("dilation", dilation.to_string()); + conv_info.add("dilation", cldnn::to_string(dilation)); conv_info.add("out size", desc->output_size.to_string()); node_info->add("binary convolution info", conv_info); @@ -69,23 +68,30 @@ std::string binary_convolution_inst::to_string(binary_convolution_node const& no binary_convolution_inst::typed_primitive_inst(network& network, binary_convolution_node const& node) : parent(network, node) { auto stride = argument.stride; + auto pad = argument.pad; - auto input_inst = node.input().get_output_layout(); - auto output_inst = node.get_output_layout(); - auto output_size = output_inst.size; + auto input_layout = node.input().get_output_layout(); + auto output_layout = node.get_output_layout(); + auto output_size = output_layout.size; CLDNN_ERROR_NOT_EQUAL(node.id(), "Input number of dimensions", - input_inst.size.raw.size(), + input_layout.size.raw.size(), "output number of dimensions", - output_inst.size.raw.size(), + output_layout.size.raw.size(), "Input/output dims mismatch"); CLDNN_ERROR_NOT_EQUAL(node.id(), "Stride number of dimensions", - stride.raw.size(), + stride.size(), "output number of dimensions", - output_inst.size.raw.size(), + output_layout.get_spatial_rank(), "stride/output dims mismatch"); + CLDNN_ERROR_NOT_EQUAL(node.id(), + "pad number of dimensions", + pad.size(), + "input number of dimensions", + input_layout.get_spatial_rank(), + "Input offset/ input size mismatch"); auto split = node.get_split(); for (decltype(split) j = 0; j < split; j++) { @@ -97,7 +103,7 @@ binary_convolution_inst::typed_primitive_inst(network& network, binary_convoluti "Weights number of dimensions", filter_inst.size.raw.size(), "output number of dimensions", - output_inst.size.raw.size(), + output_layout.size.raw.size(), "Weights/output dims mismatch"); CLDNN_ERROR_NOT_EQUAL(node.id(), "Convolution padding mode", @@ -105,12 +111,6 @@ binary_convolution_inst::typed_primitive_inst(network& network, binary_convoluti "padding value", 0.0f, "Unknown padding mode."); - CLDNN_ERROR_NOT_EQUAL(node.id(), - "pad number of dimensions", - pad.raw.size(), - "input number of dimensions", - input_inst.size.raw.size(), - "Input offset/ input size mismatch"); CLDNN_ERROR_NOT_EQUAL(node.id(), "Output feature size", output_size.feature.size(), @@ -125,7 +125,7 @@ binary_convolution_inst::typed_primitive_inst(network& network, binary_convoluti "Only one-dimensional batch size are supported"); CLDNN_ERROR_LESS_THAN(node.id(), "Weights feature maps number", - input_inst.size.feature[0], + input_layout.size.feature[0], "input feature maps number", filter_inst.size.feature[0], "Weights/ifm mismatch"); diff --git a/src/plugins/intel_gpu/src/graph/convolution.cpp b/src/plugins/intel_gpu/src/graph/convolution.cpp index 208b1c45725..8e179bf38db 100644 --- a/src/plugins/intel_gpu/src/graph/convolution.cpp +++ b/src/plugins/intel_gpu/src/graph/convolution.cpp @@ -6,11 +6,13 @@ #include "pass_manager.h" #include "convolution_inst.h" #include "primitive_type_base.h" -#include "sliding_window_utils.h" +#include "sliding_window_utils.hpp" #include "intel_gpu/runtime/error_handler.hpp" #include "json_object.h" #include +using namespace ov::runtime::intel_gpu; + namespace cldnn { primitive_type_id convolution::type_id() { static primitive_type_base instance; @@ -48,28 +50,37 @@ layout convolution_inst::calc_output_layout(convolution_node const& node) { output_type = data_types::f32; } + uint32_t stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; + uint32_t stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + uint32_t stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; + + uint32_t dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1; + uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1; + uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1; + + // TODO: Consider moving general parameter verification to arguments constructor. CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(), "Stride spatial X", - stride.spatial[0], + stride_x, "value", 0, "Stride spatial X must be positive (>= 1)"); CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(), "Stride spatial Y", - stride.spatial[1], + stride_y, "value", 0, "Stride spatial Y must be positive (>= 1)"); CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(), "Dilatation spatial X", - dilation.spatial[0], + dilation_x, "value", 0, "Dilatation patial X must be positive (>= 1)"); CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(), "Dilatation spatial Y", - dilation.spatial[1], + dilation_y, "value", 0, "Dilatation spatial Y must be positive (>= 1)"); @@ -78,13 +89,13 @@ layout convolution_inst::calc_output_layout(convolution_node const& node) { // convolution 3D CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(), "Stride spatial Z", - stride.spatial[2], + stride_z, "value", 0, "Stride spatial Z must be positive (>= 1)"); CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(), "Dilatation spatial Z", - dilation.spatial[2], + dilation_z, "value", 0, "Dilatation spatial Z must be positive (>= 1)"); @@ -108,25 +119,25 @@ layout convolution_inst::calc_output_layout(convolution_node const& node) { "Convolution with winograd input only supports split == 1"); CLDNN_ERROR_NOT_EQUAL(node.id(), "stride spatial X", - stride.spatial[0], + stride_x, "expected value", 1, "Convolution's input in winograd_2x3_s1_data format can only be used with stride 1x1"); CLDNN_ERROR_NOT_EQUAL(node.id(), "stride spatial Y", - stride.spatial[1], + stride_y, "expected value", 1, "Convolution's input in winograd_2x3_s1_data format can only be used with stride 1x1"); CLDNN_ERROR_NOT_EQUAL(node.id(), "Dilatation spatial X", - dilation.spatial[0], + dilation_x, "expected value", 1, "Winograd 2x3 convolution does not support dilatation"); CLDNN_ERROR_NOT_EQUAL(node.id(), "Dilatation spatial Y", - dilation.spatial[1], + dilation_y, "expected value", 1, "Winograd 2x3 convolution does not support dilatation"); @@ -264,13 +275,13 @@ std::string convolution_inst::to_string(convolution_node const& node) { std::string a_zp = desc->activations_zero_points.empty() ? "false" : "true"; json_composite conv_info; - conv_info.add("stride", strd.to_string()); - conv_info.add("pad", desc->pad.to_string()); - conv_info.add("padding above", desc->padding_above.to_string()); - conv_info.add("padding below", desc->padding_below.to_string()); + conv_info.add("stride", cldnn::to_string(strd)); + conv_info.add("pad", cldnn::to_string(desc->pad)); + conv_info.add("padding above", cldnn::to_string(desc->padding_above)); + conv_info.add("padding below", cldnn::to_string(desc->padding_below)); conv_info.add("split", split); conv_info.add("groups", groups); - conv_info.add("dilation", dilation.to_string()); + conv_info.add("dilation", cldnn::to_string(dilation)); conv_info.add("deformable_groups", desc->deformable_groups); conv_info.add("groups", desc->groups); conv_info.add("has zero points for weights: ", w_zp); @@ -290,23 +301,18 @@ std::string convolution_inst::to_string(convolution_node const& node) { convolution_inst::typed_primitive_inst(network& network, convolution_node const& node) : parent(network, node) { auto stride = argument.stride; + auto pad = argument.pad; - auto input_inst = node.input().get_output_layout(); - auto output_inst = node.get_output_layout(); - auto output_size = output_inst.size; + auto input_layout = node.input().get_output_layout(); + auto output_layout = node.get_output_layout(); + auto output_size = output_layout.size; CLDNN_ERROR_NOT_EQUAL(node.id(), "Input number of dimensions", - input_inst.size.raw.size(), + input_layout.size.raw.size(), "output number of dimensions", - output_inst.size.raw.size(), + output_layout.size.raw.size(), "Input/output dims mismatch"); - CLDNN_ERROR_NOT_EQUAL(node.id(), - "Stride number of dimensions", - stride.raw.size(), - "output number of dimensions", - output_inst.size.raw.size(), - "stride/output dims mismatch"); auto split = node.get_split(); for (decltype(split) j = 0; j < split; j++) { @@ -356,7 +362,7 @@ convolution_inst::typed_primitive_inst(network& network, convolution_node const& "Weights number of dimensions", filter_inst.size.raw.size(), "output number of dimensions", - output_inst.size.raw.size(), + output_layout.size.raw.size(), "Weights/output dims mismatch"); CLDNN_ERROR_NOT_EQUAL(node.id(), "Convolution padding mode", @@ -364,12 +370,6 @@ convolution_inst::typed_primitive_inst(network& network, convolution_node const& "padding value", 0.0f, "Unknown padding mode."); - CLDNN_ERROR_NOT_EQUAL(node.id(), - "Pad number of dimensions", - pad.raw.size(), - "input number of dimensions", - input_inst.size.raw.size(), - "Pad/ input size mismatch"); CLDNN_ERROR_NOT_EQUAL(node.id(), "Output feature size", output_size.feature.size(), @@ -384,7 +384,7 @@ convolution_inst::typed_primitive_inst(network& network, convolution_node const& "Only one-dimensional batch size are supported"); CLDNN_ERROR_LESS_THAN(node.id(), "Weights feature maps number", - input_inst.size.feature[0], + input_layout.size.feature[0], "input feature maps number", weights_ifm, "Weights/ifm mismatch"); @@ -392,7 +392,7 @@ convolution_inst::typed_primitive_inst(network& network, convolution_node const& if (!argument.grouped_weights_shape && !format::is_grouped(filter_inst.format)) { CLDNN_ERROR_NOT_EQUAL(node.id(), "Weights feature maps number", - input_inst.size.feature[0], + input_layout.size.feature[0], "input feature maps number", weights_ifm, "Weights/ifm mismatch"); diff --git a/src/plugins/intel_gpu/src/graph/deconvolution.cpp b/src/plugins/intel_gpu/src/graph/deconvolution.cpp index 6e2d0cacf59..03569b22705 100644 --- a/src/plugins/intel_gpu/src/graph/deconvolution.cpp +++ b/src/plugins/intel_gpu/src/graph/deconvolution.cpp @@ -5,11 +5,13 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include "deconvolution_inst.h" #include "primitive_type_base.h" -#include "sliding_window_utils.h" +#include "sliding_window_utils.hpp" #include "intel_gpu/runtime/error_handler.hpp" #include "json_object.h" #include +using namespace ov::runtime::intel_gpu; + namespace cldnn { primitive_type_id deconvolution::type_id() { static primitive_type_base instance; @@ -80,7 +82,7 @@ layout deconvolution_inst::calc_output_layout(deconvolution_node const& node) { auto filter_size = weights_layout.size; int32_t off_factor = -2; - size_t spatial_dims = cldnn::format::traits(input_layout.format).spatial_num; + size_t spatial_dims = input_layout.get_spatial_rank(); CLDNN_ERROR_GREATER_THAN(node.id(), "number of spatial dimensions", spatial_dims, @@ -88,14 +90,14 @@ layout deconvolution_inst::calc_output_layout(deconvolution_node const& node) { 3, "As for now, deconvolutions with more than 3 dimensions are not supported"); - int32_t x = off_factor * pad.spatial[0] + (input_layout.size.spatial[0] - 1) * strd.spatial[0] + filter_size.spatial[0]; + int32_t x = off_factor * pad[pad.size() - 1] + (input_layout.spatial(0) - 1) * strd[strd.size() - 1] + weights_layout.spatial(0); int32_t y = 1; if (spatial_dims > 1) { - y = off_factor * pad.spatial[1] + (input_layout.size.spatial[1] - 1) * strd.spatial[1] + filter_size.spatial[1]; + y = off_factor * pad[pad.size() - 2] + (input_layout.spatial(1) - 1) * strd[strd.size() - 2] + weights_layout.spatial(1); } int32_t z = 1; if (spatial_dims > 2) { - z = off_factor * pad.spatial[2] + (input_layout.size.spatial[2] - 1) * strd.spatial[2] + filter_size.spatial[2]; + z = off_factor * pad[pad.size() - 3] + (input_layout.spatial(2) - 1) * strd[strd.size() - 3] + weights_layout.spatial(2); } tensor output_size(input_layout.size.batch[0], @@ -131,8 +133,8 @@ std::string deconvolution_inst::to_string(deconvolution_node const& node) { json_composite deconv_info; deconv_info.add("weights count", desc->weights.size()); deconv_info.add("bias count", desc->bias.size()); - deconv_info.add("stride", strd.to_string()); - deconv_info.add("pad", desc->pad.to_string()); + deconv_info.add("stride", cldnn::to_string(strd)); + deconv_info.add("pad", cldnn::to_string(desc->pad)); deconv_info.add("split", split); deconv_info.add("groups", desc->groups); if (desc->with_output_size) { @@ -148,24 +150,32 @@ std::string deconvolution_inst::to_string(deconvolution_node const& node) { deconvolution_inst::typed_primitive_inst(network& network, deconvolution_node const& node) : parent(network, node) { auto stride = argument.stride; + auto pad = argument.pad; - auto input_inst = node.input().get_output_layout(); - auto output_inst = node.get_output_layout(); - auto output_size = output_inst.size; + auto input_layout = node.input().get_output_layout(); + auto output_layout = node.get_output_layout(); + auto output_size = output_layout.size; CLDNN_ERROR_NOT_EQUAL(node.id(), "Input size", - input_inst.size.raw.size(), + input_layout.size.raw.size(), "output size", - output_inst.size.raw.size(), + output_layout.size.raw.size(), "Input/output number of dimension does not match."); CLDNN_ERROR_NOT_EQUAL(node.id(), "Stride size", - stride.raw.size(), + stride.size(), "output size", - output_inst.size.raw.size(), + output_layout.get_spatial_rank(), "Stride/output number of dimension does not match."); + CLDNN_ERROR_NOT_EQUAL(node.id(), + "Input offset size", + pad.size(), + "input number of dimensions", + output_layout.get_spatial_rank(), + ""); + auto split = node.get_split(); for (decltype(split) j = 0; j < split; j++) { auto filter_inst = node.weights(j).get_output_layout(); // deconvolution filter @@ -215,12 +225,6 @@ deconvolution_inst::typed_primitive_inst(network& network, deconvolution_node co "padding mode", 0.0f, "Unknown padding mode in deconvolution."); - CLDNN_ERROR_NOT_EQUAL(node.id(), - "Input offset size", - pad.raw.size(), - "input number of dimensions", - input_inst.size.raw.size(), - ""); CLDNN_ERROR_NOT_EQUAL(node.id(), "Output feature size", output_size.feature.size(), @@ -241,7 +245,7 @@ deconvolution_inst::typed_primitive_inst(network& network, deconvolution_node co "Only one-dimensional features are supported"); CLDNN_ERROR_LESS_THAN(node.id(), "Weights feature maps number", - input_inst.size.feature[0], + input_layout.size.feature[0], "input feature maps number", weights_ifm, "Weights/ifm mismatch"); @@ -249,7 +253,7 @@ deconvolution_inst::typed_primitive_inst(network& network, deconvolution_node co if (!argument.grouped_weights_shape && !format::is_grouped(filter_inst.format)) { CLDNN_ERROR_NOT_EQUAL(node.id(), "Weights feature maps number", - input_inst.size.feature[0], + input_layout.size.feature[0], "input feature maps number", weights_ifm, "Weights/ifm mismatch"); diff --git a/src/plugins/intel_gpu/src/graph/deformable_convolution.cpp b/src/plugins/intel_gpu/src/graph/deformable_convolution.cpp index 0f3b15a1439..330e93f70b2 100644 --- a/src/plugins/intel_gpu/src/graph/deformable_convolution.cpp +++ b/src/plugins/intel_gpu/src/graph/deformable_convolution.cpp @@ -5,7 +5,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include "deformable_convolution_inst.h" #include "primitive_type_base.h" -#include "sliding_window_utils.h" #include "intel_gpu/runtime/error_handler.hpp" #include "json_object.h" #include @@ -90,10 +89,10 @@ std::string deformable_interp_inst::to_string(deformable_interp_node const& node std::stringstream primitive_description; json_composite interp_info; - interp_info.add("stride", strd.to_string()); - interp_info.add("pad", desc->pad.to_string()); + interp_info.add("stride", cldnn::to_string(strd)); + interp_info.add("pad", cldnn::to_string(desc->pad)); interp_info.add("split", split); - interp_info.add("dilation", dilation.to_string()); + interp_info.add("dilation", cldnn::to_string(dilation)); interp_info.add("deformable_groups", desc->deformable_groups); interp_info.add("groups", desc->groups); interp_info.add("bilinear_interpolation_pad", desc->bilinear_interpolation_pad); diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/eltwise_remove_stride.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/eltwise_remove_stride.cpp index 66040147944..efeba5f0516 100644 --- a/src/plugins/intel_gpu/src/graph/graph_optimizer/eltwise_remove_stride.cpp +++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/eltwise_remove_stride.cpp @@ -37,12 +37,12 @@ void eltwise_remove_stride::conv_stride_extend(program& p, program_node& node, c c->with_output_size = false; node.recalc_output_layout(true); } else { - bool can_shrink_x = (filter_size.spatial[0] - (conv->stride.spatial[0] + (tensor.spatial[0] - 1))) >= 0; - bool can_shrink_y = (filter_size.spatial[1] - (conv->stride.spatial[1] + (tensor.spatial[1] - 1))) >= 0; + bool can_shrink_x = (filter_size.spatial[0] - (conv->stride[1] + (tensor.spatial[0] - 1))) >= 0; + bool can_shrink_y = (filter_size.spatial[1] - (conv->stride[0] + (tensor.spatial[1] - 1))) >= 0; if (can_shrink_x && can_shrink_y) { auto c = const_cast(&(*conv)); - c->stride.spatial[0] += tensor.spatial[0] - 1; - c->stride.spatial[1] += tensor.spatial[1] - 1; + c->stride[1] += tensor.spatial[0] - 1; + c->stride[0] += tensor.spatial[1] - 1; c->with_output_size = false; node.recalc_output_layout(true); tensor.spatial[0] = 1; @@ -64,6 +64,9 @@ void eltwise_remove_stride::run(program& p) { } } + if (node->get_output_layout().get_spatial_rank() != 2) + continue; + const auto eltw = std::static_pointer_cast(node->get_primitive()); if (!eltw->stride.empty()) { auto deps = node->get_dependencies(); diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/eltwise_shrinking.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/eltwise_shrinking.cpp index 2a6c9dd7fe9..e46f555a3a9 100644 --- a/src/plugins/intel_gpu/src/graph/graph_optimizer/eltwise_shrinking.cpp +++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/eltwise_shrinking.cpp @@ -58,20 +58,20 @@ void eltwise_shrinking::run(program& p) { auto weights_node_ptr = p.get_node_ptr(conv->weights[0]); auto filter_size = weights_node_ptr->get_output_layout().size; // make sure this is conv 1x1 - if (filter_size.spatial[0] != 1 || filter_size.spatial[1] != 1) { + if (filter_size.spatial[0] != 1 || filter_size.spatial[1] != 1 || conv->stride.size() != 2) { can_shrink = false; break; } // make sure convolution can accept shrinked input by modifying stride - if (conv->stride.spatial[0] > 1 || conv->stride.spatial[1] > 1) { + if (conv->stride[0] > 1 || conv->stride[1] > 1) { if (stride_x == 0) - stride_x = conv->stride.spatial[0]; + stride_x = conv->stride[1]; if (stride_y == 0) - stride_y = conv->stride.spatial[1]; + stride_y = conv->stride[0]; // make sure stride across all eltwise's convolution users is the same - if (conv->stride.spatial[0] != stride_x || conv->stride.spatial[1] != stride_y) { + if (conv->stride[1] != stride_x || conv->stride[0] != stride_y) { can_shrink = false; break; } @@ -105,8 +105,8 @@ void eltwise_shrinking::run(program& p) { const auto conv = std::static_pointer_cast(convs_to_shrink[i]->get_primitive()); auto c = const_cast(&(*conv)); - c->stride.spatial[0] = 1; - c->stride.spatial[1] = 1; + c->stride[0] = 1; + c->stride[1] = 1; // TODO: remove forcing "false" with_output_size if not needed c->with_output_size = false; convs_to_shrink[i]->recalc_output_layout(); diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/handle_input_padding.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/handle_input_padding.cpp index d380d7dbdc5..71cc0b9bf69 100644 --- a/src/plugins/intel_gpu/src/graph/graph_optimizer/handle_input_padding.cpp +++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/handle_input_padding.cpp @@ -25,72 +25,80 @@ void handle_input_padding::run(program& p) { convolution_node& convolution_node = node->as(); auto convolution_prim = const_cast(&(*convolution_node.get_primitive())); - if (convolution_prim->padding_above.spatial[0] != 0 || convolution_prim->padding_above.spatial[1] != 0 || - convolution_prim->padding_below.spatial[0] != 0 || convolution_prim->padding_below.spatial[1] != 0) { - // Asymmetric padding - if (convolution_prim->padding_above.spatial[0] != convolution_prim->padding_below.spatial[0] || - convolution_prim->padding_above.spatial[1] != convolution_prim->padding_below.spatial[1]) { - const primitive_id& convolution_node_id = convolution_node.id(); - tensor padding_above = convolution_prim->padding_above; - tensor padding_below = convolution_prim->padding_below; + auto pad_above = convolution_prim->padding_above; + auto pad_below = convolution_prim->padding_below; - CLDNN_ERROR_NOT_EQUAL(convolution_node_id, - "Padding above feature", - padding_above.feature[0], - "", - 0, - "Padding above in feature is not supported"); - CLDNN_ERROR_NOT_EQUAL(convolution_node_id, - "Padding above batch", - padding_above.batch[0], - "", - 0, - "Padding above in batch is not supported"); - CLDNN_ERROR_NOT_EQUAL(convolution_node_id, - "Padding below feature", - padding_below.feature[0], - "", - 0, - "Padding below in feature is not supported"); - CLDNN_ERROR_NOT_EQUAL(convolution_node_id, - "Padding below batch", - padding_below.batch[0], - "", - 0, - "Padding below in batch is not supported"); + auto pa_x = pad_above.size() >= 1 ? pad_above[pad_above.size() - 1] : 0; + auto pa_y = pad_above.size() >= 2 ? pad_above[pad_above.size() - 2] : 0; + auto pa_z = pad_above.size() >= 3 ? pad_above[pad_above.size() - 3] : 0; + + auto pb_x = pad_below.size() >= 1 ? pad_below[pad_below.size() - 1] : 0; + auto pb_y = pad_below.size() >= 2 ? pad_below[pad_below.size() - 2] : 0; + auto pb_z = pad_below.size() >= 3 ? pad_below[pad_below.size() - 3] : 0; + + auto spatial_rank = convolution_prim->stride.size(); + + if (pa_x != 0 || pa_y != 0 || pa_z != 0 || pb_x != 0 || pb_y != 0 || pb_z != 0) { + // Asymmetric padding + if (pa_x != pb_x || pa_y != pb_y || pa_z != pb_z) { + const primitive_id& convolution_node_id = convolution_node.id(); CLDNN_ERROR_LESS_THAN(convolution_node_id, "Padding above X", - padding_above.spatial[0], + pa_x, "", 0, "Padding above in X cannot be negative"); CLDNN_ERROR_LESS_THAN(convolution_node_id, "Padding above Y", - padding_above.spatial[1], + pa_y, "", 0, "Padding above in Y cannot be negative"); + CLDNN_ERROR_LESS_THAN(convolution_node_id, + "Padding above Z", + pa_z, + "", + 0, + "Padding above in Z cannot be negative"); CLDNN_ERROR_LESS_THAN(convolution_node_id, "Padding below X", - padding_below.spatial[0], + pb_x, "", 0, "Padding below in X cannot be negative"); CLDNN_ERROR_LESS_THAN(convolution_node_id, "Padding below Y", - padding_below.spatial[1], + pb_y, "", 0, "Padding below in Y cannot be negative"); + CLDNN_ERROR_LESS_THAN(convolution_node_id, + "Padding below Z", + pb_z, + "", + 0, + "Padding below in Z cannot be negative"); // set padding_above/padding_below to zeros - border primitive do the job - convolution_prim->padding_above = tensor(0, 0, 0, 0); - convolution_prim->padding_below = tensor(0, 0, 0, 0); + convolution_prim->padding_above = ov::CoordinateDiff(spatial_rank, 0); + convolution_prim->padding_below = ov::CoordinateDiff(spatial_rank, 0); // create border primitive primitive_id input_id = convolution_prim->input[0]; primitive_id border_id = input_id + "_border_" + convolution_prim->id; + + tensor padding_above = tensor(0); + tensor padding_below = tensor(0); + + padding_above.spatial[0] = pa_x; + padding_above.spatial[1] = pa_y; + padding_above.spatial[2] = pa_z; + + padding_below.spatial[0] = pb_x; + padding_below.spatial[1] = pb_y; + padding_below.spatial[2] = pb_z; + auto b_prim = std::make_shared(border_id, input_id, padding_above, @@ -103,11 +111,18 @@ void handle_input_padding::run(program& p) { p.add_intermediate(b_prim_node, convolution_node, 0, true); } else { // Symmetric padding // set pad - convolution_prim->pad = convolution_prim->padding_above.add(convolution_prim->pad); + auto spatial_rank = convolution_node.get_output_layout().get_spatial_rank(); + ov::CoordinateDiff prim_pad = ov::CoordinateDiff(spatial_rank, 0); + + for (size_t i = 0; i < convolution_prim->padding_above.size(); i++) { + prim_pad[i] += convolution_prim->padding_above[i] + convolution_prim->pad[i]; + } + + convolution_prim->pad = prim_pad; // set padding_above/padding_below to zeros - pad do the job - convolution_prim->padding_above = tensor(0); - convolution_prim->padding_below = tensor(0); + convolution_prim->padding_above = ov::CoordinateDiff(spatial_rank, 0); + convolution_prim->padding_below = ov::CoordinateDiff(spatial_rank, 0); convolution_node.recalc_output_layout(true); } diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/pre_replace_deconv.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/pre_replace_deconv.cpp index 5cadcb4b766..915eb96f60a 100644 --- a/src/plugins/intel_gpu/src/graph/graph_optimizer/pre_replace_deconv.cpp +++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/pre_replace_deconv.cpp @@ -35,7 +35,8 @@ void pre_replace_deconv::run(program& p) { auto& deconv_node = node->as(); auto& weights_node = deconv_node.weights(); auto deconv_prim = deconv_node.typed_desc(); - tensor filter_size = weights_node.get_output_layout().size; + auto filter_size = weights_node.get_output_layout().size; + auto filter_layout = weights_node.get_output_layout().convert_to_weights_layout(deconv_prim->grouped_weights_shape); auto weights_nodes_id = deconv_prim->weights; auto biases_nodes_id = deconv_prim->bias; auto& input_node = deconv_node.get_dependency(0); @@ -44,10 +45,7 @@ void pre_replace_deconv::run(program& p) { // limit optimization to stride = 1 // iterators shouldn't be used here because of incorrect iterator functionality in mutable_array_ref<> - bool unit_stride = true; - for (size_t i = 0; i < deconv_prim->stride.spatial.size(); ++i) { - unit_stride &= (deconv_prim->stride.spatial[i] == 1); - } + bool unit_stride = all_ones(deconv_prim->stride); if (unit_stride) { auto groups = deconv_node.get_groups(); @@ -65,8 +63,10 @@ void pre_replace_deconv::run(program& p) { // setting convolution parameters based on deconvolution params + auto spatial_rank = deconv_node.get_output_layout().get_spatial_rank(); auto stride = deconv_prim->stride; auto pad = deconv_prim->pad; + ov::Strides dilation(spatial_rank, 1); auto output_padding = deconv_prim->output_padding; auto grouped_weights_shape = deconv_prim->grouped_weights_shape; @@ -84,10 +84,9 @@ void pre_replace_deconv::run(program& p) { p.remove_connection(*weights_node_ptr, deconv_node); } - auto filter_z = deconv_prim->grouped_weights_shape ? 0 : (filter_size.spatial[2] - 1); - pad.spatial[0] = (filter_size.spatial[0] - 1) - std::abs(pad.spatial[0]); - pad.spatial[1] = (filter_size.spatial[1] - 1) - std::abs(pad.spatial[1]); - pad.spatial[2] = filter_z - std::abs(pad.spatial[2]); + for (size_t i = 0; i < spatial_rank; i++) { + pad[i] = (filter_layout.spatial(spatial_rank - i - 1) - 1) - std::abs(pad[i]); + } std::vector> bias_connections; for (auto& bias_id : biases_nodes_id) { @@ -118,7 +117,7 @@ void pre_replace_deconv::run(program& p) { groups, stride, pad, - tensor{ 1, 1, 1, 1 }, + dilation, grouped_weights_shape, "", output_padding); @@ -129,7 +128,7 @@ void pre_replace_deconv::run(program& p) { groups, stride, pad, - tensor{ 1, 1, 1, 1 }, + dilation, grouped_weights_shape, "", output_padding); @@ -170,12 +169,13 @@ void pre_replace_deconv::run(program& p) { // current optimization only available for specific deconvolution parameters } else if (deconv_node.is_output() == false && deconv_node.get_output_layout().size.feature[0] == 1 && - deconv_prim->stride.spatial[0] == 2 && deconv_prim->stride.spatial[1] == 2 && + deconv_prim->stride[deconv_prim->stride.size() - 1] == 2 && deconv_prim->stride[deconv_prim->stride.size() - 2] == 2 && filter_size.spatial[0] == 9 && filter_size.spatial[1] == 9 && - deconv_prim->pad.spatial[0] == 4 && deconv_prim->pad.spatial[1] == 4 && + deconv_prim->pad[deconv_prim->pad.size() - 1] == 4 && deconv_prim->pad[deconv_prim->pad.size() - 2] == 4 && weights_nodes_id.size() == 1 && biases_nodes_id.size() == 1 && input_node.get_output_layout().format == format::bfyx) { - const auto scale_factor = deconv_prim->stride.spatial[0]; + const auto scale_factor = deconv_prim->stride[deconv_prim->stride.size() - 1]; + auto spatial_rank = deconv_node.get_output_layout().get_spatial_rank(); const auto& weight_node_id = weights_nodes_id.front(); auto weights_node_ptr = p.nodes_map.find(weight_node_id)->second; @@ -194,8 +194,9 @@ void pre_replace_deconv::run(program& p) { continue; // setting convolution parameters based on deconvolution params - tensor stride = { 1, 1, 1, 1 }; - tensor pad = tensor{{ 0, 0, scale_factor, scale_factor }, 0}; + ov::Strides stride(spatial_rank, 1); + ov::CoordinateDiff pad(spatial_rank, scale_factor); + ov::Strides dilation(spatial_rank, 1); auto output_padding = deconv_prim->output_padding; auto grouped_weights_shape = deconv_prim->grouped_weights_shape; @@ -264,7 +265,7 @@ void pre_replace_deconv::run(program& p) { std::vector{ weight_replace_node_id }, stride, pad, - tensor{ 1, 1, 1, 1 }, + dilation, grouped_weights_shape, "", output_padding); diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_padding.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_padding.cpp index 815397b1b4d..ace966ed976 100644 --- a/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_padding.cpp +++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_padding.cpp @@ -8,10 +8,11 @@ #include "program_node.h" #include "pass_manager.h" #include "convolution_inst.h" -#include "sliding_window_utils.h" +#include "sliding_window_utils.hpp" #include using namespace cldnn; +using namespace ov::runtime::intel_gpu; void prepare_padding::run(program& p) { if (output_size_handling_enabled) { @@ -28,7 +29,7 @@ void prepare_padding::run(program& p) { continue; auto add_required_padding = [&p](program_node& node, padding& needed_padding) { - // Add extra reorder if a previous node or one of its user nodes is an onednn kernel not to add padding to the onednn kernel + // Add extra reorder for cldnn primitive to handle required padding if needed auto& input = node.get_dependency(0); bool is_usr_onednn = false; for (auto& input_usr : input.get_users()) @@ -87,7 +88,7 @@ void prepare_padding::run(program& p) { filter_size, prim->pad, prim->stride, - {1, 1, 1, 1}, + ov::Strides(prim->stride.size(), 1), true, 1); @@ -101,13 +102,18 @@ void prepare_padding::run(program& p) { padding needed_padding; // WA for this format. sliding window needs to be fixed --perf degradation for IncepctionV1 type models + tensor size(1); + for (size_t i = 0; i < prim->size.size(); i++) { + size.spatial[i] = prim->size[prim->size.size() - i - 1]; + } + if (node->get_output_layout().format == format::b_fs_yx_fsv16) needed_padding = calc_sliding_window_needed_input_padding(prim_node.input().get_output_layout(), prim->output_size, - prim->size, - prim->pad, + size, + ov::CoordinateDiff(prim->pad.begin(), prim->pad.end()), prim->stride, - {1, 1, 1, 1}, + ov::Strides(prim->size.size(), 1), false, 1); else @@ -172,32 +178,43 @@ void prepare_padding::run(program& p) { auto& filter_node = node.as().weights(0); auto filter_prim = filter_node.get_primitive(); - layout filter_layout = filter_node.get_output_layout(); + layout filter_layout = filter_node.get_output_layout().convert_to_weights_layout(conv->grouped_weights_shape); // Compute initial required paddings for primitive used as input for convolution. auto pad = conv->pad; auto stride = conv->stride; auto dilation = conv->dilation; + uint32_t stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; + uint32_t stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + uint32_t stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; - auto input_limit_x = -pad.spatial[0] + (conv_layout.size.spatial[0] - 1) * stride.spatial[0] + - (filter_layout.size.spatial[0] - 1) * dilation.spatial[0] + 1; - auto input_limit_y = -pad.spatial[1] + (conv_layout.size.spatial[1] - 1) * stride.spatial[1] + - (filter_layout.size.spatial[1] - 1) * dilation.spatial[1] + 1; - auto input_limit_z = -pad.spatial[2] + (conv_layout.size.spatial[2] - 1) * stride.spatial[2] + - (filter_layout.size.spatial[2] - 1) * dilation.spatial[2] + 1; + uint32_t dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1; + uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1; + uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1; - auto padding_begin_x = std::max(pad.spatial[0], 0); - auto padding_begin_y = std::max(pad.spatial[1], 0); - auto padding_begin_z = std::max(pad.spatial[2], 0); - auto padding_end_x = std::max(input_limit_x - prev_prim_output_layout.size.spatial[0], 0); - auto padding_end_y = std::max(input_limit_y - prev_prim_output_layout.size.spatial[1], 0); - auto padding_end_z = std::max(input_limit_z - prev_prim_output_layout.size.spatial[2], 0); + tensor::value_type pad_z = pad.size() >= 3 ? pad[pad.size() - 3] : 0; + tensor::value_type pad_y = pad.size() >= 2 ? pad[pad.size() - 2] : 0; + tensor::value_type pad_x = pad.size() >= 1 ? pad[pad.size() - 1] : 0; + + auto input_limit_x = -pad_x + (conv_layout.spatial(0) - 1) * stride_x + + (filter_layout.spatial(0) - 1) * dilation_x + 1; + auto input_limit_y = -pad_y + (conv_layout.spatial(1) - 1) * stride_y + + (filter_layout.spatial(1) - 1) * dilation_y + 1; + auto input_limit_z = -pad_z + (conv_layout.spatial(2) - 1) * stride_z + + (filter_layout.spatial(2) - 1) * dilation_z + 1; + + auto padding_begin_x = std::max(pad_x, 0); + auto padding_begin_y = std::max(pad_y, 0); + auto padding_begin_z = std::max(pad_z, 0); + auto padding_end_x = std::max(input_limit_x - prev_prim_output_layout.spatial(0), 0); + auto padding_end_y = std::max(input_limit_y - prev_prim_output_layout.spatial(1), 0); + auto padding_end_z = std::max(input_limit_z - prev_prim_output_layout.spatial(2), 0); // Adjust right padding, so entire buffer size in X dimension is properly aligned. // TODO: NOTE: Will be reenabled with next check-in once heuristic for line-aligned algorithm will be added. // auto needed_buffer_size_x = static_cast( - // round_up_to(left_padding + prev_prim_output_layout.size.spatial[0] + right_padding, 16)); - // right_padding = needed_buffer_size_x - left_padding - prev_prim_output_layout.size.spatial[0]; + // round_up_to(left_padding + prev_prim_output_layout.spatial(0) + right_padding, 16)); + // right_padding = needed_buffer_size_x - left_padding - prev_prim_output_layout.spatial(0); cldnn::padding needed_padding({0, 0, padding_begin_x, padding_begin_y, padding_begin_z}, {0, 0, padding_end_x, padding_end_y, padding_end_z}, 0); needed_padding = padding::max(prev_prim_output_layout.data_padding, needed_padding); @@ -238,19 +255,31 @@ void prepare_padding::run(program& p) { auto stride = conv->stride; auto dilation = conv->dilation; - auto input_limit_x = -pad.spatial[0] + (conv_layout.size.spatial[0] - 1) * stride.spatial[0] + - (filter_layout.size.spatial[0] - 1) * dilation.spatial[0] + 1; - auto input_limit_y = -pad.spatial[1] + (conv_layout.size.spatial[1] - 1) * stride.spatial[1] + - (filter_layout.size.spatial[1] - 1) * dilation.spatial[1] + 1; - auto input_limit_z = -pad.spatial[2] + (conv_layout.size.spatial[2] - 1) * stride.spatial[2] + - (filter_layout.size.spatial[2] - 1) * dilation.spatial[2] + 1; + auto stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; + auto stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + auto stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; - auto padding_begin_x = std::max(pad.spatial[0], 0); - auto padding_begin_y = std::max(pad.spatial[1], 0); - auto padding_begin_z = std::max(pad.spatial[2], 0); - auto padding_end_x = std::max(input_limit_x - prev_prim_output_layout.size.spatial[0], 0); - auto padding_end_y = std::max(input_limit_y - prev_prim_output_layout.size.spatial[1], 0); - auto padding_end_z = std::max(input_limit_z - prev_prim_output_layout.size.spatial[2], 0); + auto dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1; + auto dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1; + auto dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1; + + auto pad_z = pad.size() >= 3 ? pad[pad.size() - 3] : 0; + auto pad_y = pad.size() >= 2 ? pad[pad.size() - 2] : 0; + auto pad_x = pad.size() >= 1 ? pad[pad.size() - 1] : 0; + + auto input_limit_x = -pad_x + (conv_layout.spatial(0) - 1) * stride_x + + (filter_layout.spatial(0) - 1) * dilation_x + 1; + auto input_limit_y = -pad_y + (conv_layout.spatial(1) - 1) * stride_y + + (filter_layout.spatial(1) - 1) * dilation_y + 1; + auto input_limit_z = -pad_z + (conv_layout.spatial(2) - 1) * stride_z + + (filter_layout.spatial(2) - 1) * dilation_z + 1; + + auto padding_begin_x = std::max(pad_x, 0); + auto padding_begin_y = std::max(pad_y, 0); + auto padding_begin_z = std::max(pad_z, 0); + auto padding_end_x = std::max(input_limit_x - prev_prim_output_layout.spatial(0), 0); + auto padding_end_y = std::max(input_limit_y - prev_prim_output_layout.spatial(1), 0); + auto padding_end_z = std::max(input_limit_z - prev_prim_output_layout.spatial(2), 0); cldnn::padding needed_padding({0, 0, padding_begin_x, padding_begin_y, padding_begin_z}, {0, 0, padding_end_x, padding_end_y, padding_end_z}, 0); needed_padding = padding::max(prev_prim_output_layout.data_padding, needed_padding); diff --git a/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_primitive_fusing.cpp b/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_primitive_fusing.cpp index e2b3b6044ec..0bd7ac0e776 100644 --- a/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_primitive_fusing.cpp +++ b/src/plugins/intel_gpu/src/graph/graph_optimizer/prepare_primitive_fusing.cpp @@ -547,7 +547,7 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) { if (eltw_node.get_dependency(1).is_constant() && per_channel_eltwise && (eltw_prim.mode == eltwise_mode::sum || eltw_prim.mode == eltwise_mode::prod) && - (conv_node.get_primitive()->dilation == tensor{1})) + all_ones(conv_node.get_primitive()->dilation)) return true; return false; @@ -761,7 +761,7 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) { return; bool should_fuse = input_data.is_type() && - input_data.as().get_primitive()->dilation == tensor{1}; + all_ones(input_data.as().get_primitive()->dilation); should_fuse |= input_data.is_type() && conv_supports_fusings(input_data.as()); @@ -839,8 +839,7 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) { in_layout.size.feature[0] == input_hi.get_output_layout().size.feature[0]) || (input_lo.get_output_layout().size.feature[0] == 1 && input_hi.get_output_layout().size.feature[0] == 1)))) && - input_data.as().get_primitive()->dilation.spatial[0] == 1 && - input_data.as().get_primitive()->dilation.spatial[1] == 1; + all_ones(input_data.as().get_primitive()->dilation); auto expected_format = _lo.get_preferred_format(input_data); diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/binary_convolution.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/binary_convolution.cpp index bf92847f178..b98f001c9ae 100644 --- a/src/plugins/intel_gpu/src/graph/impls/ocl/binary_convolution.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/binary_convolution.cpp @@ -93,14 +93,20 @@ public: (uint32_t)weights_size.spatial[2], }; - conv_params.padding = {(uint32_t)std::max(pad.spatial[0], 0), - (uint32_t)std::max(pad.spatial[1], 0), - (uint32_t)std::max(pad.spatial[2], 0)}; + uint32_t pad_z = std::max(pad.size() >= 3 ? pad[pad.size() - 3] : 0, 0); + uint32_t pad_y = std::max(pad.size() >= 2 ? pad[pad.size() - 2] : 0, 0); + uint32_t pad_x = std::max(pad.size() >= 1 ? pad[pad.size() - 1] : 0, 0); + conv_params.padding = {pad_x, pad_y, pad_z}; - conv_params.stride = {(uint32_t)stride.spatial[0], (uint32_t)stride.spatial[1], (uint32_t)stride.spatial[2]}; - conv_params.dilation = {(uint32_t)dilation.spatial[0], - (uint32_t)dilation.spatial[1], - (uint32_t)dilation.spatial[2]}; + uint32_t stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; + uint32_t stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + uint32_t stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; + conv_params.stride = {stride_x, stride_y, stride_z}; + + uint32_t dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1; + uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1; + uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1; + conv_params.dilation = {dilation_x, dilation_y, dilation_z}; auto& kernel_selector = kernel_selector::binary_convolution_kernel_selector::Instance(); diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/convolution.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/convolution.cpp index 30fb126679e..8a5a6399cc6 100644 --- a/src/plugins/intel_gpu/src/graph/impls/ocl/convolution.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/convolution.cpp @@ -100,14 +100,20 @@ public: uint32_t kz = spatial_size == 2 ? 1 : weights_size.spatial[2]; conv_params.filterSize = { kx, ky, kz }; - conv_params.padding = {(uint32_t)std::max(pad.spatial[0], 0), - (uint32_t)std::max(pad.spatial[1], 0), - (uint32_t)std::max(pad.spatial[2], 0)}; + uint32_t pad_z = std::max(pad.size() >= 3 ? pad[pad.size() - 3] : 0, 0); + uint32_t pad_y = std::max(pad.size() >= 2 ? pad[pad.size() - 2] : 0, 0); + uint32_t pad_x = std::max(pad.size() >= 1 ? pad[pad.size() - 1] : 0, 0); + conv_params.padding = {pad_x, pad_y, pad_z}; - conv_params.stride = {(uint32_t)stride.spatial[0], (uint32_t)stride.spatial[1], (uint32_t)stride.spatial[2]}; - conv_params.dilation = {(uint32_t)dilation.spatial[0], - (uint32_t)dilation.spatial[1], - (uint32_t)dilation.spatial[2]}; + uint32_t stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; + uint32_t stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + uint32_t stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; + conv_params.stride = {stride_x, stride_y, stride_z}; + + uint32_t dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1; + uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1; + uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1; + conv_params.dilation = {dilation_x, dilation_y, dilation_z}; if ((arg.get_dependency(0).get_output_layout().data_type == data_types::u8 || arg.get_dependency(0).get_output_layout().data_type == data_types::i8) && diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/deconvolution.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/deconvolution.cpp index eed5d8af99b..12187e8db78 100644 --- a/src/plugins/intel_gpu/src/graph/impls/ocl/deconvolution.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/deconvolution.cpp @@ -62,7 +62,7 @@ public: #if 0 // TODO: support dilation const auto& dilation = primitive->dilation; #else - const tensor dilation = {0, 0, 1, 1, 1}; + const ov::Strides dilation(arg.get_output_layout().get_spatial_rank(), 1); #endif const auto actual_split = split; @@ -86,15 +86,20 @@ public: uint32_t kz = spatial_size == 2 ? 1 : weights_size.spatial[2]; deconv_params.filterSize = { kx, ky, kz }; - deconv_params.padding = {(uint32_t)std::max(pad.spatial[0], 0), - (uint32_t)std::max(pad.spatial[1], 0), - (uint32_t)std::max(pad.spatial[2], 0)}; + uint32_t pad_z = std::max(pad.size() >= 3 ? pad[pad.size() - 3] : 0, 0); + uint32_t pad_y = std::max(pad.size() >= 2 ? pad[pad.size() - 2] : 0, 0); + uint32_t pad_x = std::max(pad.size() >= 1 ? pad[pad.size() - 1] : 0, 0); + deconv_params.padding = {pad_x, pad_y, pad_z}; - deconv_params.stride = {(uint32_t)stride.spatial[0], (uint32_t)stride.spatial[1], (uint32_t)stride.spatial[2]}; + uint32_t stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; + uint32_t stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + uint32_t stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; + deconv_params.stride = {stride_x, stride_y, stride_z}; - deconv_params.dilation = {(uint32_t)dilation.spatial[0], - (uint32_t)dilation.spatial[1], - (uint32_t)dilation.spatial[2]}; + uint32_t dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1; + uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1; + uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1; + deconv_params.dilation = {dilation_x, dilation_y, dilation_z}; auto& kernel_selector = kernel_selector::deconvolution_kernel_selector::Instance(); auto best_kernels = kernel_selector.GetBestKernels(deconv_params, deconv_optional_params); diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/deformable_convolution.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/deformable_convolution.cpp index 2caae190b07..4873027d065 100644 --- a/src/plugins/intel_gpu/src/graph/impls/ocl/deformable_convolution.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/deformable_convolution.cpp @@ -118,20 +118,27 @@ public: conv_params.bilinear_interpolation_pad = primitive->bilinear_interpolation_pad; conv_params.deformable_groups = deformable_groups; - conv_params.padding = {(uint32_t)std::max(pad.spatial[0], 0), - (uint32_t)std::max(pad.spatial[1], 0), - (uint32_t)std::max(pad.spatial[2], 0)}; + uint32_t pad_z = std::max(pad.size() >= 3 ? pad[pad.size() - 3] : 0, 0); + uint32_t pad_y = std::max(pad.size() >= 2 ? pad[pad.size() - 2] : 0, 0); + uint32_t pad_x = std::max(pad.size() >= 1 ? pad[pad.size() - 1] : 0, 0); - conv_params.stride = {(uint32_t)stride.spatial[0], (uint32_t)stride.spatial[1], (uint32_t)stride.spatial[2]}; + conv_params.padding = {pad_x, pad_y, pad_z}; + + uint32_t stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; + uint32_t stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + uint32_t stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; + conv_params.stride = {stride_x, stride_y, stride_z}; + + uint32_t dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1; + uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1; + uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1; + + conv_params.dilation = {dilation_x, dilation_y, dilation_z}; conv_params.kernelSize = { (uint32_t)kernel_size.spatial[0], (uint32_t)kernel_size.spatial[1], (uint32_t)kernel_size.spatial[2] }; - conv_params.dilation = {(uint32_t)dilation.spatial[0], - (uint32_t)dilation.spatial[1], - (uint32_t)dilation.spatial[2]}; - auto& kernel_selector = kernel_selector::deformable_interp_kernel_selector::Instance(); kernel_selector::KernelsData best_kernels = kernel_selector.GetBestKernels(conv_params, conv_optional_params); diff --git a/src/plugins/intel_gpu/src/graph/impls/ocl/pooling.cpp b/src/plugins/intel_gpu/src/graph/impls/ocl/pooling.cpp index 3369a3ee45b..ac6e1275057 100644 --- a/src/plugins/intel_gpu/src/graph/impls/ocl/pooling.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/ocl/pooling.cpp @@ -16,20 +16,16 @@ namespace ocl { namespace { void validate_args(const pooling_node& arg) { - auto const input_buffer_size = arg.input().get_output_layout().get_buffer_size(); - auto const& input_dimensions = - input_buffer_size.batch.size() + input_buffer_size.feature.size() + input_buffer_size.spatial.size(); - auto const output_buffer_size = arg.get_output_layout().get_buffer_size(); - auto const& output_dimensions = - output_buffer_size.batch.size() + output_buffer_size.feature.size() + output_buffer_size.spatial.size(); - auto& stride = arg.get_primitive()->stride; - auto const& stride_dimensions = stride.batch.size() + stride.feature.size() + stride.spatial.size(); - auto& window = arg.get_primitive()->size; - auto const& window_dimensions = window.batch.size() + window.feature.size() + window.spatial.size(); + auto input_rank = arg.input().get_output_layout().get_spatial_rank(); + auto output_rank = arg.get_output_layout().get_spatial_rank(); + auto stride_rank = arg.get_primitive()->stride.size(); + auto window_rank = arg.get_primitive()->size.size(); - CLDNN_ERROR_NOT_EQUAL(arg.id(), "input dimensions", input_dimensions, "output dimensions", output_dimensions, ""); - CLDNN_ERROR_NOT_EQUAL(arg.id(), "stride dimensions", stride_dimensions, "output dimensions", output_dimensions, ""); - CLDNN_ERROR_NOT_EQUAL(arg.id(), "window dimensions", window_dimensions, "output dimensions", output_dimensions, ""); + if (!arg.get_primitive()->global_pooling) { + CLDNN_ERROR_NOT_EQUAL(arg.id(), "input dimensions", input_rank, "output dimensions", output_rank, ""); + CLDNN_ERROR_NOT_EQUAL(arg.id(), "stride dimensions", stride_rank, "output dimensions", output_rank, ""); + CLDNN_ERROR_NOT_EQUAL(arg.id(), "window dimensions", window_rank, "output dimensions", output_rank, ""); + } } kernel_selector::pool_type cldnn_2_pool_type(pooling_mode mode) { @@ -109,8 +105,11 @@ public: const auto& stride = primitive->stride; const auto& pad = primitive->pad; - const auto input_sizes = arg.input().get_output_layout().size; - const auto output_sizes = arg.get_output_layout().size; + const auto& dilation = primitive->dilation; + auto kernel = primitive->size; + const auto& input_layout = arg.input().get_output_layout(); + const auto& output_layout = arg.get_output_layout(); + auto spatial_rank = output_layout.get_spatial_rank(); auto& pp = pool_params; @@ -118,19 +117,19 @@ public: pp.remainderAction = kernel_selector::pool_remainder::CEIL; if (primitive->global_pooling) { - primitive->size.spatial[0] = input_sizes.spatial[0]; - primitive->size.spatial[1] = input_sizes.spatial[1]; - primitive->size.spatial[2] = input_sizes.spatial[2]; + kernel = ov::Shape(spatial_rank, 1); + for (size_t i = 0; i < spatial_rank; i++) { + kernel[i] = input_layout.spatial(spatial_rank - i - 1); + } } // check if last pooling window goes outside of input size + padding. If so the avg pooling size will be // adjusted to that, to work properly this calculation must take pad_end into account. - auto dynamic_mode = (((output_sizes.spatial[0] - 1) * stride.spatial[0]) + primitive->size.spatial[0]) > - (primitive->pad_end.spatial[0] + pad.spatial[0]) + input_sizes.spatial[0] || - (((output_sizes.spatial[1] - 1) * stride.spatial[1]) + primitive->size.spatial[1]) > - (primitive->pad_end.spatial[1] + pad.spatial[1]) + input_sizes.spatial[1] || - (((output_sizes.spatial[2] - 1) * stride.spatial[2]) + primitive->size.spatial[2]) > - (primitive->pad_end.spatial[2] + pad.spatial[2]) + input_sizes.spatial[2]; + auto dynamic_mode = false; + for (size_t i = 0; i < spatial_rank; i++) { + dynamic_mode |= (((output_layout.spatial(i) - 1) * stride[spatial_rank - i - 1]) + primitive->size[spatial_rank - i - 1]) > + (primitive->pad_end[spatial_rank - i - 1] + pad[spatial_rank - i - 1]) + input_layout.spatial(i); + } if (primitive->mode == pooling_mode::average && dynamic_mode) pp.divMode = kernel_selector::kernel_divider_mode::DYNAMIC_WITH_PADDING; @@ -140,20 +139,25 @@ public: if (primitive->mode == pooling_mode::max_with_argmax) pool_params.inputs.push_back(convert_data_tensor(arg.argmax().get_output_layout())); - pp.poolSize = { - (uint32_t)primitive->size.spatial[0], - (uint32_t)primitive->size.spatial[1], - (uint32_t)primitive->size.spatial[2], - }; + uint32_t kernel_z = kernel.size() >= 3 ? kernel[kernel.size() - 3] : 1; + uint32_t kernel_y = kernel.size() >= 2 ? kernel[kernel.size() - 2] : 1; + uint32_t kernel_x = kernel.size() >= 1 ? kernel[kernel.size() - 1] : 1; + pp.poolSize = {kernel_x, kernel_y, kernel_z}; - pp.poolPad = {(uint32_t)std::max(pad.spatial[0], 0), - (uint32_t)std::max(pad.spatial[1], 0), - (uint32_t)std::max(pad.spatial[2], 0)}; + uint32_t pad_z = std::max(pad.size() >= 3 ? pad[pad.size() - 3] : 0, 0); + uint32_t pad_y = std::max(pad.size() >= 2 ? pad[pad.size() - 2] : 0, 0); + uint32_t pad_x = std::max(pad.size() >= 1 ? pad[pad.size() - 1] : 0, 0); + pp.poolPad = {pad_x, pad_y, pad_z}; - pp.poolStride = {(uint32_t)stride.spatial[0], (uint32_t)stride.spatial[1], (uint32_t)stride.spatial[2]}; + uint32_t stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; + uint32_t stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + uint32_t stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; + pp.poolStride = {stride_x, stride_y, stride_z}; - const auto& dilation = primitive->dilation; - pp.poolDilation = {(uint32_t)dilation.spatial[0], (uint32_t)dilation.spatial[1], (uint32_t)dilation.spatial[2]}; + uint32_t dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1; + uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1; + uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1; + pp.poolDilation = {dilation_x, dilation_y, dilation_z}; auto& kernel_selector = kernel_selector::pooling_kernel_selector::Instance(); auto best_kernels = kernel_selector.GetBestKernels(pool_params, pool_optional_params); diff --git a/src/plugins/intel_gpu/src/graph/impls/onednn/convolution_onednn.cpp b/src/plugins/intel_gpu/src/graph/impls/onednn/convolution_onednn.cpp index 5f671fc1df7..234ba0fb0d0 100644 --- a/src/plugins/intel_gpu/src/graph/impls/onednn/convolution_onednn.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/onednn/convolution_onednn.cpp @@ -147,12 +147,11 @@ protected: auto& input = arg.get_dependency(0); auto& weights = arg.get_dependency(1); - auto spatials_rank = cldnn::format::spatial_num(input.get_output_layout().format); - auto stride = onednn::convert_spatials(prim->stride, spatials_rank); - auto dilation = onednn::convert_spatials(prim->dilation, spatials_rank); - auto pad_l = onednn::convert_spatials(prim->pad, spatials_rank); - auto pad_r = onednn::convert_spatials(prim->pad, spatials_rank); + dnnl::memory::dims stride(prim->stride.begin(), prim->stride.end()); + dnnl::memory::dims dilation(prim->dilation.begin(), prim->dilation.end()); + dnnl::memory::dims pad_l(prim->pad.begin(), prim->pad.end()); + dnnl::memory::dims pad_r(prim->pad.begin(), prim->pad.end()); auto input_md = onednn::layout_to_memory_desc(input.get_output_layout()); auto weights_md = onednn::layout_to_memory_desc(weights.get_output_layout(), dnnl::memory::format_tag::any); diff --git a/src/plugins/intel_gpu/src/graph/impls/onednn/deconvolution_onednn.cpp b/src/plugins/intel_gpu/src/graph/impls/onednn/deconvolution_onednn.cpp index ea60d9dbf4f..8d21d415447 100644 --- a/src/plugins/intel_gpu/src/graph/impls/onednn/deconvolution_onednn.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/onednn/deconvolution_onednn.cpp @@ -105,12 +105,11 @@ protected: auto& input = arg.get_dependency(0); auto& weights = arg.get_dependency(1); - auto spatials_rank = cldnn::format::spatial_num(input.get_output_layout().format); - auto stride = onednn::convert_spatials(prim->stride, spatials_rank); - auto dilation = onednn::convert_spatials(cldnn::tensor{1}, spatials_rank); - auto pad_l = onednn::convert_spatials(prim->pad, spatials_rank); - auto pad_r = onednn::convert_spatials(prim->pad, spatials_rank); + dnnl::memory::dims stride(prim->stride.begin(), prim->stride.end()); + dnnl::memory::dims dilation(input.get_output_layout().get_spatial_rank(), 1); + dnnl::memory::dims pad_l(prim->pad.begin(), prim->pad.end()); + dnnl::memory::dims pad_r(prim->pad.begin(), prim->pad.end()); auto input_md = onednn::layout_to_memory_desc(input.get_output_layout()); auto weights_md = onednn::layout_to_memory_desc(weights.get_output_layout(), dnnl::memory::format_tag::any); diff --git a/src/plugins/intel_gpu/src/graph/impls/onednn/pooling_onednn.cpp b/src/plugins/intel_gpu/src/graph/impls/onednn/pooling_onednn.cpp index 2b412e373c5..5826726cfc2 100644 --- a/src/plugins/intel_gpu/src/graph/impls/onednn/pooling_onednn.cpp +++ b/src/plugins/intel_gpu/src/graph/impls/onednn/pooling_onednn.cpp @@ -28,12 +28,11 @@ protected: auto prim = arg.get_primitive(); auto& input = arg.get_dependency(0); - auto spatials_rank = cldnn::format::spatial_num(input.get_output_layout().format); - auto stride = onednn::convert_spatials(prim->stride, spatials_rank); - auto kernel = onednn::convert_spatials(prim->size, spatials_rank); - auto pad_l = onednn::convert_spatials(prim->pad, spatials_rank); - auto pad_r = onednn::convert_spatials(prim->pad_end, spatials_rank); + dnnl::memory::dims stride(prim->stride.begin(), prim->stride.end()); + dnnl::memory::dims kernel(prim->size.begin(), prim->size.end()); + dnnl::memory::dims pad_l(prim->pad.begin(), prim->pad.end()); + dnnl::memory::dims pad_r(prim->pad_end.begin(), prim->pad_end.end()); auto input_md = onednn::layout_to_memory_desc(input.get_output_layout()); auto output_md = onednn::layout_to_memory_desc(arg.get_output_layout()); diff --git a/src/plugins/intel_gpu/src/graph/include/sliding_window_utils.hpp b/src/plugins/intel_gpu/src/graph/include/sliding_window_utils.hpp new file mode 100644 index 00000000000..b4fd03e4192 --- /dev/null +++ b/src/plugins/intel_gpu/src/graph/include/sliding_window_utils.hpp @@ -0,0 +1,447 @@ +// Copyright (C) 2018-2022 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "intel_gpu/runtime/layout.hpp" +#include "intel_gpu/runtime/tensor.hpp" + +#include "openvino/core/coordinate_diff.hpp" +#include "openvino/core/strides.hpp" + +#include "meta_utils.h" + +#include +#include +#include + +namespace ov { +namespace runtime { +namespace intel_gpu { + +using cldnn::tensor; +using cldnn::padding; +using cldnn::layout; + +/// @brief Sliding window output range computation mode. +enum class swor_mode { + // Single modes: + all, ///< Range is computed in the way that each sliding window in range is fully contained inside + ///< (optionally upper-padded by pad) input data. + exceed_once, ///< Range is computed in the way that each except at most one sliding window in range is fully + ///< contained inside (optionally upper-padded by pad) input data. The last window may partially + ///< exceed (optionally upper-padded by pad) input data range. + any, ///< Range is computed in the way that each sliding window in range is fully or at least partially + ///< contained inside (optionally upper-padded by pad) input data. + // Mixed modes: + exceed_once_data, ///< Range is computed in the way that each except at most one sliding window in range is fully + ///< contained inside (optionally upper-padded by pad) input data. The last window may + ///< partially exceed (non-upper-padded) input data range. + ///< This mode is effectievely minimum of combination of @c swor_mode::exceed_once mode + ///< and @c swor_mode::any mode (with always @c sym_pad = false). + max ///< Maximum of all single modes with all cominations of @c sym_pad. +}; + +/// @brief Calculates output range (size) for sliding window moving on input data range specified by @p input_size. +/// +/// @param input_size Range/Size of input data (non-padded or treated as valid). Only spatial coordinates are +/// considered. +/// @param size Size of sliding window. Only spatial coordinates are considered. +/// @param pad pad/Padding of sliding window in input. Only spatial coordinates are considered. Padding/pad +/// is applied from both sides of input data: negative value extends/pads data, positive - crops it. +/// @param stride Horizontal/Vertical stride of sliding in input data. +/// @param dilation Horizontal/Vertical dilation of sliding window on input data. +/// @param sym_pad Treat pad as applied on input symmetrically (from both sides). If @c false, the @p pad +/// is applied only from left/upper side. +/// @param degen_val If values from calculation are in allowed range, but calculated output size is invalid, +/// the @p degen_val is returned. Any non-positive value is considered degenerated and will be +/// switched to value passed in this parameter. +/// @return Output range (size) of sliding window. Only spatial dimensions are valid (rest is 0). +template +tensor calc_sliding_window_output_range(const tensor& input_size, + const tensor& size, + const ov::CoordinateDiff& pad, + const ov::Strides& stride, + const ov::Strides& dilation = {1, 1, 1, 1}, + bool sym_pad = true, + const tensor::value_type& degen_val = 0); + +/// @brief Fall-back implementation. +template +tensor calc_sliding_window_output_range(const tensor&, + const tensor&, + const tensor&, + const ov::Strides&, + const tensor&, + bool, + const tensor::value_type&) { + static_assert(meta::always_false>::value, + "Sliding window output range calculation mode is not supported. Please implement specialization " + "for new swor_mode."); + + return tensor(); +} + +template <> +inline tensor calc_sliding_window_output_range(const tensor& input_size, + const tensor& size, + const ov::CoordinateDiff& pad, + const ov::Strides& stride, + const ov::Strides& dilation, + bool sym_pad, + const tensor::value_type& degen_val) { + if (input_size.spatial[0] <= 0 || input_size.spatial[1] <= 0 || input_size.spatial[2] <= 0) + throw std::invalid_argument("Input data spatial sizes must be positive (>= 1)."); + if (size.spatial[0] <= 0 || size.spatial[1] <= 0 || size.spatial[2] <= 0) + throw std::invalid_argument("Sliding window spatial sizes must be positive (>= 1)."); + if (std::any_of(stride.begin(), stride.end(), [](size_t v) { return v <= 0; })) + throw std::invalid_argument("Sliding window strides must be positive (>= 1)."); + if (std::any_of(dilation.begin(), dilation.end(), [](size_t v) { return v <= 0; })) + throw std::invalid_argument("Sliding window h/v input dialations must be positive (>= 1)."); + + auto off_factor = sym_pad ? -2 : -1; + auto stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; + auto stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + auto stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; + + tensor::value_type dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1; + tensor::value_type dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1; + tensor::value_type dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1; + + auto pad_z = pad.size() >= 3 ? pad[pad.size() - 3] : 0; + auto pad_y = pad.size() >= 2 ? pad[pad.size() - 2] : 0; + auto pad_x = pad.size() >= 1 ? pad[pad.size() - 1] : 0; + + tensor wnd_ext_size{0, + 0, + (size.spatial[0] - 1) * dilation_x + 1, + (size.spatial[1] - 1) * dilation_y + 1, + (size.spatial[2] - 1) * dilation_z + 1}; + + // wes = (size - 1) * dilation + 1 + // lpos(i) = -pad + i * stride + wes - 1, for i = 0, 1, ... + // + // output_range = max {i | lpos(i) < input_size + pad} + 1, if sym_pad is true + // output_range = max {i | lpos(i) < input_size} + 1, if sym_pad is false + auto output_range_x = static_cast( + off_factor * pad_x + wnd_ext_size.spatial[0] <= input_size.spatial[0] + ? (input_size.spatial[0] - off_factor * pad_x - wnd_ext_size.spatial[0]) / stride_x + 1 + : degen_val); + auto output_range_y = static_cast( + off_factor * pad_y + wnd_ext_size.spatial[1] <= input_size.spatial[1] + ? (input_size.spatial[1] - off_factor * pad_y - wnd_ext_size.spatial[1]) / stride_y + 1 + : degen_val); + auto output_range_z = static_cast( + off_factor * pad_z + wnd_ext_size.spatial[2] <= input_size.spatial[2] + ? (input_size.spatial[2] - off_factor * pad_z - wnd_ext_size.spatial[2]) / stride_z + 1 + : degen_val); + + return {0, 0, output_range_x, output_range_y, output_range_z}; +} + +template <> +inline tensor calc_sliding_window_output_range(const tensor& input_size, + const tensor& size, + const ov::CoordinateDiff& pad, + const ov::Strides& stride, + const ov::Strides& dilation, + bool sym_pad, + const tensor::value_type& degen_val) { + if (input_size.spatial[0] <= 0 || input_size.spatial[1] <= 0 || input_size.spatial[2] <= 0) + throw std::invalid_argument("Input data spatial sizes must be positive (>= 1)."); + if (size.spatial[0] <= 0 || size.spatial[1] <= 0 || size.spatial[2] <= 0) + throw std::invalid_argument("Sliding window spatial sizes must be positive (>= 1)."); + if (std::any_of(stride.begin(), stride.end(), [](size_t v) { return v <= 0; })) + throw std::invalid_argument("Sliding window strides must be positive (>= 1)."); + if (std::any_of(dilation.begin(), dilation.end(), [](size_t v) { return v <= 0; })) + throw std::invalid_argument("Sliding window h/v input dialations must be positive (>= 1)."); + + auto off_factor = sym_pad ? -2 : -1; + auto stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; + auto stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + auto stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; + + tensor::value_type dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1; + tensor::value_type dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1; + tensor::value_type dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1; + + auto pad_z = pad.size() >= 3 ? pad[pad.size() - 3] : 0; + auto pad_y = pad.size() >= 2 ? pad[pad.size() - 2] : 0; + auto pad_x = pad.size() >= 1 ? pad[pad.size() - 1] : 0; + + tensor extend{0, + 0, + std::max((size.spatial[0] - 1) * dilation_x + 1, stride_x), + std::max((size.spatial[1] - 1) * dilation_y + 1, stride_y), + std::max((size.spatial[2] - 1) * dilation_z + 1, stride_z)}; + + + // wes = (size - 1) * dilation + 1 + // fpos(i) = -pad + i * stride, for i = 0, 1, ... + // lpos(i) = -pad + i * stride + wes - 1, for i = 0, 1, ... + // + // output_range = max {i | lpos(i) < input_size + pad - 1 and fpos(i + 1) < input_size + pad} + 2, if + // sym_pad is true output_range = max {i | lpos(i) < input_size - 1 and fpos(i + 1) < input_size} + 2, + // if sym_pad is false + auto output_range_x = static_cast( + off_factor * pad_x + extend.spatial[0] <= input_size.spatial[0] + stride_x - 1 + ? (input_size.spatial[0] - off_factor * pad_x - extend.spatial[0] + stride_x - 1) / + stride_x + + 1 + : degen_val); + auto output_range_y = static_cast( + off_factor * pad_y + extend.spatial[1] <= input_size.spatial[1] + stride_y - 1 + ? (input_size.spatial[1] - off_factor * pad_y - extend.spatial[1] + stride_y - 1) / + stride_y + + 1 + : degen_val); + auto output_range_z = static_cast( + off_factor * pad_z + extend.spatial[2] <= input_size.spatial[2] + stride_z - 1 + ? (input_size.spatial[2] - off_factor * pad_z - extend.spatial[2] + stride_z - 1) / + stride_z + + 1 + : degen_val); + + return {0, 0, output_range_x, output_range_y, output_range_z}; +} + +template <> +inline tensor calc_sliding_window_output_range(const tensor& input_size, + const tensor& size, + const ov::CoordinateDiff& pad, + const ov::Strides& stride, + const ov::Strides& dilation, + bool sym_pad, + const tensor::value_type& degen_val) { + if (input_size.spatial[0] <= 0 || input_size.spatial[1] <= 0 || input_size.spatial[2] <= 0) + throw std::invalid_argument("Input data spatial sizes must be positive (>= 1)."); + if (size.spatial[0] <= 0 || size.spatial[1] <= 0 || size.spatial[2] <= 0) + throw std::invalid_argument("Sliding window spatial sizes must be positive (>= 1)."); + if (std::any_of(stride.begin(), stride.end(), [](size_t v) { return v <= 0; })) + throw std::invalid_argument("Sliding window h/v strides must be positive (>= 1)."); + if (std::any_of(dilation.begin(), dilation.end(), [](size_t v) { return v <= 0; })) + throw std::invalid_argument("Sliding window h/v input dialations must be positive (>= 1)."); + + auto stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; + auto stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + auto stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; + + auto pad_z = pad.size() >= 3 ? pad[pad.size() - 3] : 0; + auto pad_y = pad.size() >= 2 ? pad[pad.size() - 2] : 0; + auto pad_x = pad.size() >= 1 ? pad[pad.size() - 1] : 0; + + auto off_factor = sym_pad ? -2 : -1; + + // fpos(i) = -pad + i * stride, for i = 0, 1, ... + // + // output_range = max {i | fpos(i) < input_size + pad} + 1, if sym_pad is true + // output_range = max {i | fpos(i) < input_size} + 1, if sym_pad is false + auto output_range_x = static_cast( + off_factor * pad_x <= input_size.spatial[0] - 1 + ? (input_size.spatial[0] - off_factor * pad_x - 1) / stride_x + 1 + : degen_val); + auto output_range_y = static_cast( + off_factor * pad_y <= input_size.spatial[1] - 1 + ? (input_size.spatial[1] - off_factor * pad_y - 1) / stride_y + 1 + : degen_val); + auto output_range_z = static_cast( + off_factor * pad_z <= input_size.spatial[2] - 1 + ? (input_size.spatial[2] - off_factor * pad_z - 1) / stride_z + 1 + : degen_val); + + return {0, 0, output_range_x, output_range_y, output_range_z}; +} + +template <> +inline tensor calc_sliding_window_output_range(const tensor& input_size, + const tensor& size, + const ov::CoordinateDiff& pad, + const ov::Strides& stride, + const ov::Strides& dilation, + bool sym_pad, + const tensor::value_type& degen_val) { + auto output_range_exceed_once = calc_sliding_window_output_range(input_size, + size, + pad, + stride, + dilation, + sym_pad, + degen_val); + auto output_range_exceed_any_data = + calc_sliding_window_output_range(input_size, size, pad, stride, dilation, false, degen_val); + + return tensor::min(output_range_exceed_once, output_range_exceed_any_data); +} + +template <> +inline tensor calc_sliding_window_output_range(const tensor& input_size, + const tensor& size, + const ov::CoordinateDiff& pad, + const ov::Strides& stride, + const ov::Strides& dilation, + bool, + const tensor::value_type& degen_val) { + auto output_range_all_sym = + calc_sliding_window_output_range(input_size, size, pad, stride, dilation, true, degen_val); + auto output_range_all_asym = + calc_sliding_window_output_range(input_size, size, pad, stride, dilation, false, degen_val); + + auto output_range_exceed_once_sym = calc_sliding_window_output_range(input_size, + size, + pad, + stride, + dilation, + true, + degen_val); + auto output_range_exceed_once_asym = calc_sliding_window_output_range(input_size, + size, + pad, + stride, + dilation, + false, + degen_val); + + auto output_range_any_sym = + calc_sliding_window_output_range(input_size, size, pad, stride, dilation, true, degen_val); + auto output_range_any_asym = + calc_sliding_window_output_range(input_size, size, pad, stride, dilation, false, degen_val); + + return tensor::max(tensor::max(tensor::max(output_range_all_sym, output_range_all_asym), + tensor::max(output_range_exceed_once_sym, output_range_exceed_once_asym)), + tensor::max(output_range_any_sym, output_range_any_asym)); +} + +/// @brief Calculates minumum needed input range (size) for sliding window to get at least specified @p output_size. +/// +/// @param output_size Range/Size of output data (non-padded or treated as valid). Only spatial coordinates are +/// considered. +/// @param size Size of sliding window. Only spatial coordinates are considered. +/// @param pad pad/Padding of sliding window in input. Only spatial coordinates are considered. Padding/pad +/// is applied from both sides of input data: negative value extends/pads data, positive - crops it. +/// @param stride Horizontal/Vertical stride of sliding in input data. +/// @param dilation Horizontal/Vertical dilation of sliding window on input data. +/// @param sym_pad Treat pad as applied on input symmetrically (from both sides). If @c false, the @p pad +/// is applied only from left/upper side. +/// @param degen_val If values from calculation are in allowed range, but calculated output size is invalid, +/// the @p degen_val is returned. Any non-positive value is considered degenerated and will be +/// switched to value passed in this parameter. +/// @return Input range (size) for sliding window to get equal or greater @p output_size. +inline tensor calc_sliding_window_needed_input_range(const tensor& output_size, + const tensor& size, + const ov::CoordinateDiff& pad, + const ov::Strides& stride, + const ov::Strides& dilation = {1, 1, 1, 1}, + bool sym_pad = true, + const tensor::value_type& degen_val = 0) { + if (output_size.spatial[0] <= 0 || output_size.spatial[1] <= 0 || output_size.spatial[2] <= 0) + throw std::invalid_argument("Output data spatial sizes must be positive (>= 1)."); + if (size.spatial[0] <= 0 || size.spatial[1] <= 0 || size.spatial[2] <= 0) + throw std::invalid_argument("Sliding window spatial sizes must be positive (>= 1)."); + if (std::any_of(stride.begin(), stride.end(), [](size_t v) { return v <= 0; })) + throw std::invalid_argument("Sliding window h/v strides must be positive (>= 1)."); + if (std::any_of(dilation.begin(), dilation.end(), [](size_t v) { return v <= 0; })) + throw std::invalid_argument("Sliding window h/v input dialations must be positive (>= 1)."); + + auto off_factor = sym_pad ? -2 : -1; + auto stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; + auto stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + auto stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; + + tensor::value_type dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1; + tensor::value_type dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1; + tensor::value_type dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1; + + auto pad_z = pad.size() >= 3 ? pad[pad.size() - 3] : 0; + auto pad_y = pad.size() >= 2 ? pad[pad.size() - 2] : 0; + auto pad_x = pad.size() >= 1 ? pad[pad.size() - 1] : 0; + + tensor wnd_ext_size{0, + 0, + (size.spatial[0] - 1) * dilation_x + 1, + (size.spatial[1] - 1) * dilation_y + 1, + (size.spatial[2] - 1) * dilation_z + 1}; + + auto output_range_x = + off_factor * pad_x + (output_size.spatial[0] - 1) * stride_x + wnd_ext_size.spatial[0]; + auto output_range_y = + off_factor * pad_y + (output_size.spatial[1] - 1) * stride_y + wnd_ext_size.spatial[1]; + auto output_range_z = + off_factor * pad_z + (output_size.spatial[2] - 1) * stride_z + wnd_ext_size.spatial[2]; + + if (output_range_x <= 0) + output_range_x = degen_val; + if (output_range_y <= 0) + output_range_y = degen_val; + if (output_range_z <= 0) + output_range_z = degen_val; + + return {0, + 0, + static_cast(output_range_x), + static_cast(output_range_y), + static_cast(output_range_z)}; +} + +/// @brief Calculates safe needed input upper padding for sliding window to be able to compute at least +/// specified @p output_size. +/// +/// @param output_size Range/Size of output data (non-padded or treated as valid). Only spatial coordinates are +/// considered. +/// @param size Size of sliding window. Only spatial coordinates are considered. +/// @param pad Padding of sliding window in input. Only spatial coordinates are considered. Padding/pad +/// is applied from both sides of input data: negative value extends/pads data, positive - crops it. +/// @param stride Horizontal/Vertical stride of sliding in input data. +/// @param dilation Horizontal/Vertical dilation of sliding window on input data. +/// @param inverse Indicate that inverse calculation of needed range should take place (estimation of needed +/// ouput size when input size is specified). Used in deconvolution (when we switch input calculation +/// with output calculation). +/// @param degen_val If values from calculation are in allowed range, but calculated output size is invalid, +/// the @p degen_val is returned. Any non-positive value is considered degenerated and will be +/// switched to value passed in this parameter. +/// @return Input upper padding for sliding window to get equal or greater @p output_size. The padding takes into +/// consideration actual value of padding (always extends it) and only works on spatial coordinates of upper +/// padding (rest of padding values are not changed). +inline padding calc_sliding_window_needed_input_padding(const layout& actual_input_layout, + const tensor& output_size, + const tensor& size, + const ov::CoordinateDiff& pad, + const ov::Strides& stride, + const ov::Strides& dilation = {1, 1}, + bool inverse = false, + const tensor::value_type& degen_val = 0) { + tensor needed_size; + if (inverse) { + needed_size = calc_sliding_window_output_range(output_size, + size, + pad, + stride, + dilation, + false /* not important */, + degen_val); + } else { + auto needed_size_sym = + calc_sliding_window_needed_input_range(output_size, size, pad, stride, dilation, true, degen_val); + auto needed_size_asym = + calc_sliding_window_needed_input_range(output_size, size, pad, stride, dilation, false, degen_val); + + needed_size = tensor::max(needed_size_sym, needed_size_asym); + } + + const auto& actual_data_size = actual_input_layout.size; + const auto& actual_lpad = actual_input_layout.data_padding.lower_size(); + const auto& actual_upad = actual_input_layout.data_padding.upper_size(); + + auto needed_upad = tensor::max(needed_size.sub(actual_data_size), actual_upad); + + return padding(actual_lpad.sizes(), + {actual_upad.batch[0], + actual_upad.feature[0], + needed_upad.spatial[0], + needed_upad.spatial[1], + needed_upad.spatial[2]}); +} + +} // namespace intel_gpu +} // namespace runtime +} // namespace ov diff --git a/src/plugins/intel_gpu/src/graph/include/sliding_window_utils.h b/src/plugins/intel_gpu/src/graph/include/sliding_window_utils_legacy.h similarity index 100% rename from src/plugins/intel_gpu/src/graph/include/sliding_window_utils.h rename to src/plugins/intel_gpu/src/graph/include/sliding_window_utils_legacy.h diff --git a/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp b/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp index 8646c2a4921..81c3354194a 100644 --- a/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp +++ b/src/plugins/intel_gpu/src/graph/layout_optimizer.cpp @@ -456,8 +456,8 @@ bool should_use_winograd_2x3_s1(std::shared_ptr const& prim, || weights_layout.size.spatial[0] != 3 // weights have to be 3x3 by definiton || weights_layout.size.spatial[1] != 3 // weights have to be 3x3 by definition || weights_layout.size.batch[0] % 64 != 0 // current algorithm is effective for ofm to be multiply of 64 - || prim->stride != tensor {1} // stride has to be 1x1 by definition - || prim->dilation != tensor {1} // no support for dilation + || any_not_one(prim->stride) // stride has to be 1x1 by definition + || any_not_one(prim->dilation) // no support for dilation || prim->split() != 1 // no support for splitted convolutions || (output_size_handling_enabled && prim->with_output_size) // no support for convolutions with user-specified output size @@ -495,7 +495,7 @@ bool layout_optimizer::convolution_bfyx_opt(layout const& output_layout, output_layout.data_type != data_types::f16 || weights_layout.size.batch[0] % 16 != 0 || !((weights_layout.size.spatial[0] == 1 && weights_layout.size.spatial[1] == 1) || (weights_layout.size.spatial[0] >= 5 && weights_layout.size.spatial[1] >= 5) || - (conv->stride.spatial[0] > 1 && conv->stride.spatial[1] > 1) || + (conv->stride[0] > 1 && conv->stride[1] > 1) || (weights_layout.size.feature[0] <= 32 && output_layout.size.spatial[0] < 224 && output_layout.size.spatial[1] < 224) || (weights_layout.size.feature[0] <= 64 && output_layout.size.spatial[0] < 112 && @@ -533,13 +533,14 @@ bool layout_optimizer::convolution_byxf_opt(const layout& input_layout, // A set of rules that define when byxf mem format has better performance if ((output_layout.data_type == data_types::f16 && weights_layout.size.spatial[0] == 1 && - conv->dilation == tensor { 1 } && + all_ones(conv->dilation) && !node.get_transposed() && node.get_groups() == 1 && input_layout.size.feature[0] % 32 == 0 && weights_layout.size.spatial[1] == 1 && output_layout.size.feature[0] % 64 == 0 && - weights_layout.size.batch[0] % 64 == 0 && conv->stride.spatial[0] == 1 && conv->stride.spatial[1] == 1 && - conv->pad.spatial[0] == 0 && conv->pad.spatial[1] == 0) || + weights_layout.size.batch[0] % 64 == 0 && + all_ones(conv->stride) && + all_zeroes(conv->pad)) || // Winograd should_use_winograd_2x3_s1(conv, input_layout, weights_layout, _output_size_handling_enabled)) return true; @@ -576,7 +577,7 @@ bool layout_optimizer::convolution_b_fs_yx_fsv16_opt(const layout& input_layout, out_features_per_group >= 16 && // Need to extend imad fsv4 kernel to handle e.g. 3 input features per group (in_features_per_group % 4 == 0) && - ((conv->dilation.spatial[0] + 1) * (ks_x - 1)) <= 16) + ((conv->dilation[conv->dilation.size() - 1] + 1) * (ks_x - 1)) <= 16) return true; // Check for fsv16 imad kernel else if ((input_layout.format.dimension() == 4) && @@ -655,7 +656,7 @@ bool layout_optimizer::convolution_b_fs_zyx_fsv16_opt(const layout& input_layout input_layout.format == format::bs_fs_zyx_bsv16_fsv16); bool data_type_ver = input_layout.data_type == data_types::f16 || input_layout.data_type == data_types::f32; bool w_layout = weights_layout.data_type == input_layout.data_type; - bool single_dilation = conv->dilation == tensor(1); + bool single_dilation = all_ones(conv->dilation); bool groups_ver = conv->groups == 1 || out_features_per_group % 16 == 0 || (conv->groups > 1 && out_features_per_group == 8); @@ -680,7 +681,7 @@ bool layout_optimizer::convolution_bs_fs_yx_bsv16_fsv16_opt(const layout& input_ auto ks_x = weights_layout.size.spatial[0]; auto ks_y = weights_layout.size.spatial[1]; int8_sup &= (input_layout.size.spatial[2] == 1 && ((ks_x == 1 && ks_y == 1) || (ks_x == 3 && ks_y == 3) || (ks_x == 7 && ks_y == 7)) && - output_layout.size.feature[0] % 32 == 0 && conv->split() == 1 && conv->dilation == tensor{1}); + output_layout.size.feature[0] % 32 == 0 && conv->split() == 1 && all_ones(conv->dilation)); return (int8_sup || fp16_ver || fp32_ver) && correct_feature && correct_batch && single_group; } @@ -1148,7 +1149,7 @@ layout layout_optimizer::get_expected_layout(layout const& current_layout, int input_features = input_tensor.feature[0]; int output_features = expected_tensor.feature[0]; float f_cost = static_cast(input_features * output_features) / (align_to(input_features, 16) * align_to(output_features, 16)); - float stride_cost = 1/static_cast(prim->stride.spatial[0]); + float stride_cost = 1 / static_cast(prim->stride[prim->stride.size() - 1]); if (f_cost * stride_cost > 0.1f) expected_format = cldnn::format::b_fs_yx_fsv16; else diff --git a/src/plugins/intel_gpu/src/graph/max_unpooling.cpp b/src/plugins/intel_gpu/src/graph/max_unpooling.cpp index 204115c439f..eeb3faef160 100644 --- a/src/plugins/intel_gpu/src/graph/max_unpooling.cpp +++ b/src/plugins/intel_gpu/src/graph/max_unpooling.cpp @@ -4,7 +4,7 @@ #include "max_unpooling_inst.h" #include "primitive_type_base.h" -#include "sliding_window_utils.h" +#include "sliding_window_utils_legacy.h" #include "intel_gpu/runtime/error_handler.hpp" #include "json_object.h" #include diff --git a/src/plugins/intel_gpu/src/graph/pooling.cpp b/src/plugins/intel_gpu/src/graph/pooling.cpp index 4c287db4a3a..fc60926cadc 100644 --- a/src/plugins/intel_gpu/src/graph/pooling.cpp +++ b/src/plugins/intel_gpu/src/graph/pooling.cpp @@ -4,11 +4,13 @@ #include "pooling_inst.h" #include "primitive_type_base.h" -#include "sliding_window_utils.h" +#include "sliding_window_utils.hpp" #include "intel_gpu/runtime/error_handler.hpp" #include "json_object.h" #include +using namespace ov::runtime::intel_gpu; + namespace cldnn { primitive_type_id pooling::type_id() { static primitive_type_base instance; @@ -70,33 +72,42 @@ layout pooling_inst::calc_output_layout(parent::typed_node const& node) { } if (desc->global_pooling) { - window_size.spatial[0] = input_layout.size.spatial[0]; - window_size.spatial[1] = input_layout.size.spatial[1]; - window_size.spatial[2] = input_layout.size.spatial[2]; + window_size = ov::Shape(input_layout.get_spatial_rank(), 1); + for (size_t i = 0; i < input_layout.get_spatial_rank(); i++) { + window_size[i] = input_layout.spatial(input_layout.get_spatial_rank() - i - 1); + } } + uint32_t stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; + uint32_t stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + uint32_t stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; + + uint32_t kernel_z = window_size.size() >= 3 ? window_size[window_size.size() - 3] : 1; + uint32_t kernel_y = window_size.size() >= 2 ? window_size[window_size.size() - 2] : 1; + uint32_t kernel_x = window_size.size() >= 1 ? window_size[window_size.size() - 1] : 1; + // TODO: Consider moving general parameter verification to arguments constructor. CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(), "stride spatial X", - stride.spatial[0], + stride_x, "", 0, "Stride spatial X must be positive (>= 1)"); CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(), "stride spatial Y", - stride.spatial[1], + stride_y, "", 0, "Stride spatial Y must be positive (>= 1)"); CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(), "window size spatial X", - window_size.spatial[0], + kernel_x, "", 0, "Size X (of pooling window) must be positive (>= 1)"); CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(), "window size spatial Y", - window_size.spatial[1], + kernel_y, "", 0, "Size Y (of pooling window) must be positive (>= 1)"); @@ -104,13 +115,13 @@ layout pooling_inst::calc_output_layout(parent::typed_node const& node) { // 3D CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(), "stride spatial Z", - stride.spatial[1], + stride_z, "", 0, "Stride spatial Z must be positive (>= 1)"); CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(), "window size spatial Z", - window_size.spatial[2], + kernel_z, "", 0, "Size Z (of pooling window) must be positive (>= 1)"); @@ -145,11 +156,15 @@ layout pooling_inst::calc_output_layout(parent::typed_node const& node) { } // TODO: Check compatibility of output size calculation (with caffe). + tensor size(1); + for (size_t i = 0; i < window_size.size(); i++) { + size.spatial[i] = window_size[window_size.size() - i - 1]; + } auto output_range = calc_sliding_window_output_range(input_layout.size, - window_size, - pad, + size, + ov::CoordinateDiff(pad.begin(), pad.end()), stride, - {1, 1, 1, 1}, + ov::Strides(window_size.size(), 1), true, 1); @@ -172,9 +187,9 @@ std::string pooling_inst::to_string(pooling_node const& node) { json_composite pooling_info; pooling_info.add("mode", mode); - pooling_info.add("stride", strd.to_string()); - pooling_info.add("kernel size", kernel_size.to_string()); - pooling_info.add("pad", desc->pad.to_string()); + pooling_info.add("stride", cldnn::to_string(strd)); + pooling_info.add("kernel size", cldnn::to_string(kernel_size)); + pooling_info.add("pad", cldnn::to_string(desc->pad)); if (desc->with_output_size) { json_composite ud_out_size_info; ud_out_size_info.add("size", desc->output_size.to_string()); diff --git a/src/plugins/intel_gpu/src/graph/program.cpp b/src/plugins/intel_gpu/src/graph/program.cpp index a8a55c31930..8822a150a6c 100644 --- a/src/plugins/intel_gpu/src/graph/program.cpp +++ b/src/plugins/intel_gpu/src/graph/program.cpp @@ -17,7 +17,7 @@ #include "pass_manager.h" #include "primitive_type.h" #include "program_dump_graph.h" -#include "sliding_window_utils.h" +#include "sliding_window_utils.hpp" #include "program_helpers.h" #include "roi_pooling_inst.h" @@ -89,6 +89,9 @@ #ifdef __unix__ #include #endif + +using namespace ov::runtime::intel_gpu; + program::program(engine& engine_ref, topology const& topology, build_options const& options, @@ -296,14 +299,18 @@ bool program::analyze_output_size_handling_need() { {0, 0, prim->output_size.spatial[0], prim->output_size.spatial[1], prim->output_size.spatial[2]}, 1); + tensor size(1); + for (size_t i = 0; i < prim->size.size(); i++) { + size.spatial[i] = prim->size[prim->size.size() - i - 1]; + } // TODO: Check compatibility of output size calculation (with caffe). auto primInputSize = prim_node.input().get_output_layout().size; auto calc_output_range = calc_sliding_window_output_range( primInputSize, - prim->size, - prim->pad, + size, + ov::CoordinateDiff(prim->pad.begin(), prim->pad.end()), prim->stride, - {1, 1, 1, 1}, + ov::Strides(prim->stride.size(), 1), true, 1); diff --git a/src/plugins/intel_gpu/src/plugin/ops/convolution.cpp b/src/plugins/intel_gpu/src/plugin/ops/convolution.cpp index d3f7ab901af..9669abbfb1b 100644 --- a/src/plugins/intel_gpu/src/plugin/ops/convolution.cpp +++ b/src/plugins/intel_gpu/src/plugin/ops/convolution.cpp @@ -23,67 +23,35 @@ namespace ov { namespace runtime { namespace intel_gpu { -struct ConvolutionParameters { - cldnn::tensor stride; - cldnn::tensor padding; - cldnn::tensor dilation; - uint32_t groups; -}; - -static ConvolutionParameters GetConvolutionParameters(const ngraph::CoordinateDiff& pads_begin, - const ngraph::Strides& dilations, - const ngraph::Strides& strides, - uint32_t groups) { - cldnn::tensor stride, padding, dilation; - if (pads_begin.size() != strides.size() || dilations.size() != strides.size()) - IE_THROW() << "Strides, Dilations and Pads are supposed to have the same elements count"; - - switch (strides.size()) { - case 3: { - stride = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(strides[2], strides[1], strides[0])); - padding = cldnn::tensor({0, 0, TensorValue(pads_begin[2]), TensorValue(pads_begin[1]), TensorValue(pads_begin[0])}, 0); - dilation = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(dilations[2], dilations[1], dilations[0])); - break; - } - case 2: { - stride = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(strides[1], strides[0], 1)); - padding = cldnn::tensor({0, 0, TensorValue(pads_begin[1]), TensorValue(pads_begin[0])}, 0); - dilation = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(dilations[1], dilations[0], 1)); - break; - } - case 1: { - stride = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(1, strides[0], 1)); - padding = cldnn::tensor({0, 0, 0, TensorValue(pads_begin[0])}, 0); - dilation = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(1, dilations[0], 1)); - break; - } - default: IE_THROW() << "Unsupported convolve parameters size. Only 1d, 2d, and 3d cases are supported"; - } - - return {stride, padding, dilation, groups}; -} - static void CreateGroupConvolutionOp(Program& p, const std::shared_ptr& op) { p.ValidateInputs(op, {2}); auto inputs = p.GetInputPrimitiveIDs(op); std::string layerName = layer_type_name_ID(op); uint32_t groups = op->get_input_shape(1)[0]; - auto params = GetConvolutionParameters(op->get_pads_begin(), op->get_dilations(), op->get_strides(), groups); auto outDims = op->get_output_shape(0); auto outPrecision = op->get_output_element_type(0); std::vector weights = {inputs[1]}; const bool weights_have_group_dim = true; + auto strides = op->get_strides(); + auto pads_begin = op->get_pads_begin(); + auto dilations = op->get_dilations(); + + // Extend 1d vectors to 2d as 1d can't be handled properly by the graph optimizer for now + strides.resize(std::max(2, strides.size()), 1); + pads_begin.resize(std::max(2, pads_begin.size()), 0); + dilations.resize(std::max(2, dilations.size()), 1); + auto convPrim = cldnn::convolution(layerName, inputs[0], weights, {}, - params.groups, - params.stride, - params.padding, - params.dilation, + groups, + strides, + pads_begin, + dilations, tensor_from_dims(outDims), DataTypeFromPrecision(outPrecision), weights_have_group_dim, @@ -98,21 +66,29 @@ static void CreateConvolutionOp(Program& p, const std::shared_ptrget_pads_begin(), op->get_dilations(), op->get_strides(), 1); auto outDims = op->get_output_shape(0); auto outPrecision = op->get_output_element_type(0); std::vector weights = {inputs[1]}; const bool weights_have_group_dim = false; + auto strides = op->get_strides(); + auto pads_begin = op->get_pads_begin(); + auto dilations = op->get_dilations(); + + // Extend 1d vectors to 2d as 1d can't be handled properly by the graph optimizer for now + strides.resize(std::max(2, strides.size()), 1); + pads_begin.resize(std::max(2, pads_begin.size()), 0); + dilations.resize(std::max(2, dilations.size()), 1); + auto convPrim = cldnn::convolution(layerName, inputs[0], weights, {}, - params.groups, - params.stride, - params.padding, - params.dilation, + 1, + strides, + pads_begin, + dilations, tensor_from_dims(outDims), DataTypeFromPrecision(outPrecision), weights_have_group_dim, @@ -163,14 +139,20 @@ static void CreateConvolutionBackpropDataOp(Program& p, const std::shared_ptr weights = {weightsName}; const bool weights_have_group_dim = false; - auto params = GetConvolutionParameters(op->get_pads_begin(), op->get_dilations(), op->get_strides(), 1); + auto strides = op->get_strides(); + auto pads_begin = op->get_pads_begin(); + + // Extend 1d vectors to 2d as 1d can't be handled properly by the graph optimizer for now + strides.resize(std::max(2, strides.size()), 1); + pads_begin.resize(std::max(2, pads_begin.size()), 0); + auto deconvPrim = cldnn::deconvolution(layerName, inputs[0], weights, {}, - params.groups, - params.stride, - params.padding, + 1, + strides, + pads_begin, tensor_from_dims(op->get_output_tensor(0).get_shape()), weights_have_group_dim, op->get_friendly_name()); @@ -192,7 +174,6 @@ static void CreateGroupConvolutionBackpropDataOp(Program& p, const std::shared_p } uint32_t groups = op->get_input_shape(1)[0]; - auto params = GetConvolutionParameters(op->get_pads_begin(), op->get_dilations(), op->get_strides(), groups); auto weightsName = inputs[1]; auto weights_node = op->get_input_node_shared_ptr(1); @@ -222,13 +203,20 @@ static void CreateGroupConvolutionBackpropDataOp(Program& p, const std::shared_p std::vector weights = {weightsName}; const bool weights_have_group_dim = true; + auto strides = op->get_strides(); + auto pads_begin = op->get_pads_begin(); + + // Extend 1d vectors to 2d as 1d can't be handled properly by the graph optimizer for now + strides.resize(std::max(2, strides.size()), 1); + pads_begin.resize(std::max(2, pads_begin.size()), 0); + auto deconvPrim = cldnn::deconvolution(layerName, inputs[0], weights, {}, - params.groups, - params.stride, - params.padding, + groups, + strides, + pads_begin, tensor_from_dims(op->get_output_tensor(0).get_shape()), weights_have_group_dim, op->get_friendly_name()); @@ -239,7 +227,10 @@ static void CreateGroupConvolutionBackpropDataOp(Program& p, const std::shared_p static void DeformableConvolutionImpl(Program& p, const std::shared_ptr& op, - const ConvolutionParameters& params, + const int64_t groups, + const ov::Strides& strides, + const ov::Strides& dilations, + const ov::CoordinateDiff& padding, std::int64_t deformableGroupsNum, bool bilinearInterpolationPad = false) { auto inputs = p.GetInputPrimitiveIDs(op); @@ -249,7 +240,7 @@ static void DeformableConvolutionImpl(Program& p, std::vector weights = {inputs[2]}; // Remove weights from inputs inputs.erase(inputs.begin() + 2); - if (params.groups == 1) { + if (groups == 1) { std::string defConvLayerNameInterp = layerName + "_interp"; std::string defConvLayerNameConv = layerName; cldnn::tensor kernel; @@ -271,11 +262,11 @@ static void DeformableConvolutionImpl(Program& p, auto defConvPrimInterp = cldnn::deformable_interp(defConvLayerNameInterp, inputs, - params.groups, + groups, deformableGroupsNum, - params.stride, - params.padding, - params.dilation, + strides, + padding, + dilations, tensor_from_dims(outDims), kernel, bilinearInterpolationPad, @@ -286,7 +277,7 @@ static void DeformableConvolutionImpl(Program& p, defConvLayerNameInterp, weights, {}, - params.groups, + groups, tensor_from_dims(outDims), op->get_friendly_name()); p.AddPrimitive(defConvPrim); @@ -296,11 +287,11 @@ static void DeformableConvolutionImpl(Program& p, inputs, weights, {}, - params.groups, + groups, deformableGroupsNum, - params.stride, - params.padding, - params.dilation, + strides, + padding, + dilations, tensor_from_dims(outDims), bilinearInterpolationPad, op->get_friendly_name()); @@ -312,14 +303,37 @@ static void DeformableConvolutionImpl(Program& p, static void CreateDeformableConvolutionOp(Program& p, const std::shared_ptr& op) { p.ValidateInputs(op, {3}); - auto params = GetConvolutionParameters(op->get_pads_begin(), op->get_dilations(), op->get_strides(), op->get_group()); - DeformableConvolutionImpl(p, op, params, op->get_deformable_group()); + auto strides = op->get_strides(); + auto pads_begin = op->get_pads_begin(); + auto dilations = op->get_dilations(); + + // Extend 1d vectors to 2d as 1d can't be handled properly by the graph optimizer for now + strides.resize(std::max(2, strides.size()), 1); + pads_begin.resize(std::max(2, pads_begin.size()), 0); + dilations.resize(std::max(2, dilations.size()), 1); + + DeformableConvolutionImpl(p, op, op->get_group(), strides, dilations, pads_begin, op->get_deformable_group()); } static void CreateDeformableConvolutionOp(Program& p, const std::shared_ptr& op) { p.ValidateInputs(op, {3, 4}); - auto params = GetConvolutionParameters(op->get_pads_begin(), op->get_dilations(), op->get_strides(), op->get_group()); - DeformableConvolutionImpl(p, op, params, op->get_deformable_group(), op->get_bilinear_interpolation_pad()); + auto strides = op->get_strides(); + auto pads_begin = op->get_pads_begin(); + auto dilations = op->get_dilations(); + + // Extend 1d vectors to 2d as 1d can't be handled properly by the graph optimizer for now + strides.resize(std::max(2, strides.size()), 1); + pads_begin.resize(std::max(2, pads_begin.size()), 0); + dilations.resize(std::max(2, dilations.size()), 1); + + DeformableConvolutionImpl(p, + op, + op->get_group(), + strides, + dilations, + pads_begin, + op->get_deformable_group(), + op->get_bilinear_interpolation_pad()); } static void CreateBinaryConvolutionOp(Program& p, const std::shared_ptr& op) { @@ -327,19 +341,28 @@ static void CreateBinaryConvolutionOp(Program& p, const std::shared_ptrget_pads_begin(), op->get_dilations(), op->get_strides(), 1); auto outDims = op->get_output_shape(0); std::vector weights = {inputs[1]}; cldnn::data_types calc_precision = DataTypeFromPrecision(op->get_output_element_type(0)); + + auto strides = op->get_strides(); + auto pads_begin = op->get_pads_begin(); + auto dilations = op->get_dilations(); + + // Extend 1d vectors to 2d as 1d can't be handled properly by the graph optimizer for now + strides.resize(std::max(2, strides.size()), 1); + pads_begin.resize(std::max(2, pads_begin.size()), 0); + dilations.resize(std::max(2, dilations.size()), 1); + auto convPrim = cldnn::binary_convolution(layerName, inputs[0], weights, - params.stride, - params.padding, - params.dilation, + strides, + pads_begin, + dilations, tensor_from_dims(outDims), - params.groups, + 1, op->get_pad_value(), calc_precision, op->get_friendly_name()); diff --git a/src/plugins/intel_gpu/src/plugin/ops/pooling.cpp b/src/plugins/intel_gpu/src/plugin/ops/pooling.cpp index 68a3735966f..cc8aa854902 100644 --- a/src/plugins/intel_gpu/src/plugin/ops/pooling.cpp +++ b/src/plugins/intel_gpu/src/plugin/ops/pooling.cpp @@ -15,82 +15,32 @@ namespace ov { namespace runtime { namespace intel_gpu { -struct PoolingParameters { - cldnn::tensor kernel; - cldnn::tensor stride; - cldnn::tensor dilation; - cldnn::tensor pad_begin; - cldnn::tensor pad_end; -}; - -static PoolingParameters GetPoolingParameters(const ngraph::Shape& kernel, - const ngraph::Strides& strides, - const ngraph::Shape& pads_begin, - const ngraph::Shape& pads_end, - const ngraph::Strides& dilations = {}) { - cldnn::tensor k, s, pb, pe; - cldnn::tensor d{cldnn::batch(1), cldnn::feature(1), cldnn::spatial(1, 1, 1)}; - const auto is_dilation_specified = !dilations.empty(); - - if (pads_begin.size() != strides.size() || pads_end.size() != strides.size() || kernel.size() != strides.size() - || (is_dilation_specified && dilations.size() != strides.size())) - IE_THROW() << "Strides, KernelSizes, Pads (and Dilations, if specified) are supposed to have the same elements count"; - - std::vector pb_casted(pads_begin.begin(), pads_begin.end()); - std::vector pe_casted(pads_end.begin(), pads_end.end()); - switch (strides.size()) { - case 3: { - k = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(kernel[2], kernel[1], kernel[0])); - s = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(strides[2], strides[1], strides[0])); - pb = cldnn::tensor(cldnn::batch(0), cldnn::feature(0), cldnn::spatial(pb_casted[2], pb_casted[1], pb_casted[0])); - pe = cldnn::tensor(cldnn::batch(0), cldnn::feature(0), cldnn::spatial(pe_casted[2], pe_casted[1], pe_casted[0])); - if (is_dilation_specified) { - d = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(dilations[2], dilations[1], dilations[0])); - } - break; - } - case 2: { - k = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(kernel[1], kernel[0], 1)); - s = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(strides[1], strides[0], 1)); - pb = cldnn::tensor(cldnn::batch(0), cldnn::feature(0), cldnn::spatial(pb_casted[1], pb_casted[0], 0)); - pe = cldnn::tensor(cldnn::batch(0), cldnn::feature(0), cldnn::spatial(pe_casted[1], pe_casted[0], 0)); - if (is_dilation_specified) { - d = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(dilations[1], dilations[0], 1)); - } - break; - } - case 1: { - k = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(kernel[0], 1, 1)); - s = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(strides[0], 1, 1)); - pb = cldnn::tensor(cldnn::batch(0), cldnn::feature(0), cldnn::spatial(pb_casted[0], 0, 0)); - pe = cldnn::tensor(cldnn::batch(0), cldnn::feature(0), cldnn::spatial(pe_casted[0], 0, 0)); - if (is_dilation_specified) { - d = cldnn::tensor(cldnn::batch(1), cldnn::feature(1), cldnn::spatial(dilations[0], 1, 1)); - } - break; - } - default: IE_THROW() << "Unsupported pooling parameters size. Only 1d, 2d, and 3d cases are supported"; - } - - return {k, s, d, pb, pe}; -} - static void CreateAvgPoolOp(Program& p, const std::shared_ptr& op) { p.ValidateInputs(op, {1}); auto inputPrimitives = p.GetInputPrimitiveIDs(op); std::string layerName = layer_type_name_ID(op); - auto params = GetPoolingParameters(op->get_kernel(), op->get_strides(), op->get_pads_begin(), op->get_pads_end()); + auto kernel = op->get_kernel(); + auto strides = op->get_strides(); + auto pads_begin = op->get_pads_begin(); + auto pads_end = op->get_pads_end(); + + // Extend 1d vectors to 2d as 1d can't be handled properly by the graph optimizer for now + kernel.resize(std::max(2, kernel.size()), 1); + strides.resize(std::max(2, strides.size()), 1); + pads_begin.resize(std::max(2, pads_begin.size()), 0); + pads_end.resize(std::max(2, pads_end.size()), 0); + auto poolPrim = cldnn::pooling(layerName, inputPrimitives[0], op->get_exclude_pad() ? cldnn::pooling_mode::average_no_padding : cldnn::pooling_mode::average, - params.kernel, - params.stride, - params.pad_begin, + kernel, + strides, + pads_begin, tensor_from_dims(op->get_output_shape(0)), DataTypeFromPrecision(op->get_output_element_type(0)), op->get_friendly_name()); - poolPrim.pad_end = params.pad_end; + poolPrim.pad_end = pads_end; p.AddPrimitive(poolPrim); p.AddPrimitiveToProfiler(op); } @@ -100,17 +50,27 @@ static void CreateMaxPoolOp(Program& p, const std::shared_ptrget_kernel(), op->get_strides(), op->get_pads_begin(), op->get_pads_end()); + auto kernel = op->get_kernel(); + auto strides = op->get_strides(); + auto pads_begin = op->get_pads_begin(); + auto pads_end = op->get_pads_end(); + + // Extend 1d vectors to 2d as 1d can't be handled properly by the graph optimizer for now + kernel.resize(std::max(2, kernel.size()), 1); + strides.resize(std::max(2, strides.size()), 1); + pads_begin.resize(std::max(2, pads_begin.size()), 0); + pads_end.resize(std::max(2, pads_end.size()), 0); + auto poolPrim = cldnn::pooling(layerName, inputPrimitives[0], cldnn::pooling_mode::max, - params.kernel, - params.stride, - params.pad_begin, + kernel, + strides, + pads_begin, tensor_from_dims(op->get_output_shape(0)), DataTypeFromPrecision(op->get_output_element_type(0)), op->get_friendly_name()); - poolPrim.pad_end = params.pad_end; + poolPrim.pad_end = pads_end; p.AddPrimitive(poolPrim); p.AddPrimitiveToProfiler(op); } @@ -139,15 +99,27 @@ static void CreateMaxPoolOp(Program& p, const std::shared_ptrget_kernel(), op->get_strides(), op->get_pads_begin(), op->get_pads_end(), op->get_dilations()); + auto kernel = op->get_kernel(); + auto strides = op->get_strides(); + auto pads_begin = op->get_pads_begin(); + auto pads_end = op->get_pads_end(); + auto dilations = op->get_dilations(); + + // Extend 1d vectors to 2d as 1d can't be handled properly by the graph optimizer for now + kernel.resize(std::max(2, kernel.size()), 1); + strides.resize(std::max(2, strides.size()), 1); + pads_begin.resize(std::max(2, pads_begin.size()), 0); + pads_end.resize(std::max(2, pads_end.size()), 0); + dilations.resize(std::max(2, dilations.size()), 1); + auto poolPrim = cldnn::pooling(layerName, inputPrimitives[0], inputPrimitives.back(), - params.kernel, - params.stride, - params.dilation, - params.pad_begin, - params.pad_end, + kernel, + strides, + dilations, + pads_begin, + pads_end, op->get_axis(), DataTypeFromPrecision(op->get_index_element_type()), tensor_from_dims(op->get_output_shape(0)), diff --git a/src/plugins/intel_gpu/tests/fusions/binary_convolution_fusion_test.cpp b/src/plugins/intel_gpu/tests/fusions/binary_convolution_fusion_test.cpp index a45293a581a..524d2b21521 100644 --- a/src/plugins/intel_gpu/tests/fusions/binary_convolution_fusion_test.cpp +++ b/src/plugins/intel_gpu/tests/fusions/binary_convolution_fusion_test.cpp @@ -22,9 +22,9 @@ struct binary_convolution_test_params { tensor in_shape; tensor out_shape; tensor kernel; - tensor stride; - tensor pad; - tensor dilation; + ov::Strides stride; + ov::CoordinateDiff pad; + ov::Strides dilation; uint32_t groups; data_types data_type; format input_format; @@ -60,7 +60,7 @@ public: layout get_input_layout(binary_convolution_test_params& p) { auto pad = p.pad; - std::vector pad_ = { 0, 0, pad.spatial[0], pad.spatial[1] }; + std::vector pad_ = { 0, 0, static_cast(pad[1]), static_cast(pad[0]) }; return layout{ p.data_type, p.input_format, p.in_shape, padding{ pad_ } }; } @@ -71,9 +71,9 @@ public: } // namespace -#define CASE_BIN_CONV1 { 1, 16, 4, 5 }, { 1, 16, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 1, data_types::bin, format::b_fs_yx_32fp, data_types::bin, format::os_is_yx_osv32_isv32p, data_types::f32, format::bfyx -#define CASE_BIN_CONV2 { 1, 16, 4, 5 }, { 1, 30, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::bin, format::b_fs_yx_32fp, data_types::bin, format::os_is_yx_osv32_isv32p, data_types::f32, format::bfyx -#define CASE_BIN_CONV3 { 1, 184, 12, 21 }, { 1, 224, 12, 21 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::bin, format::b_fs_yx_32fp, data_types::bin, format::os_is_yx_osv32_isv32p, data_types::f32, format::bfyx +#define CASE_BIN_CONV1 { 1, 16, 4, 5 }, { 1, 16, 4, 5 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 1, data_types::bin, format::b_fs_yx_32fp, data_types::bin, format::os_is_yx_osv32_isv32p, data_types::f32, format::bfyx +#define CASE_BIN_CONV2 { 1, 16, 4, 5 }, { 1, 30, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::bin, format::b_fs_yx_32fp, data_types::bin, format::os_is_yx_osv32_isv32p, data_types::f32, format::bfyx +#define CASE_BIN_CONV3 { 1, 184, 12, 21 }, { 1, 224, 12, 21 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::bin, format::b_fs_yx_32fp, data_types::bin, format::os_is_yx_osv32_isv32p, data_types::f32, format::bfyx /* ----------------------------------------------------------------------------------------------------- */ /* -------------------------------------- binary convolution cases ------------------------------------- */ @@ -170,7 +170,9 @@ TEST_P(conv_bin_scale_conv_dw, dw_kernel_3x3_stride2) { auto dw_tensor = cldnn::tensor(group(p.out_shape.feature[0]), batch(1), feature(1), spatial(3, 3)); auto dw_weights_layout = layout{ p.default_type, format::goiyx, dw_tensor }; - auto dw_stride = tensor{ 1, 1, 2, 2 }; + ov::Strides dw_stride = {2, 2}; + ov::Strides dw_dilation = {1, 1}; + ov::CoordinateDiff dw_pad = p.pad; create_topologies( input_layout("input", get_input_layout(p)), data("weights", get_mem(get_weights_layout(p), -127, 127)), @@ -178,7 +180,7 @@ TEST_P(conv_bin_scale_conv_dw, dw_kernel_3x3_stride2) { data("scale_data", get_mem(get_per_channel_layout(p), 1e-1f)), binary_convolution("bin_conv_prim", "input", { "weights" }, p.stride, p.pad, p.dilation, p.out_shape, p.groups), scale("scale", "bin_conv_prim", "scale_data"), - convolution("conv_dw", "scale", { "weights_dw" }, p.out_shape.feature[0], dw_stride, p.pad, p.dilation), + convolution("conv_dw", "scale", { "weights_dw" }, p.out_shape.feature[0], dw_stride, dw_pad, dw_dilation), reorder("reorder_bfyx", "conv_dw", p.default_format, data_types::f32) ); @@ -191,7 +193,9 @@ TEST_P(conv_bin_scale_conv_dw, dw_kernel_3x3_stride1) { auto dw_tensor = cldnn::tensor(group(p.out_shape.feature[0]), batch(1), feature(1), spatial(3, 3)); auto dw_weights_layout = layout{ p.default_type, format::goiyx, dw_tensor }; - auto dw_stride = tensor{ 1, 1, 1, 1 }; + ov::Strides dw_stride = {1, 1}; + ov::Strides dw_dilation = {1, 1}; + ov::CoordinateDiff dw_pad = p.pad; create_topologies( input_layout("input", get_input_layout(p)), data("weights", get_mem(get_weights_layout(p), -127, 127)), @@ -199,7 +203,7 @@ TEST_P(conv_bin_scale_conv_dw, dw_kernel_3x3_stride1) { data("scale_data", get_mem(get_per_channel_layout(p), 1e-1f)), binary_convolution("bin_conv_prim", "input", { "weights" }, p.stride, p.pad, p.dilation, p.out_shape, p.groups), scale("scale", "bin_conv_prim", "scale_data"), - convolution("conv_dw", "scale", { "weights_dw" }, p.out_shape.feature[0], dw_stride, p.pad, p.dilation), + convolution("conv_dw", "scale", { "weights_dw" }, p.out_shape.feature[0], dw_stride, dw_pad, dw_dilation), reorder("reorder_bfyx", "conv_dw", p.default_format, data_types::f32) ); @@ -218,7 +222,9 @@ TEST_P(conv_bin_scale_conv_dw_prelu, dw_kernel_3x3_stride2) { auto dw_tensor = cldnn::tensor(group(p.out_shape.feature[0]), batch(1), feature(1), spatial(3, 3)); auto dw_weights_layout = layout{ p.default_type, format::goiyx, dw_tensor }; - auto dw_stride = tensor{ 1, 1, 2, 2 }; + ov::Strides dw_stride = {2, 2}; + ov::Strides dw_dilation = {1, 1}; + ov::CoordinateDiff dw_pad = p.pad; auto in_thresh = get_mem(get_per_channel_layout(p), min_random, max_random); create_topologies( input_layout("input", get_input_layout(p)), @@ -227,7 +233,7 @@ TEST_P(conv_bin_scale_conv_dw_prelu, dw_kernel_3x3_stride2) { data("scale_data", get_mem(get_per_channel_layout(p), 1e-1f)), binary_convolution("bin_conv_prim", "input", { "weights" }, p.stride, p.pad, p.dilation, p.out_shape, p.groups), scale("scale", "bin_conv_prim", "scale_data"), - convolution("conv_dw", "scale", { "weights_dw" }, p.out_shape.feature[0], dw_stride, p.pad, p.dilation), + convolution("conv_dw", "scale", { "weights_dw" }, p.out_shape.feature[0], dw_stride, dw_pad, dw_dilation), data("slope_data", get_mem(get_per_channel_layout(p))), activation("activation", "conv_dw", "slope_data", activation_func::relu_negative_slope), reorder("reorder_bfyx", "activation", p.default_format, data_types::f32) @@ -242,7 +248,9 @@ TEST_P(conv_bin_scale_conv_dw_prelu, dw_kernel_3x3_stride1) { auto dw_tensor = cldnn::tensor(group(p.out_shape.feature[0]), batch(1), feature(1), spatial(3, 3)); auto dw_weights_layout = layout{ p.default_type, format::goiyx, dw_tensor }; - auto dw_stride = tensor{ 1, 1, 1, 1 }; + ov::Strides dw_stride = {1, 1}; + ov::Strides dw_dilation = {1, 1}; + ov::CoordinateDiff dw_pad = p.pad; auto in_thresh = get_mem(get_per_channel_layout(p), min_random, max_random); create_topologies( input_layout("input", get_input_layout(p)), @@ -251,7 +259,7 @@ TEST_P(conv_bin_scale_conv_dw_prelu, dw_kernel_3x3_stride1) { data("scale_data", get_mem(get_per_channel_layout(p), 1e-1f)), binary_convolution("bin_conv_prim", "input", { "weights" }, p.stride, p.pad, p.dilation, p.out_shape, p.groups), scale("scale", "bin_conv_prim", "scale_data"), - convolution("conv_dw", "scale", { "weights_dw" }, p.out_shape.feature[0], dw_stride, p.pad, p.dilation), + convolution("conv_dw", "scale", { "weights_dw" }, p.out_shape.feature[0], dw_stride, dw_pad, dw_dilation), data("slope_data", get_mem(get_per_channel_layout(p))), activation("activation", "conv_dw", "slope_data", activation_func::relu_negative_slope), reorder("reorder_bfyx", "activation", p.default_format, data_types::f32) diff --git a/src/plugins/intel_gpu/tests/fusions/convolution_fusion_test.cpp b/src/plugins/intel_gpu/tests/fusions/convolution_fusion_test.cpp index 044122a985d..e427323590b 100644 --- a/src/plugins/intel_gpu/tests/fusions/convolution_fusion_test.cpp +++ b/src/plugins/intel_gpu/tests/fusions/convolution_fusion_test.cpp @@ -28,9 +28,9 @@ struct convolution_test_params { tensor in_shape; tensor out_shape; tensor kernel; - tensor stride; - tensor pad; - tensor dilation; + ov::Strides stride; + ov::CoordinateDiff pad; + ov::Strides dilation; uint32_t groups; data_types data_type; format input_format; @@ -46,9 +46,9 @@ struct bc_force_kernel_params { tensor in_shape; tensor out_shape; tensor kernel; - tensor stride; - tensor pad; - tensor dilation; + ov::Strides stride; + ov::CoordinateDiff pad; + ov::Strides dilation; uint32_t groups; data_types data_type; format input_format; @@ -66,9 +66,9 @@ struct conv_eltw_test_params { tensor out_shape; tensor eltw_shape; tensor kernel; - tensor stride; - tensor pad; - tensor dilation; + ov::Strides stride; + ov::CoordinateDiff pad; + ov::Strides dilation; uint32_t groups; data_types data_type; format input_format; @@ -104,7 +104,7 @@ public: layout get_input_layout(convolution_test_params& p) { auto pad = p.pad; - std::vector pad_ = { 0, 0, pad.spatial[0], pad.spatial[1] }; + std::vector pad_ = { 0, 0, static_cast(pad[1]), static_cast(pad[0]) }; return layout{ p.data_type, p.input_format, p.in_shape, padding{ pad_ } }; } @@ -127,7 +127,7 @@ public: layout get_input_layout(convolution_test_params& p) { auto pad = p.pad; - std::vector pad_ = { 0, 0, pad.spatial[0], pad.spatial[1] }; + std::vector pad_ = { 0, 0, static_cast(pad[1]), static_cast(pad[0]) }; return layout{ p.data_type, p.input_format, p.in_shape, padding{ pad_ } }; } @@ -162,7 +162,7 @@ public: layout get_input_layout(conv_eltw_test_params& p) { auto pad = p.pad; - std::vector pad_ = { 0, 0, pad.spatial[0], pad.spatial[1] }; + std::vector pad_ = { 0, 0, static_cast(pad[1]), static_cast(pad[0]) }; return layout{ p.data_type, p.input_format, p.in_shape, padding{ pad_ } }; } @@ -200,7 +200,7 @@ class ConvFusingForceKernelTest : public BaseFusingTest layout get_input_layout(bc_force_kernel_params& p) { auto pad = p.pad; - std::vector pad_ = { 0, 0, pad.spatial[0], pad.spatial[1] }; + std::vector pad_ = { 0, 0, static_cast(pad[1]), static_cast(pad[0]) }; return layout{ p.data_type, p.input_format, p.in_shape, padding{ pad_ } }; } @@ -252,7 +252,7 @@ public: layout get_input_layout(convolution_test_params& p) { auto pad = p.pad; - std::vector pad_ = { 0, 0, pad.spatial[0], pad.spatial[1] }; + std::vector pad_ = { 0, 0, static_cast(pad[1]), static_cast(pad[0]) }; return layout{ p.data_type, p.input_format, p.in_shape, padding{ pad_ } }; } @@ -265,116 +265,95 @@ public: } // namespace // in_shape; out_shape; kernel; stride; pad; dilation; groups; data_type; input_format; weights_type; weights_format; default_type; default_format; -#define CASE_CONV_FP32_1 { 1, 15, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::oiyx, data_types::f32, format::bfyx -#define CASE_CONV_FP32_2 { 1, 16, 4, 5 }, { 1, 32, 2, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx -#define CASE_CONV_FP32_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx -#define CASE_CONV_FP32_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 32, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::gs_oiyx_gsv16, data_types::f32, format::bfyx -#define CASE_CONV_FP32_5 { 1, 15, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_FP32_6 { 1, 16, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_CONV_FP32_7 { 1, 16, 4, 5, 4 }, { 1, 32, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_CONV_FP32_8 { 1, 32, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_CONV_FP32_9 { 1, 32, 4, 5, 4 }, { 1, 32, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_CONV_FP32_10 { 32, 16, 4, 5, 4 }, { 32, 32, 4, 5, 4 }, { 1, 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bs_fs_zyx_bsv16_fsv16, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx -#define CASE_CONV_FP32_11 { 1, 32, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_CONV_FP32_12 { 1, 16, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_CONV_FP32_13 { 1, 16, 18, 5, 4 }, { 1, 16, 16, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_CONV_FP32_14 { 1, 3, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_FP32_1 { 1, 15, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::oiyx, data_types::f32, format::bfyx +#define CASE_CONV_FP32_2 { 1, 16, 4, 5 }, { 1, 32, 2, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx +#define CASE_CONV_FP32_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx +#define CASE_CONV_FP32_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 32, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::gs_oiyx_gsv16, data_types::f32, format::bfyx +#define CASE_CONV_FP32_5 { 1, 15, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_FP32_6 { 1, 16, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_CONV_FP32_7 { 1, 16, 4, 5, 4 }, { 1, 32, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_CONV_FP32_8 { 1, 32, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_CONV_FP32_9 { 1, 32, 4, 5, 4 }, { 1, 32, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_CONV_FP32_10 { 32, 16, 4, 5, 4 }, { 32, 32, 4, 5, 4 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f32, format::bs_fs_zyx_bsv16_fsv16, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx +#define CASE_CONV_FP32_11 { 1, 32, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_CONV_FP32_12 { 1, 16, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_CONV_FP32_13 { 1, 16, 18, 5, 4 }, { 1, 16, 16, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_CONV_FP32_14 { 1, 3, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_FP16_1 { 1, 15, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::bfyx, data_types::f16, format::bfyx, data_types::f16, format::bfyx -#define CASE_CONV_FP16_2 { 1, 16, 4, 5 }, { 1, 32, 2, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::os_is_yx_isv16_osv16, data_types::f16, format::bfyx -#define CASE_CONV_FP16_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::os_is_yx_isv16_osv16, data_types::f16, format::bfyx -#define CASE_CONV_FP16_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 32, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::gs_oiyx_gsv16, data_types::f16, format::bfyx -#define CASE_CONV_FP16_5 { 1, 15, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::bfyx, data_types::i8, format::bfyx, data_types::f16, format::bfyx -#define CASE_CONV_FP16_6 { 1, 16, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::os_is_zyx_isv16_osv16, data_types::f16, format::bfzyx -#define CASE_CONV_FP16_7 { 1, 16, 4, 5, 4 }, { 1, 32, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::os_is_zyx_isv16_osv16, data_types::f16, format::bfzyx -#define CASE_CONV_FP16_8 { 1, 32, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 2, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::g_os_is_zyx_isv16_osv16, data_types::f16, format::bfzyx -#define CASE_CONV_FP16_9 { 1, 32, 4, 5, 4 }, { 1, 32, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 2, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::g_os_is_zyx_isv16_osv16, data_types::f16, format::bfzyx -#define CASE_CONV_FP16_10 { 32, 16, 4, 5, 4 }, { 32, 32, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::bs_fs_zyx_bsv16_fsv16, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx -#define CASE_CONV_FP16_11 { 1, 32, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 2, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::g_os_is_zyx_isv16_osv16, data_types::f16, format::bfzyx -#define CASE_CONV_FP16_12 { 1, 16, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 2, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::g_os_is_zyx_isv16_osv16, data_types::f16, format::bfzyx -#define CASE_CONV_FP16_13 { 16, 32, 4, 5 }, { 16, 64, 2, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::fs_b_yx_fsv32, data_types::f16, format::bfyx, data_types::f16, format::bfyx +#define CASE_CONV_FP16_1 { 1, 15, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f16, format::bfyx, data_types::f16, format::bfyx, data_types::f16, format::bfyx +#define CASE_CONV_FP16_2 { 1, 16, 4, 5 }, { 1, 32, 2, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::os_is_yx_isv16_osv16, data_types::f16, format::bfyx +#define CASE_CONV_FP16_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::os_is_yx_isv16_osv16, data_types::f16, format::bfyx +#define CASE_CONV_FP16_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 32, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::gs_oiyx_gsv16, data_types::f16, format::bfyx +#define CASE_CONV_FP16_5 { 1, 15, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f16, format::bfyx, data_types::i8, format::bfyx, data_types::f16, format::bfyx +#define CASE_CONV_FP16_6 { 1, 16, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::os_is_zyx_isv16_osv16, data_types::f16, format::bfzyx +#define CASE_CONV_FP16_7 { 1, 16, 4, 5, 4 }, { 1, 32, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::os_is_zyx_isv16_osv16, data_types::f16, format::bfzyx +#define CASE_CONV_FP16_8 { 1, 32, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 2, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::g_os_is_zyx_isv16_osv16, data_types::f16, format::bfzyx +#define CASE_CONV_FP16_9 { 1, 32, 4, 5, 4 }, { 1, 32, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 2, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::g_os_is_zyx_isv16_osv16, data_types::f16, format::bfzyx +#define CASE_CONV_FP16_10 { 32, 16, 4, 5, 4 }, { 32, 32, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f16, format::bs_fs_zyx_bsv16_fsv16, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx +#define CASE_CONV_FP16_11 { 1, 32, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 2, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::g_os_is_zyx_isv16_osv16, data_types::f16, format::bfzyx +#define CASE_CONV_FP16_12 { 1, 16, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 2, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::g_os_is_zyx_isv16_osv16, data_types::f16, format::bfzyx +#define CASE_CONV_FP16_13 { 16, 32, 4, 5 }, { 16, 64, 2, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f16, format::fs_b_yx_fsv32, data_types::f16, format::bfyx, data_types::f16, format::bfyx -#define CASE_CONV_U8S8_1 { 1, 15, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_2 { 1, 15, 5, 5 }, { 1, 30, 3, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_4 { 1, 17, 4, 5 }, { 1, 17, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 17, data_types::u8, format::bfyx, data_types::i8, format::goiyx, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_5 { 1, 16, 5, 5 }, { 1, 32, 5, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_6 { 1, 17, 4, 5 }, { 1, 17, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 17, data_types::u8, format::bfyx, data_types::i8, format::goiyx, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_7 { 1, 64, 7, 7 }, { 1, 32, 7, 7 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_8 { 1, 3, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_9 { 16, 32, 5, 5 }, { 16, 32, 3, 3 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bs_fs_yx_bsv16_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_10 { 16, 32, 5, 5 }, { 16, 32, 3, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bs_fs_yx_bsv16_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_11 { 32, 15, 4, 5 }, { 32, 30, 2, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_12 { 32, 15, 5, 5 }, { 32, 30, 3, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_13 { 32, 16, 4, 5 }, { 32, 32, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_14 { 32, 17, 4, 5 }, { 32, 17, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 17, data_types::u8, format::bfyx, data_types::i8, format::goiyx, data_types::f32, format::bfyx -#define CASE_CONV_U8S8_15 { 1, 15, 2, 2 }, { 1, 30, 1, 1 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_1 { 1, 15, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_2 { 1, 15, 5, 5 }, { 1, 30, 3, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_4 { 1, 17, 4, 5 }, { 1, 17, 4, 5 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 17, data_types::u8, format::bfyx, data_types::i8, format::goiyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_5 { 1, 16, 5, 5 }, { 1, 32, 5, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_6 { 1, 17, 4, 5 }, { 1, 17, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 17, data_types::u8, format::bfyx, data_types::i8, format::goiyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_7 { 1, 64, 7, 7 }, { 1, 32, 7, 7 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_8 { 1, 3, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_9 { 16, 32, 5, 5 }, { 16, 32, 3, 3 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::bs_fs_yx_bsv16_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_10 { 16, 32, 5, 5 }, { 16, 32, 3, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::bs_fs_yx_bsv16_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_11 { 32, 15, 4, 5 }, { 32, 30, 2, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_12 { 32, 15, 5, 5 }, { 32, 30, 3, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_13 { 32, 16, 4, 5 }, { 32, 32, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_14 { 32, 17, 4, 5 }, { 32, 17, 4, 5 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 17, data_types::u8, format::bfyx, data_types::i8, format::goiyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_15 { 1, 15, 2, 2 }, { 1, 30, 1, 1 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_1 { 1, 15, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_2 { 1, 15, 5, 5 }, { 1, 30, 3, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_4 { 1, 17, 4, 5 }, { 1, 17, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 17, data_types::i8, format::bfyx, data_types::i8, format::goiyx, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_5 { 1, 16, 5, 5 }, { 1, 32, 5, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_6 { 1, 17, 4, 5 }, { 1, 17, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 17, data_types::i8, format::bfyx, data_types::i8, format::goiyx, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_7 { 1, 64, 7, 7 }, { 1, 32, 7, 7 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_8 { 1, 3, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_9 { 16, 32, 5, 5 }, { 16, 32, 3, 3 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bs_fs_yx_bsv16_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_10 { 16, 32, 5, 5 }, { 16, 32, 3, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bs_fs_yx_bsv16_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_11 { 1, 4, 1280, 720 }, { 1, 4, 1280, 720 }, { 1, 1, 5, 5 }, tensor{ 1 }, tensor{ { 0, 0, 2, 2 }, 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_yx_fsv4, data_types::i8, format::os_is_yx_osv16_isv4, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_12 { 32, 15, 4, 5 }, { 32, 30, 2, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_13 { 32, 15, 5, 5 }, { 32, 30, 3, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_14 { 32, 16, 4, 5 }, { 32, 32, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx -#define CASE_CONV_S8S8_15 { 32, 17, 4, 5 }, { 32, 17, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 17, data_types::i8, format::bfyx, data_types::i8, format::goiyx, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_1 { 1, 15, 4, 5 }, { 1, 30, 2, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_2 { 1, 15, 5, 5 }, { 1, 30, 3, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_4 { 1, 17, 4, 5 }, { 1, 17, 4, 5 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 17, data_types::i8, format::bfyx, data_types::i8, format::goiyx, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_5 { 1, 16, 5, 5 }, { 1, 32, 5, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_6 { 1, 17, 4, 5 }, { 1, 17, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 17, data_types::i8, format::bfyx, data_types::i8, format::goiyx, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_7 { 1, 64, 7, 7 }, { 1, 32, 7, 7 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_8 { 1, 3, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_9 { 16, 32, 5, 5 }, { 16, 32, 3, 3 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::bs_fs_yx_bsv16_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_10 { 16, 32, 5, 5 }, { 16, 32, 3, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::bs_fs_yx_bsv16_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_11 { 1, 4, 1280, 720 }, { 1, 4, 1280, 720 }, { 1, 1, 5, 5 }, { 1, 1 }, { 2, 2 }, { 1, 1 }, 1, data_types::i8, format::b_fs_yx_fsv4, data_types::i8, format::os_is_yx_osv16_isv4, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_12 { 32, 15, 4, 5 }, { 32, 30, 2, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_13 { 32, 15, 5, 5 }, { 32, 30, 3, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_14 { 32, 16, 4, 5 }, { 32, 32, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_S8S8_15 { 32, 17, 4, 5 }, { 32, 17, 4, 5 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 17, data_types::i8, format::bfyx, data_types::i8, format::goiyx, data_types::f32, format::bfyx -#define CASE_CONV3D_U8S8_1 { 1, 15, 5, 4, 5 }, { 1, 30, 3, 2, 3 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx -#define CASE_CONV3D_U8S8_2 { 1, 15, 5, 5, 5 }, { 1, 30, 3, 3, 3 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx -#define CASE_CONV3D_U8S8_3 { 1, 16, 5, 4, 5 }, { 1, 32, 5, 4, 5 }, { 1, 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx -#define CASE_CONV3D_U8S8_4 { 1, 17, 5, 4, 5 }, { 1, 17, 5, 4, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 1 }, 0 }, tensor{ 1 }, 17, data_types::u8, format::bfzyx, data_types::i8, format::goizyx, data_types::f32, format::bfzyx -#define CASE_CONV3D_U8S8_5 { 1, 3, 5, 4, 5 }, { 1, 32, 5, 4, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 1 }, 0 }, tensor{ 1 }, 1, data_types::u8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx +#define CASE_CONV3D_U8S8_1 { 1, 15, 5, 4, 5 }, { 1, 30, 3, 2, 3 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::u8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx +#define CASE_CONV3D_U8S8_2 { 1, 15, 5, 5, 5 }, { 1, 30, 3, 3, 3 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::u8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx +#define CASE_CONV3D_U8S8_3 { 1, 16, 5, 4, 5 }, { 1, 32, 5, 4, 5 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::u8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx +#define CASE_CONV3D_U8S8_4 { 1, 17, 5, 4, 5 }, { 1, 17, 5, 4, 5 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, 17, data_types::u8, format::bfzyx, data_types::i8, format::goizyx, data_types::f32, format::bfzyx +#define CASE_CONV3D_U8S8_5 { 1, 3, 5, 4, 5 }, { 1, 32, 5, 4, 5 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, 1, data_types::u8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx -#define CASE_CONV3D_S8S8_1 { 1, 15, 5, 4, 5 }, { 1, 30, 3, 2, 3 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx -#define CASE_CONV3D_S8S8_2 { 1, 15, 5, 5, 5 }, { 1, 30, 3, 3, 3 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx -#define CASE_CONV3D_S8S8_3 { 1, 16, 5, 4, 5 }, { 1, 32, 5, 4, 5 }, { 1, 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx -#define CASE_CONV3D_S8S8_4 { 1, 17, 5, 4, 5 }, { 1, 17, 5, 4, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 1 }, 0 }, tensor{ 1 }, 17, data_types::i8, format::bfzyx, data_types::i8, format::goizyx, data_types::f32, format::bfzyx -#define CASE_CONV3D_S8S8_5 { 1, 3, 5, 4, 5 }, { 1, 18, 5, 4, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 1 }, 0 }, tensor{ 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx +#define CASE_CONV3D_S8S8_1 { 1, 15, 5, 4, 5 }, { 1, 30, 3, 2, 3 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx +#define CASE_CONV3D_S8S8_2 { 1, 15, 5, 5, 5 }, { 1, 30, 3, 3, 3 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx +#define CASE_CONV3D_S8S8_3 { 1, 16, 5, 4, 5 }, { 1, 32, 5, 4, 5 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx +#define CASE_CONV3D_S8S8_4 { 1, 17, 5, 4, 5 }, { 1, 17, 5, 4, 5 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, 17, data_types::i8, format::bfzyx, data_types::i8, format::goizyx, data_types::f32, format::bfzyx +#define CASE_CONV3D_S8S8_5 { 1, 3, 5, 4, 5 }, { 1, 18, 5, 4, 5 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::bfzyx, data_types::f32, format::bfzyx // in_shape; out_shape; eltw_shape; kernel; stride; pad; dilation; groups; data_type; input_format; weights_type; weights_format; default_type; default_format; -#define CASE_CONV_ELTW_FP32_1 { 1, 16, 4, 5 }, { 1, 32, 2, 3 }, { 1, 32, 1, 1 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::oiyx, data_types::f32, format::bfyx -#define CASE_CONV_ELTW_FP32_2 { 1, 16, 4, 5 }, { 1, 32, 2, 3 }, { 1, 1, 1, 1 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx -#define CASE_CONV_ELTW_FP32_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx -#define CASE_CONV_ELTW_FP32_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 32, 1, 1 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 32, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::gs_oiyx_gsv16, data_types::f32, format::bfyx -#define CASE_CONV_ELTW_FP32_5 { 1, 32, 4, 5, 4 }, { 1, 32, 2, 3, 2 }, { 1, 32, 2, 1, 1 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_CONV_ELTW_FP32_6 { 1, 32, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 16, 2, 1, 1 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_CONV_ELTW_FP32_7 { 1, 16, 3, 5 }, { 1, 32, 1, 3 }, { 1, 32, 3, 1 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx -#define CASE_CONV_ELTW_FP32_8 { 1, 32, 3, 5, 4 }, { 1, 16, 1, 3, 2 }, { 1, 1, 2, 1, 1 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_CONV_ELTW_FP32_1 { 1, 16, 4, 5 }, { 1, 32, 2, 3 }, { 1, 32, 1, 1 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::oiyx, data_types::f32, format::bfyx +#define CASE_CONV_ELTW_FP32_2 { 1, 16, 4, 5 }, { 1, 32, 2, 3 }, { 1, 1, 1, 1 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx +#define CASE_CONV_ELTW_FP32_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx +#define CASE_CONV_ELTW_FP32_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 32, 1, 1 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 32, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::gs_oiyx_gsv16, data_types::f32, format::bfyx +#define CASE_CONV_ELTW_FP32_5 { 1, 32, 4, 5, 4 }, { 1, 32, 2, 3, 2 }, { 1, 32, 2, 1, 1 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_CONV_ELTW_FP32_6 { 1, 32, 4, 5, 4 }, { 1, 16, 2, 3, 2 }, { 1, 16, 2, 1, 1 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_CONV_ELTW_FP32_7 { 1, 16, 3, 5 }, { 1, 32, 1, 3 }, { 1, 32, 3, 1 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx +#define CASE_CONV_ELTW_FP32_8 { 1, 32, 3, 5, 4 }, { 1, 16, 1, 3, 2 }, { 1, 1, 2, 1, 1 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_CONV_ELTW_i8_1 { 1, 16, 3, 5 }, { 1, 32, 1, 3 }, { 1, 32, 3, 1 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx -#define CASE_CONV_ELTW_i8_2 { 1, 16, 3, 5, 3 }, { 1, 32, 2, 4, 2 }, { 1, 1, 2, 4, 2 }, { 1, 1, 2, 2, 2 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oiyx, data_types::f32, format::bfzyx -#define CASE_CONV_ELTW_i8_3 { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oiyx, data_types::f32, format::bfzyx -#define CASE_CONV_ELTW_i8_4 { 1, 16, 1, 4 }, { 1, 16, 1, 2 }, { 1, 16, 1, 1 }, { 1, 1, 1, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx -#define CASE_CONV_ELTW_i8_5 { 1, 16, 1, 4, 1 }, { 1, 16, 1, 2, 1 }, { 1, 16, 2, 1, 1 }, { 1, 1, 1, 3, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oiyx, data_types::f32, format::bfzyx - -#define CASE_BIN_CONV1 { 1, 16, 4, 5 }, { 1, 16, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 1, data_types::bin, format::b_fs_yx_32fp, data_types::bin, format::os_is_yx_osv32_isv32p, data_types::f32, format::bfyx -#define CASE_BIN_CONV2 { 1, 16, 4, 5 }, { 1, 30, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::bin, format::b_fs_yx_32fp, data_types::bin, format::os_is_yx_osv32_isv32p, data_types::f32, format::bfyx -#define CASE_BIN_CONV3 { 1, 184, 12, 21 }, { 1, 224, 12, 21 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::bin, format::b_fs_yx_32fp, data_types::bin, format::os_is_yx_osv32_isv32p, data_types::f32, format::bfyx - -#define CASE_FC_FP32_1 { 1, 1, 3, 1 }, { 1, 4, 1, 1 }, { 4, 1, 3, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::oiyx, data_types::f32, format::bfyx -#define CASE_FC_FP32_2 { 2, 1, 3, 1 }, { 2, 4, 1, 1 }, { 4, 1, 3, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::yxfb, data_types::f32, format::oiyx, data_types::f32, format::bfyx -#define CASE_FC_FP32_3 { 2, 32, 1, 1 }, { 2, 16, 1, 1 }, { 16, 32, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_FC_FP32_3D_1 { 5, 3, 1, 3 }, { 5, 3, 1, 5 }, { 5, 3, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::os_iyx_osv16, data_types::f32, format::bfyx -#define CASE_FC_FP32_3D_2 { 2, 1, 1, 1 }, { 2, 1, 1, 32 }, { 32, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::os_iyx_osv16, data_types::f32, format::bfyx -#define CASE_FC_FP32_3D_3 { 2, 32, 1, 32 }, { 2, 32, 1, 16 }, { 16, 32, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::os_iyx_osv16, data_types::f32, format::bfyx - -#define CASE_FC_U8S8_1 { 1, 1, 3, 1 }, { 1, 4, 1, 1 }, { 4, 1, 3, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_FC_U8S8_2 { 2, 1, 3, 1 }, { 2, 4, 1, 1 }, { 4, 1, 3, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::b_fs_yx_fsv4, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_FC_U8S8_3 { 2, 32, 1, 1 }, { 2, 16, 1, 1 }, { 16, 32, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::b_fs_yx_fsv4, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_FC_U8S8_3D_1 { 2, 32, 1, 3 }, { 2, 32, 1, 16 }, { 16, 3, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_FC_U8S8_3D_2 { 1, 1, 1, 3 }, { 1, 1, 1, 32 }, { 32, 3, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_FC_U8S8_3D_3 { 2, 3, 1, 1 }, { 2, 3, 1, 15 }, { 15, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_FC_U8S8_3D_4 { 1, 512, 1, 1024 }, { 1, 384, 1, 1024 }, { 1024, 1024, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx - -#define CASE_NORMALIZE_I8_1 { 1, 2, 3, 3 }, data_types::u8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_ELTW_i8_1 { 1, 16, 3, 5 }, { 1, 32, 1, 3 }, { 1, 32, 3, 1 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx +#define CASE_CONV_ELTW_i8_2 { 1, 16, 3, 5, 3 }, { 1, 32, 2, 4, 2 }, { 1, 1, 2, 4, 2 }, { 1, 1, 2, 2, 2 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oiyx, data_types::f32, format::bfzyx +#define CASE_CONV_ELTW_i8_3 { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oiyx, data_types::f32, format::bfzyx +#define CASE_CONV_ELTW_i8_4 { 1, 16, 1, 4 }, { 1, 16, 1, 2 }, { 1, 16, 1, 1 }, { 1, 1, 1, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx +#define CASE_CONV_ELTW_i8_5 { 1, 16, 1, 4, 1 }, { 1, 16, 1, 2, 1 }, { 1, 16, 2, 1, 1 }, { 1, 1, 1, 3, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oiyx, data_types::f32, format::bfzyx /* ----------------------------------------------------------------------------------------------------- */ /* ---------------------------------------- FP32 convolution cases ------------------------------------- */ @@ -417,7 +396,7 @@ TEST_P(conv_fp32_reorder_fsv16_to_bfyx_conv, basic) { auto dw_tensor = cldnn::tensor(group(p.out_shape.feature[0]), batch(1), feature(1), spatial(3, 3)); auto dw_weights_layout = layout{ p.default_type, format::goiyx, dw_tensor }; - auto dw_stride = tensor{ 0, 0, 1, 1 }; + ov::Strides dw_stride = { 1, 1 }; create_topologies( input_layout("input", get_input_layout(p)), @@ -2570,7 +2549,7 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, conv_fp16_scale, ::testing::ValuesIn(std:: /* ----------------------------------------------------------------------------------------------------- */ /* ---------------------- reorder(bfyx to fs_b_yx_fsv32) + convolution kernel cases -------------------- */ /* ----------------------------------------------------------------------------------------------------- */ -#define FSV32_CASE_CONV_FP32_1 { 1, 32, 4, 5 }, { 1, 32, 2, 3 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::oiyx, data_types::f32, format::bfyx +#define FSV32_CASE_CONV_FP32_1 { 1, 32, 4, 5 }, { 1, 32, 2, 3 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::oiyx, data_types::f32, format::bfyx // 'reorder_fsv32' is being removed from "remove_redundant_reorders" in the current impl class conv_fp32_reorder_bfyx_to_fsv32_conv_basic : public ConvReorderFusingTest {}; @@ -2581,7 +2560,7 @@ TEST_P(conv_fp32_reorder_bfyx_to_fsv32_conv_basic, basic) { input_layout("input", get_input_layout(p)), data("weights", get_mem(get_weights_layout(p), -127, 127)), reorder("reorder_fsv32", "input", format::fs_b_yx_fsv32, data_types::f32), - convolution("conv_prim", "reorder_fsv32", { "weights" }, 1, tensor{ 0, 0, 1, 1 }, p.pad, p.dilation), + convolution("conv_prim", "reorder_fsv32", { "weights" }, 1, { 1, 1 }, p.pad, p.dilation), activation("activation", "conv_prim", activation_func::abs), reorder("reorder_out", "activation", format::bfyx, data_types::f32) ); @@ -2607,7 +2586,7 @@ TEST_P(conv_fp32_reorder_bfyx_to_fsv32_conv_mean, have_mean) { data("mul", mul), data("weights", get_mem(get_weights_layout(p), -127, 127)), reorder("reorder_fsv32", "input", format::fs_b_yx_fsv32, data_types::f32, "mul", reorder_mean_mode::mul), - convolution("conv_prim", "reorder_fsv32", { "weights" }, 1, tensor{ 0, 0, 1, 1 }, p.pad, p.dilation), + convolution("conv_prim", "reorder_fsv32", { "weights" }, 1, { 1, 1 }, p.pad, p.dilation), activation("activation", "conv_prim", activation_func::abs) ); @@ -2633,7 +2612,7 @@ TEST_P(conv_fp32_reorder_bfyx_to_fsv32_conv_subtract, have_subtract_per_feature) auto dw_tensor = cldnn::tensor(group(p.out_shape.feature[0]), batch(1), feature(1), spatial(2, 2)); auto dw_weights_layout = layout{ p.default_type, format::goiyx, dw_tensor }; - auto dw_stride = tensor{ 0, 0, 1, 1 }; + ov::Strides dw_stride = { 1, 1 }; create_topologies( input_layout("input", get_input_layout(p)), @@ -2660,7 +2639,7 @@ TEST_P(conv_fp32_reorder_bfyx_to_fsv32_conv_fused_activation, have_fused_activat auto dw_tensor = cldnn::tensor(group(p.out_shape.feature[0]), batch(1), feature(1), spatial(2, 2)); auto dw_weights_layout = layout{ p.default_type, format::goiyx, dw_tensor }; - auto dw_stride = tensor{ 0, 0, 1, 1 }; + ov::Strides dw_stride = { 1, 1 }; create_topologies( input_layout("input", get_input_layout(p)), @@ -2690,7 +2669,7 @@ TEST_P(conv_fp32_reorder_bfyx_to_fsv32_conv_data_padding, have_data_padding) { auto dw_tensor = cldnn::tensor(group(p.out_shape.feature[0]), batch(1), feature(1), spatial(2, 2)); auto dw_weights_layout = layout{ p.default_type, format::goiyx, dw_tensor }; - auto dw_stride = tensor{ 0, 0, 1, 1 }; + ov::Strides dw_stride = { 1, 1 }; create_topologies( input_layout("input", get_input_layout(p)), @@ -3459,7 +3438,7 @@ TEST_P(post_ops_optimizations_onednn_binary_add_full_tensor, basic) { } // in_shape; out_shape; kernel; stride; pad; dilation; groups; data_type; input_format; weights_type; weights_format; default_type; default_format; -#define CASE_CONV_U8S8_FT_BINARY_ADD_1 { 1, 32, 4, 4 }, { 1, 16, 4, 4 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0, 0, 1, 1, 0 }, tensor{ 1 }, 1, data_types::u8, format::b_fs_yx_fsv32, data_types::i8, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_U8S8_FT_BINARY_ADD_1 { 1, 32, 4, 4 }, { 1, 16, 4, 4 }, tensor{ 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 1, data_types::u8, format::b_fs_yx_fsv32, data_types::i8, format::bfyx, data_types::f32, format::bfyx INSTANTIATE_TEST_SUITE_P(fusings_gpu, post_ops_optimizations_onednn_binary_add_full_tensor, ::testing::ValuesIn(std::vector{ // cases with batch = 1 @@ -3488,7 +3467,7 @@ TEST_P(post_ops_optimizations_onednn_sum_full_tensor, basic) { execute(p); } -#define CASE_CONV_F16F16_FT_ELTW_SUM_1 { 1, 32, 4, 4 }, { 1, 16, 4, 4 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0, 0, 1, 1, 0 }, tensor{ 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::bfyx, data_types::f32, format::bfyx +#define CASE_CONV_F16F16_FT_ELTW_SUM_1 { 1, 32, 4, 4 }, { 1, 16, 4, 4 }, tensor{ 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::bfyx, data_types::f32, format::bfyx INSTANTIATE_TEST_SUITE_P(fusings_gpu, post_ops_optimizations_onednn_sum_full_tensor, ::testing::ValuesIn(std::vector{ // cases with batch = 1 diff --git a/src/plugins/intel_gpu/tests/fusions/deconvolution_fusion_test.cpp b/src/plugins/intel_gpu/tests/fusions/deconvolution_fusion_test.cpp index 5a2effbbf82..c870e49f450 100644 --- a/src/plugins/intel_gpu/tests/fusions/deconvolution_fusion_test.cpp +++ b/src/plugins/intel_gpu/tests/fusions/deconvolution_fusion_test.cpp @@ -21,9 +21,9 @@ struct deconv_test_params { tensor in_shape; tensor out_shape; tensor kernel; - tensor stride; - tensor pad; - tensor dilation; + ov::Strides stride; + ov::CoordinateDiff pad; + ov::Strides dilation; uint32_t groups; data_types data_type; format input_format; @@ -40,9 +40,9 @@ struct deconv_eltw_test_params { tensor out_shape; tensor eltw_shape; tensor kernel; - tensor stride; - tensor pad; - tensor dilation; + ov::Strides stride; + ov::CoordinateDiff pad; + ov::Strides dilation; uint32_t groups; data_types data_type; format input_format; @@ -78,7 +78,7 @@ public: layout get_input_layout(deconv_test_params& p) { auto pad = p.pad; - std::vector pad_ = { 0, 0, pad.spatial[0], pad.spatial[1] }; + std::vector pad_ = { 0, 0, static_cast(pad[1]), static_cast(pad[0]) }; return layout{ p.data_type, p.input_format, p.in_shape, padding{ pad_ } }; } @@ -113,7 +113,7 @@ public: layout get_input_layout(deconv_eltw_test_params& p) { auto pad = p.pad; - std::vector pad_ = { 0, 0, pad.spatial[0], pad.spatial[1] }; + std::vector pad_ = { 0, 0, static_cast(pad[1]), static_cast(pad[0]) }; return layout{ p.data_type, p.input_format, p.in_shape, padding{ pad_ } }; } @@ -128,97 +128,97 @@ public: /* ----------------------------------------------------------------------------------------------------- */ // in_shape; out_shape; kernel; stride; pad; dilation; groups; data_type; input_format; weights_type; weights_format; default_type; default_format; -#define CASE_DECONV_FP32_1 { 1, 15, 4, 5 }, { 1, 30, 6, 7 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_FP32_2 { 1, 16, 4, 5 }, { 1, 32, 6, 7 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::is_os_yx_isv16_osv16, data_types::f32, format::bfyx -#define CASE_DECONV_FP32_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::is_os_yx_isv16_osv16, data_types::f32, format::bfyx -#define CASE_DECONV_FP32_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 32, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::gs_oiyx_gsv16, data_types::f32, format::bfyx -#define CASE_DECONV_FP32_5 { 1, 15, 4, 5 }, { 1, 30, 9, 11 }, { 1, 1, 3, 3 }, tensor{ 1, 1, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_FP32_6 { 1, 16, 4, 5 }, { 1, 32, 9, 11 }, { 1, 1, 3, 3 }, tensor{ 1, 1, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::is_os_yx_isv16_osv16, data_types::f32, format::bfyx -#define CASE_DECONV_FP32_7 { 1, 16, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 1, 1 }, tensor{ 1, 1, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::is_os_yx_isv16_osv16, data_types::f32, format::bfyx -#define CASE_DECONV_FP32_8 { 1, 32, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 3, 3 }, tensor{ 1, 1, 2, 2 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 32, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::gs_oiyx_gsv16, data_types::f32, format::bfyx +#define CASE_DECONV_FP32_1 { 1, 15, 4, 5 }, { 1, 30, 6, 7 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_FP32_2 { 1, 16, 4, 5 }, { 1, 32, 6, 7 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::is_os_yx_isv16_osv16, data_types::f32, format::bfyx +#define CASE_DECONV_FP32_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::is_os_yx_isv16_osv16, data_types::f32, format::bfyx +#define CASE_DECONV_FP32_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 32, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::gs_oiyx_gsv16, data_types::f32, format::bfyx +#define CASE_DECONV_FP32_5 { 1, 15, 4, 5 }, { 1, 30, 9, 11 }, { 1, 1, 3, 3 }, { 2, 2 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_FP32_6 { 1, 16, 4, 5 }, { 1, 32, 9, 11 }, { 1, 1, 3, 3 }, { 2, 2 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::is_os_yx_isv16_osv16, data_types::f32, format::bfyx +#define CASE_DECONV_FP32_7 { 1, 16, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 1, 1 }, { 2, 2 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::is_os_yx_isv16_osv16, data_types::f32, format::bfyx +#define CASE_DECONV_FP32_8 { 1, 32, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 3, 3 }, { 2, 2 }, { 1, 1 }, { 1, 1 }, 32, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::gs_oiyx_gsv16, data_types::f32, format::bfyx -#define CASE_DECONV_FP16_1 { 1, 15, 4, 5 }, { 1, 30, 6, 7 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::bfyx, data_types::f16, format::oiyx, data_types::f16, format::bfyx -#define CASE_DECONV_FP16_2 { 1, 16, 4, 5 }, { 1, 32, 6, 7 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::is_os_yx_isv16_osv16, data_types::f16, format::bfyx -#define CASE_DECONV_FP16_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::is_os_yx_isv16_osv16, data_types::f16, format::bfyx -#define CASE_DECONV_FP16_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 32, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::gs_oiyx_gsv16, data_types::f16, format::bfyx -#define CASE_DECONV_FP16_5 { 1, 15, 4, 5 }, { 1, 30, 9, 11 }, { 1, 1, 3, 3 }, tensor{ 1, 1, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::bfyx, data_types::f16, format::oiyx, data_types::f16, format::bfyx -#define CASE_DECONV_FP16_6 { 1, 16, 4, 5 }, { 1, 32, 9, 11 }, { 1, 1, 3, 3 }, tensor{ 1, 1, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::is_os_yx_isv16_osv16, data_types::f16, format::bfyx -#define CASE_DECONV_FP16_7 { 1, 16, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 1, 1 }, tensor{ 1, 1, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::is_os_yx_isv16_osv16, data_types::f16, format::bfyx -#define CASE_DECONV_FP16_8 { 1, 32, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 3, 3 }, tensor{ 1, 1, 2, 2 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 32, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::gs_oiyx_gsv16, data_types::f16, format::bfyx +#define CASE_DECONV_FP16_1 { 1, 15, 4, 5 }, { 1, 30, 6, 7 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f16, format::bfyx, data_types::f16, format::oiyx, data_types::f16, format::bfyx +#define CASE_DECONV_FP16_2 { 1, 16, 4, 5 }, { 1, 32, 6, 7 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::is_os_yx_isv16_osv16, data_types::f16, format::bfyx +#define CASE_DECONV_FP16_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::is_os_yx_isv16_osv16, data_types::f16, format::bfyx +#define CASE_DECONV_FP16_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 32, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::gs_oiyx_gsv16, data_types::f16, format::bfyx +#define CASE_DECONV_FP16_5 { 1, 15, 4, 5 }, { 1, 30, 9, 11 }, { 1, 1, 3, 3 }, { 2, 2 }, { 0, 0 }, { 1, 1 }, 1, data_types::f16, format::bfyx, data_types::f16, format::oiyx, data_types::f16, format::bfyx +#define CASE_DECONV_FP16_6 { 1, 16, 4, 5 }, { 1, 32, 9, 11 }, { 1, 1, 3, 3 }, { 2, 2 }, { 0, 0 }, { 1, 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::is_os_yx_isv16_osv16, data_types::f16, format::bfyx +#define CASE_DECONV_FP16_7 { 1, 16, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 1, 1 }, { 2, 2 }, { 0, 0 }, { 1, 1 }, 1, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::is_os_yx_isv16_osv16, data_types::f16, format::bfyx +#define CASE_DECONV_FP16_8 { 1, 32, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 3, 3 }, { 2, 2 }, { 1, 1 }, { 1, 1 }, 32, data_types::f16, format::b_fs_yx_fsv16, data_types::f16, format::gs_oiyx_gsv16, data_types::f16, format::bfyx -#define CASE_DECONV_S8S8_1 { 1, 15, 4, 5 }, { 1, 30, 6, 7 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_S8S8_2 { 1, 16, 4, 5 }, { 1, 32, 6, 7 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_S8S8_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_S8S8_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1 }, 0 }, tensor{ 1 }, 32, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::goiyx, data_types::f32, format::bfyx -#define CASE_DECONV_S8S8_5 { 1, 15, 4, 5 }, { 1, 30, 9, 11 }, { 1, 1, 3, 3 }, tensor{ 1, 1, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_S8S8_6 { 1, 16, 4, 5 }, { 1, 32, 9, 11 }, { 1, 1, 3, 3 }, tensor{ 1, 1, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_S8S8_7 { 1, 16, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 1, 1 }, tensor{ 1, 1, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_S8S8_8 { 1, 32, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 3, 3 }, tensor{ 1, 1, 2, 2 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 32, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::goiyx, data_types::f32, format::bfyx +#define CASE_DECONV_S8S8_1 { 1, 15, 4, 5 }, { 1, 30, 6, 7 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_S8S8_2 { 1, 16, 4, 5 }, { 1, 32, 6, 7 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_S8S8_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_S8S8_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 32, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::goiyx, data_types::f32, format::bfyx +#define CASE_DECONV_S8S8_5 { 1, 15, 4, 5 }, { 1, 30, 9, 11 }, { 1, 1, 3, 3 }, { 2, 2 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_S8S8_6 { 1, 16, 4, 5 }, { 1, 32, 9, 11 }, { 1, 1, 3, 3 }, { 2, 2 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_S8S8_7 { 1, 16, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 1, 1 }, { 2, 2 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_S8S8_8 { 1, 32, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 3, 3 }, { 2, 2 }, { 1, 1 }, { 1, 1 }, 32, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::goiyx, data_types::f32, format::bfyx -#define CASE_DECONV_U8S8_1 { 1, 15, 4, 5 }, { 1, 30, 6, 7 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_U8S8_2 { 1, 16, 4, 5 }, { 1, 32, 6, 7 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_U8S8_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_U8S8_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1 }, 0 }, tensor{ 1 }, 32, data_types::u8, format::b_fs_yx_fsv16, data_types::i8, format::goiyx, data_types::f32, format::bfyx -#define CASE_DECONV_U8S8_5 { 1, 15, 4, 5 }, { 1, 30, 9, 11 }, { 1, 1, 3, 3 }, tensor{ 1, 1, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_U8S8_6 { 1, 16, 4, 5 }, { 1, 32, 9, 11 }, { 1, 1, 3, 3 }, tensor{ 1, 1, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_U8S8_7 { 1, 16, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 1, 1 }, tensor{ 1, 1, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_U8S8_8 { 1, 32, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 3, 3 }, tensor{ 1, 1, 2, 2 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 32, data_types::u8, format::b_fs_yx_fsv16, data_types::i8, format::goiyx, data_types::f32, format::bfyx +#define CASE_DECONV_U8S8_1 { 1, 15, 4, 5 }, { 1, 30, 6, 7 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_U8S8_2 { 1, 16, 4, 5 }, { 1, 32, 6, 7 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_U8S8_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_U8S8_4 { 1, 32, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 3, 3 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, 32, data_types::u8, format::b_fs_yx_fsv16, data_types::i8, format::goiyx, data_types::f32, format::bfyx +#define CASE_DECONV_U8S8_5 { 1, 15, 4, 5 }, { 1, 30, 9, 11 }, { 1, 1, 3, 3 }, { 2, 2 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::bfyx, data_types::i8, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_U8S8_6 { 1, 16, 4, 5 }, { 1, 32, 9, 11 }, { 1, 1, 3, 3 }, { 2, 2 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_U8S8_7 { 1, 16, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 1, 1 }, { 2, 2 }, { 0, 0 }, { 1, 1 }, 1, data_types::u8, format::b_fs_yx_fsv16, data_types::i8, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_U8S8_8 { 1, 32, 4, 5 }, { 1, 32, 7, 9 }, { 1, 1, 3, 3 }, { 2, 2 }, { 1, 1 }, { 1, 1 }, 32, data_types::u8, format::b_fs_yx_fsv16, data_types::i8, format::goiyx, data_types::f32, format::bfyx // 3D // in_shape; out_shape; kernel; stride; pad; dilation; groups; data_type; input_format; weights_type; weights_format; default_type; default_format; -#define CASE_DECONV_FP32_3D_1 { 1, 15, 4, 5, 3 }, { 1, 30, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfzyx, data_types::f32, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_FP32_3D_2 { 1, 16, 4, 5, 3 }, { 1, 32, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::is_os_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_DECONV_FP32_3D_3 { 1, 16, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::is_os_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_DECONV_FP32_3D_4 { 1, 32, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 1 }, 0 }, tensor{ 1 }, 32, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::gs_oizyx_gsv16, data_types::f32, format::bfzyx -#define CASE_DECONV_FP32_3D_5 { 1, 15, 4, 5, 3 }, { 1, 30, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfzyx, data_types::f32, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_FP32_3D_6 { 1, 16, 4, 5, 3 }, { 1, 32, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::is_os_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_DECONV_FP32_3D_7 { 1, 16, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 1, 1, 1 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::is_os_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_DECONV_FP32_3D_8 { 1, 32, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ { 0, 0, 1, 1, 1 }, 0 }, tensor{ 1 }, 32, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::gs_oizyx_gsv16, data_types::f32, format::bfzyx -#define CASE_DECONV_FP32_3D_9 { 16, 16, 4, 5, 3 }, { 16, 32, 7, 9, 5 }, { 1, 1, 1, 1, 1 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bs_fs_zyx_bsv16_fsv16, data_types::f32, format::is_os_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_DECONV_FP32_3D_1 { 1, 15, 4, 5, 3 }, { 1, 30, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f32, format::bfzyx, data_types::f32, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_FP32_3D_2 { 1, 16, 4, 5, 3 }, { 1, 32, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::is_os_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_DECONV_FP32_3D_3 { 1, 16, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::is_os_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_DECONV_FP32_3D_4 { 1, 32, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, 32, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::gs_oizyx_gsv16, data_types::f32, format::bfzyx +#define CASE_DECONV_FP32_3D_5 { 1, 15, 4, 5, 3 }, { 1, 30, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f32, format::bfzyx, data_types::f32, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_FP32_3D_6 { 1, 16, 4, 5, 3 }, { 1, 32, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::is_os_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_DECONV_FP32_3D_7 { 1, 16, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 1, 1, 1 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::is_os_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_DECONV_FP32_3D_8 { 1, 32, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 3, 3, 3 }, { 2, 2, 2 }, { 1, 1, 1 }, { 1, 1, 1 }, 32, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::gs_oizyx_gsv16, data_types::f32, format::bfzyx +#define CASE_DECONV_FP32_3D_9 { 16, 16, 4, 5, 3 }, { 16, 32, 7, 9, 5 }, { 1, 1, 1, 1, 1 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f32, format::bs_fs_zyx_bsv16_fsv16, data_types::f32, format::is_os_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_DECONV_FP16_3D_1 { 1, 15, 4, 5, 3 }, { 1, 30, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::bfzyx, data_types::f16, format::oizyx, data_types::f16, format::bfzyx -#define CASE_DECONV_FP16_3D_2 { 1, 16, 4, 5, 3 }, { 1, 32, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::is_os_zyx_isv16_osv16, data_types::f16, format::bfzyx -#define CASE_DECONV_FP16_3D_3 { 1, 16, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::is_os_zyx_isv16_osv16, data_types::f16, format::bfzyx -#define CASE_DECONV_FP16_3D_4 { 1, 32, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 1 }, 0 }, tensor{ 1 }, 32, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::gs_oizyx_gsv16, data_types::f16, format::bfzyx -#define CASE_DECONV_FP16_3D_5 { 1, 15, 4, 5, 3 }, { 1, 30, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::bfzyx, data_types::f16, format::oizyx, data_types::f16, format::bfzyx -#define CASE_DECONV_FP16_3D_6 { 1, 16, 4, 5, 3 }, { 1, 32, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::is_os_zyx_isv16_osv16, data_types::f16, format::bfzyx -#define CASE_DECONV_FP16_3D_7 { 1, 16, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 1, 1, 1 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::is_os_zyx_isv16_osv16, data_types::f16, format::bfzyx -#define CASE_DECONV_FP16_3D_8 { 1, 32, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ { 0, 0, 1, 1, 1 }, 0 }, tensor{ 1 }, 32, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::gs_oizyx_gsv16, data_types::f16, format::bfzyx -#define CASE_DECONV_FP16_3D_9 { 16, 16, 4, 5, 3 }, { 16, 32, 7, 9, 5 }, { 1, 1, 1, 1, 1 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f16, format::bs_fs_zyx_bsv16_fsv16, data_types::f16, format::is_os_zyx_isv16_osv16, data_types::f16, format::bfzyx +#define CASE_DECONV_FP16_3D_1 { 1, 15, 4, 5, 3 }, { 1, 30, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f16, format::bfzyx, data_types::f16, format::oizyx, data_types::f16, format::bfzyx +#define CASE_DECONV_FP16_3D_2 { 1, 16, 4, 5, 3 }, { 1, 32, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::is_os_zyx_isv16_osv16, data_types::f16, format::bfzyx +#define CASE_DECONV_FP16_3D_3 { 1, 16, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::is_os_zyx_isv16_osv16, data_types::f16, format::bfzyx +#define CASE_DECONV_FP16_3D_4 { 1, 32, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, 32, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::gs_oizyx_gsv16, data_types::f16, format::bfzyx +#define CASE_DECONV_FP16_3D_5 { 1, 15, 4, 5, 3 }, { 1, 30, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f16, format::bfzyx, data_types::f16, format::oizyx, data_types::f16, format::bfzyx +#define CASE_DECONV_FP16_3D_6 { 1, 16, 4, 5, 3 }, { 1, 32, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::is_os_zyx_isv16_osv16, data_types::f16, format::bfzyx +#define CASE_DECONV_FP16_3D_7 { 1, 16, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 1, 1, 1 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::is_os_zyx_isv16_osv16, data_types::f16, format::bfzyx +#define CASE_DECONV_FP16_3D_8 { 1, 32, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 3, 3, 3 }, { 2, 2, 2 }, { 1, 1, 1 }, { 1, 1, 1 }, 32, data_types::f16, format::b_fs_zyx_fsv16, data_types::f16, format::gs_oizyx_gsv16, data_types::f16, format::bfzyx +#define CASE_DECONV_FP16_3D_9 { 16, 16, 4, 5, 3 }, { 16, 32, 7, 9, 5 }, { 1, 1, 1, 1, 1 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f16, format::bs_fs_zyx_bsv16_fsv16, data_types::f16, format::is_os_zyx_isv16_osv16, data_types::f16, format::bfzyx -#define CASE_DECONV_S8S8_3D_1 { 1, 15, 4, 5, 3 }, { 1, 30, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_S8S8_3D_2 { 1, 16, 4, 5, 3 }, { 1, 32, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_S8S8_3D_3 { 1, 16, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_S8S8_3D_4 { 1, 32, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 1 }, 0 }, tensor{ 1 }, 32, data_types::i8, format::b_fs_zyx_fsv16, data_types::i8, format::goizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_S8S8_3D_5 { 1, 15, 4, 5, 3 }, { 1, 30, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_S8S8_3D_6 { 1, 16, 4, 5, 3 }, { 1, 32, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_S8S8_3D_7 { 1, 16, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 1, 1, 1 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_S8S8_3D_8 { 1, 32, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ { 0, 0, 1, 1, 1 }, 0 }, tensor{ 1 }, 32, data_types::i8, format::b_fs_zyx_fsv16, data_types::i8, format::goizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_S8S8_3D_1 { 1, 15, 4, 5, 3 }, { 1, 30, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_S8S8_3D_2 { 1, 16, 4, 5, 3 }, { 1, 32, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_S8S8_3D_3 { 1, 16, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_S8S8_3D_4 { 1, 32, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, 32, data_types::i8, format::b_fs_zyx_fsv16, data_types::i8, format::goizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_S8S8_3D_5 { 1, 15, 4, 5, 3 }, { 1, 30, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_S8S8_3D_6 { 1, 16, 4, 5, 3 }, { 1, 32, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_S8S8_3D_7 { 1, 16, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 1, 1, 1 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_S8S8_3D_8 { 1, 32, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 3, 3, 3 }, { 2, 2, 2 }, { 1, 1, 1 }, { 1, 1, 1 }, 32, data_types::i8, format::b_fs_zyx_fsv16, data_types::i8, format::goizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_U8S8_3D_1 { 1, 15, 4, 5, 3 }, { 1, 30, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfzyx, data_types::i8, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_U8S8_3D_2 { 1, 16, 4, 5, 3 }, { 1, 32, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_U8S8_3D_3 { 1, 16, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_U8S8_3D_4 { 1, 32, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 1 }, 0 }, tensor{ 1 }, 32, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::goizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_U8S8_3D_5 { 1, 15, 4, 5, 3 }, { 1, 30, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::bfzyx, data_types::i8, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_U8S8_3D_6 { 1, 16, 4, 5, 3 }, { 1, 32, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_U8S8_3D_7 { 1, 16, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 1, 1, 1 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_U8S8_3D_8 { 1, 32, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ { 0, 0, 1, 1, 1 }, 0 }, tensor{ 1 }, 32, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::goizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_U8S8_3D_1 { 1, 15, 4, 5, 3 }, { 1, 30, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::u8, format::bfzyx, data_types::i8, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_U8S8_3D_2 { 1, 16, 4, 5, 3 }, { 1, 32, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_U8S8_3D_3 { 1, 16, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_U8S8_3D_4 { 1, 32, 4, 5, 3 }, { 1, 32, 4, 5, 3 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 1, 1, 1 }, { 1, 1, 1 }, 32, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::goizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_U8S8_3D_5 { 1, 15, 4, 5, 3 }, { 1, 30, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::u8, format::bfzyx, data_types::i8, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_U8S8_3D_6 { 1, 16, 4, 5, 3 }, { 1, 32, 9, 11, 7 }, { 1, 1, 3, 3, 3 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_U8S8_3D_7 { 1, 16, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 1, 1, 1 }, { 2, 2, 2 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_U8S8_3D_8 { 1, 32, 4, 5, 3 }, { 1, 32, 7, 9, 5 }, { 1, 1, 3, 3, 3 }, { 2, 2, 2 }, { 1, 1, 1 }, { 1, 1, 1 }, 32, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::goizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_ELTW_FP32_1 { 1, 16, 4, 5 }, { 1, 32, 6, 7 }, { 1, 32, 1, 1 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::oiyx, data_types::f32, format::bfyx -#define CASE_DECONV_ELTW_FP32_2 { 1, 16, 4, 5 }, { 1, 32, 6, 7 }, { 1, 1, 1, 1 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx -#define CASE_DECONV_ELTW_FP32_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::is_os_yx_isv16_osv16, data_types::f32, format::bfyx -#define CASE_DECONV_ELTW_FP32_4 { 1, 15, 4, 5, 3 }, { 1, 30, 6, 7, 5 }, { 1, 1, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfzyx, data_types::f32, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_ELTW_FP32_5 { 1, 15, 4, 5, 4 }, { 1, 30, 6, 7, 6 }, { 1, 30, 6, 1, 6 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::bfzyx, data_types::f32, format::oizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_ELTW_FP32_6 { 1, 32, 2, 2, 2 }, { 1, 16, 4, 4, 4 }, { 1, 16, 1, 4, 1 }, { 1, 1, 3, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx -#define CASE_DECONV_ELTW_FP32_7 { 1, 16, 3, 5 }, { 1, 32, 5, 7 }, { 1, 32, 1, 7 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx -#define CASE_DECONV_ELTW_FP32_8 { 1, 32, 4, 5 }, { 1, 32, 7, 9 }, { 1, 32, 1, 1 }, { 1, 1, 3, 3 }, tensor{ 1, 1, 2, 2 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }, tensor{ 1 }, 32, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::gs_oiyx_gsv16, data_types::f32, format::bfyx +#define CASE_DECONV_ELTW_FP32_1 { 1, 16, 4, 5 }, { 1, 32, 6, 7 }, { 1, 32, 1, 1 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::oiyx, data_types::f32, format::bfyx +#define CASE_DECONV_ELTW_FP32_2 { 1, 16, 4, 5 }, { 1, 32, 6, 7 }, { 1, 1, 1, 1 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx +#define CASE_DECONV_ELTW_FP32_3 { 1, 16, 4, 5 }, { 1, 32, 4, 5 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::is_os_yx_isv16_osv16, data_types::f32, format::bfyx +#define CASE_DECONV_ELTW_FP32_4 { 1, 15, 4, 5, 3 }, { 1, 30, 6, 7, 5 }, { 1, 1, 6, 7, 5 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f32, format::bfzyx, data_types::f32, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_ELTW_FP32_5 { 1, 15, 4, 5, 4 }, { 1, 30, 6, 7, 6 }, { 1, 30, 6, 1, 6 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f32, format::bfzyx, data_types::f32, format::oizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_ELTW_FP32_6 { 1, 32, 2, 2, 2 }, { 1, 16, 4, 4, 4 }, { 1, 16, 1, 4, 1 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx +#define CASE_DECONV_ELTW_FP32_7 { 1, 16, 3, 5 }, { 1, 32, 5, 7 }, { 1, 32, 1, 7 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::os_is_yx_isv16_osv16, data_types::f32, format::bfyx +#define CASE_DECONV_ELTW_FP32_8 { 1, 32, 4, 5 }, { 1, 32, 7, 9 }, { 1, 32, 1, 1 }, { 1, 1, 3, 3 }, { 2, 2 }, { 1, 1 }, { 1, 1 }, 32, data_types::f32, format::b_fs_yx_fsv16, data_types::f32, format::gs_oiyx_gsv16, data_types::f32, format::bfyx -#define CASE_DECONV_ELTW_i8_1 { 1, 16, 3, 5 }, { 1, 32, 5, 7 }, { 1, 32, 5, 1 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx -#define CASE_DECONV_ELTW_i8_2 { 1, 32, 4, 5, 3 }, { 1, 32, 6, 7, 5 }, { 1, 32, 1, 1, 1 }, { 1, 1, 3, 3, 3 }, tensor{ 1, 1, 2, 2, 2 }, tensor{ { 0, 0, 1, 1, 1 }, 0 }, tensor{ 1 }, 32, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::goizyx, data_types::f32, format::bfzyx -#define CASE_DECONV_ELTW_i8_3 { 1, 5, 5, 5, 5 }, { 1, 5, 5, 5, 5 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oiyx, data_types::f32, format::bfzyx -#define CASE_DECONV_ELTW_i8_4 { 1, 16, 1, 4 }, { 1, 16, 1, 6 }, { 1, 16, 1, 1 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx -#define CASE_DECONV_ELTW_i8_5 { 1, 16, 2, 4 }, { 1, 16, 4, 6 }, { 1, 16, 4, 1 }, { 1, 1, 3, 3 }, tensor{ 1 }, tensor{ 0 }, tensor{ 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx +#define CASE_DECONV_ELTW_i8_1 { 1, 16, 3, 5 }, { 1, 32, 5, 7 }, { 1, 32, 5, 1 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx +#define CASE_DECONV_ELTW_i8_2 { 1, 32, 4, 5, 3 }, { 1, 32, 6, 7, 5 }, { 1, 32, 1, 1, 1 }, { 1, 1, 3, 3, 3 }, { 2, 2, 2 }, { 1, 1, 1 }, { 1, 1, 1 }, 32, data_types::u8, format::b_fs_zyx_fsv16, data_types::i8, format::goizyx, data_types::f32, format::bfzyx +#define CASE_DECONV_ELTW_i8_3 { 1, 5, 5, 5, 5 }, { 1, 5, 5, 5, 5 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oiyx, data_types::f32, format::bfzyx +#define CASE_DECONV_ELTW_i8_4 { 1, 16, 1, 4 }, { 1, 16, 1, 6 }, { 1, 16, 1, 1 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx +#define CASE_DECONV_ELTW_i8_5 { 1, 16, 2, 4 }, { 1, 16, 4, 6 }, { 1, 16, 4, 1 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx class deconv_actv : public DeconvolutionFusingTest {}; TEST_P(deconv_actv, basic) { diff --git a/src/plugins/intel_gpu/tests/fusions/pooling_fusion_test.cpp b/src/plugins/intel_gpu/tests/fusions/pooling_fusion_test.cpp index df6c2b3753c..b8dba3a19a5 100644 --- a/src/plugins/intel_gpu/tests/fusions/pooling_fusion_test.cpp +++ b/src/plugins/intel_gpu/tests/fusions/pooling_fusion_test.cpp @@ -144,9 +144,15 @@ public: class pooling_f32_activation : public PoolingFusingTest {}; TEST_P(pooling_f32_activation, basic) { auto p = GetParam(); + + auto r = get_input_layout(p).get_spatial_rank(); + ov::Shape kernel(r, 3); + ov::Strides stride(r, 1); + ov::Shape pad(r, 1); + create_topologies( input_layout("input", get_input_layout(p)), - pooling("pooling", "input", p.pool_mode, tensor{ 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }), + pooling("pooling", "input", p.pool_mode, kernel, stride, pad), activation("act", "pooling", activation_func::relu), reorder("output_reorder", "act", format::bfyx, data_types::f32) ); @@ -175,10 +181,16 @@ INSTANTIATE_TEST_SUITE_P(fusings_gpu, pooling_f32_activation, ::testing::ValuesI class pooling_f32_scale : public PoolingFusingTest {}; TEST_P(pooling_f32_scale, basic) { auto p = GetParam(); + + auto r = get_input_layout(p).get_spatial_rank(); + ov::Shape kernel(r, 3); + ov::Strides stride(r, 1); + ov::Shape pad(r, 1); + create_topologies( input_layout("input", get_input_layout(p)), - data("scale_data", get_mem(get_per_channel_layout(p), 1.0f / tensor{ 1, 1, 3, 3 }.count())), - pooling("pooling", "input", p.pool_mode, tensor{ 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }), + data("scale_data", get_mem(get_per_channel_layout(p), 1.0f / 9.0f)), + pooling("pooling", "input", p.pool_mode, kernel, stride, pad), scale("scale", "pooling", "scale_data"), reorder("output_reorder", "scale", format::bfyx, data_types::f32) ); @@ -189,10 +201,16 @@ TEST_P(pooling_f32_scale, basic) { TEST_P(pooling_f32_scale, fp16_scale_out) { auto p = GetParam(); + + auto r = get_input_layout(p).get_spatial_rank(); + ov::Shape kernel(r, 3); + ov::Strides stride(r, 1); + ov::Shape pad(r, 1); + create_topologies( input_layout("input", get_input_layout(p)), - data("scale_data", get_mem(get_per_channel_layout(p), 1.0f / tensor{ 1, 1, 3, 3 }.count())), - pooling("pooling", "input", p.pool_mode, tensor{ 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }), + data("scale_data", get_mem(get_per_channel_layout(p), 1.0f / 9.0f)), + pooling("pooling", "input", p.pool_mode, kernel, stride, pad), scale("scale", "pooling", "scale_data", optional_data_type{ data_types::f16 }), reorder("output_reorder", "scale", format::bfyx, data_types::f32) ); @@ -220,14 +238,19 @@ class pooling_scale_activation_quantize : public PoolingFusingTest {}; TEST_P(pooling_scale_activation_quantize, basic) { auto p = GetParam(); + auto r = get_input_layout(p).get_spatial_rank(); + ov::Shape kernel(r, 4); + ov::Strides stride(r, 2); + ov::Shape pad(r, 0); + create_topologies( input_layout("input", get_input_layout(p)), data("in_lo", get_mem(get_single_element_layout(p), min_random, 0)), data("in_hi", get_mem(get_single_element_layout(p), 1, max_random)), data("out_lo", get_mem(get_single_element_layout(p), 0)), data("out_hi", get_mem(get_single_element_layout(p), 255)), - data("scale_data", get_mem(get_per_channel_layout(p), 1.0f / tensor{ 1, 1, 4, 4 }.count())), - pooling("pooling", "input", "", p.pool_mode, tensor(1, 1, 4, 4), tensor(1, 1, 2, 2)), + data("scale_data", get_mem(get_per_channel_layout(p), 1.0f / 16.0f)), + pooling("pooling", "input", "", p.pool_mode, kernel, stride, pad), scale("scale", "pooling", "scale_data"), activation("activation", "scale", activation_func::relu), quantize("quantize", "activation", "in_lo", "in_hi", "out_lo", "out_hi", 255, data_types::u8), @@ -241,14 +264,19 @@ TEST_P(pooling_scale_activation_quantize, basic) { TEST_P(pooling_scale_activation_quantize, i8_output_data_type) { auto p = GetParam(); + auto r = get_input_layout(p).get_spatial_rank(); + ov::Shape kernel(r, 4); + ov::Strides stride(r, 2); + ov::Shape pad(r, 0); + create_topologies( input_layout("input", get_input_layout(p)), data("in_lo", get_mem(get_per_channel_layout(p), min_random, 0)), data("in_hi", get_mem(get_per_channel_layout(p), 1, max_random)), data("out_lo", get_mem(get_single_element_layout(p), -127, 127)), data("out_hi", get_mem(get_single_element_layout(p), -127, 127)), - data("scale_data", get_mem(get_per_channel_layout(p), 1.0f / tensor{ 1, 1, 4, 4 }.count())), - pooling("pooling", "input", "", p.pool_mode, tensor(1, 1, 4, 4), tensor(1, 1, 2, 2)), + data("scale_data", get_mem(get_per_channel_layout(p), 1.0f / 16.0f)), + pooling("pooling", "input", "", p.pool_mode, kernel, stride, pad), scale("scale", "pooling", "scale_data"), activation("activation", "scale", activation_func::relu), quantize("quantize", "activation", "in_lo", "in_hi", "out_lo", "out_hi", 255, data_types::i8), @@ -262,14 +290,19 @@ TEST_P(pooling_scale_activation_quantize, i8_output_data_type) { TEST_P(pooling_scale_activation_quantize, per_channel) { auto p = GetParam(); + auto r = get_input_layout(p).get_spatial_rank(); + ov::Shape kernel(r, 4); + ov::Strides stride(r, 2); + ov::Shape pad(r, 0); + create_topologies( input_layout("input", get_input_layout(p)), data("in_lo", get_mem(get_per_channel_layout(p), min_random, 0)), data("in_hi", get_mem(get_per_channel_layout(p), 1, max_random)), data("out_lo", get_mem(get_single_element_layout(p), 0)), data("out_hi", get_mem(get_single_element_layout(p), 255)), - data("scale_data", get_mem(get_per_channel_layout(p), 1.0f / tensor{ 1, 1, 4, 4 }.count())), - pooling("pooling", "input", "", p.pool_mode, tensor(1, 1, 4, 4), tensor(1, 1, 2, 2)), + data("scale_data", get_mem(get_per_channel_layout(p), 1.0f / 16.0f)), + pooling("pooling", "input", "", p.pool_mode, kernel, stride, pad), scale("scale", "pooling", "scale_data"), activation("activation", "scale", activation_func::atan), quantize("quantize", "activation", "in_lo", "in_hi", "out_lo", "out_hi", 255, data_types::u8), @@ -326,10 +359,15 @@ class pooling_scale_activation : public PoolingFusingTest {}; TEST_P(pooling_scale_activation, basic) { auto p = GetParam(); + auto r = get_input_layout(p).get_spatial_rank(); + ov::Shape kernel(r, 4); + ov::Strides stride(r, 2); + ov::Shape pad(r, 0); + create_topologies( input_layout("input", get_input_layout(p)), - data("scale_data", get_mem(get_per_channel_layout(p), 1.0f / tensor{ 1, 1, 4, 4 }.count())), - pooling("pooling", "input", "", p.pool_mode, tensor(1, 1, 4, 4), tensor(1, 1, 2, 2)), + data("scale_data", get_mem(get_per_channel_layout(p), 1.0f / 16.0f)), + pooling("pooling", "input", "", p.pool_mode, kernel, stride, pad), scale("scale", "pooling", "scale_data"), activation("activation", "scale", activation_func::relu), reorder("output_reorder", "activation", p.default_format, data_types::f32) @@ -342,10 +380,15 @@ TEST_P(pooling_scale_activation, basic) { TEST_P(pooling_scale_activation, eltwise_mul) { auto p = GetParam(); + auto r = get_input_layout(p).get_spatial_rank(); + ov::Shape kernel(r, 4); + ov::Strides stride(r, 2); + ov::Shape pad(r, 0); + create_topologies( input_layout("input", get_input_layout(p)), data("scale_data", get_mem(get_per_channel_layout(p))), - pooling("pooling", "input", "", p.pool_mode, tensor(1, 1, 4, 4), tensor(1, 1, 2, 2)), + pooling("pooling", "input", "", p.pool_mode, kernel, stride, pad), eltwise("scale", { "pooling", "scale_data" }, eltwise_mode::prod, p.default_type), activation("activation", "scale", activation_func::relu), reorder("output_reorder", "activation", p.default_format, data_types::f32) @@ -530,9 +573,15 @@ public: class pooling_onednn_activation1 : public PoolingOneDNNFusingTest {}; TEST_P(pooling_onednn_activation1, basic) { auto p = GetParam(); + + auto r = get_input_layout(p).get_spatial_rank(); + ov::Shape kernel(r, 3); + ov::Strides stride(r, 1); + ov::Shape pad(r, 1); + create_topologies( input_layout("input", get_input_layout(p)), - pooling("pooling", "input", p.pool_mode, tensor{ 1, 1, 3, 3 }, tensor{ 1 }, tensor{ { 0, 0, 1, 1, 0, 0 }, 0 }), + pooling("pooling", "input", p.pool_mode, kernel, stride, pad), activation("act", "pooling", activation_func::relu), reorder("output_reorder", "act", format::bfyx, data_types::f32) ); @@ -544,6 +593,12 @@ TEST_P(pooling_onednn_activation1, basic) { class pooling_onednn_activation2 : public PoolingOneDNNFusingTest {}; TEST_P(pooling_onednn_activation2, basic) { auto p = GetParam(); + + auto r = get_input_layout(p).get_spatial_rank(); + ov::Shape kernel(r, 3); + ov::Strides stride(r, 1); + ov::Shape pad(r, 1); + create_topologies( input_layout("input", get_input_layout(p)), pooling("pooling", "input", p.pool_mode, { 1, 1, 3, 3 }, { 1, 1, 1, 1 }), diff --git a/src/plugins/intel_gpu/tests/module_tests/reorder_inputs_test.cpp b/src/plugins/intel_gpu/tests/module_tests/reorder_inputs_test.cpp index db75ec27f72..61dd5aca857 100644 --- a/src/plugins/intel_gpu/tests/module_tests/reorder_inputs_test.cpp +++ b/src/plugins/intel_gpu/tests/module_tests/reorder_inputs_test.cpp @@ -39,7 +39,7 @@ TEST(reorder_inputs, propagation) { topology.add(data("weights", weights)); topology.add(input_layout("input", input->get_layout())); topology.add(convolution("conv1", "input", { "weights" })); - topology.add(pooling("pool", "conv1", pooling_mode::max, { 1, 1, 1, 1 }, { 1, 1, 1, 1 })); + topology.add(pooling("pool", "conv1", pooling_mode::max, { 1, 1 }, { 1, 1 })); topology.add(convolution("conv2", "pool", { "weights" })); build_options build_opts; @@ -75,7 +75,7 @@ TEST(reorder_inputs, impl_forcing_basic_format) { topology topology; topology.add(input_layout("input", input->get_layout())); - topology.add(pooling("pool", "input", pooling_mode::max, { 1, 1, 2, 1 }, { 1, 1, 2, 1 })); + topology.add(pooling("pool", "input", pooling_mode::max, { 1, 2 }, { 1, 2 })); implementation_desc pool_impl = { format::yxfb, "" }; @@ -113,7 +113,7 @@ TEST(reorder_inputs, impl_forcing_not_existing) { topology topology; topology.add(input_layout("input", input->get_layout())); - topology.add(pooling("pool", "input", pooling_mode::max, { 1, 1, 2, 1 }, { 1, 1, 2, 1 })); + topology.add(pooling("pool", "input", pooling_mode::max, { 1, 2 }, { 1, 2 })); implementation_desc pool_impl = { format::any, "NOT_EXISTING" }; diff --git a/src/plugins/intel_gpu/tests/module_tests/test_module_fusing_reorder.cpp b/src/plugins/intel_gpu/tests/module_tests/test_module_fusing_reorder.cpp index bd475561a42..8bf0b2e99df 100644 --- a/src/plugins/intel_gpu/tests/module_tests/test_module_fusing_reorder.cpp +++ b/src/plugins/intel_gpu/tests/module_tests/test_module_fusing_reorder.cpp @@ -50,7 +50,7 @@ TEST(test_can_fuse_reorder, reorder_for_mixed_type_convolution_fsv32_onednn) topology.add(data("weights", weights)); topology.add(data("bias", bias)); topology.add(reorder("reorder_input", "input", format::b_fs_yx_fsv32, data_types::u8)); - topology.add(cldnn::convolution("conv", { "reorder_input" }, { "weights" }, { "bias"}, 1, tensor{1}, tensor{0}, tensor{1}, {1, 32, 2, 2}, data_types::f32, false)); + topology.add(cldnn::convolution("conv", { "reorder_input" }, { "weights" }, { "bias"}, 1, {1, 1}, {0, 0}, {1, 1}, {1, 32, 2, 2}, data_types::f32, false)); topology.add(reorder("reorder_conv", "conv", reorder_layout)); program::ptr prog = program::build_program(engine, topology, build_opt, false, true); @@ -92,7 +92,7 @@ TEST(test_can_fuse_reorder, reorder_for_mixed_type_convolution_fsv32_cldnn) topology.add(data("weights", weights)); topology.add(data("bias", bias)); topology.add(reorder("reorder_input", "input", format::b_fs_yx_fsv32, data_types::u8)); - topology.add(cldnn::convolution("conv", { "reorder_input" }, { "weights" }, { "bias"}, 1, tensor{1}, tensor{0}, tensor{1}, {1, 32, 2, 2}, data_types::f32, false)); + topology.add(cldnn::convolution("conv", { "reorder_input" }, { "weights" }, { "bias"}, 1, {1, 1}, {0, 0}, {1, 1}, {1, 32, 2, 2}, data_types::f32, false)); topology.add(reorder("reorder_conv", "conv", reorder_layout)); program::ptr prog = program::build_program(engine, topology, build_opt, false, true); @@ -221,7 +221,7 @@ TEST_P(test_can_fuse_reorder_cldnn, reorder_for_firstconv_cldnn) topology.add(data("weights", weights)); topology.add(data("bias", bias)); topology.add(reorder("reorder_input", "input", p.output_format, p.input_data_type)); - topology.add(cldnn::convolution("conv2", { "reorder_input" }, { "weights" }, { "bias"}, 1, tensor{1}, tensor{0}, tensor{1}, p.out_shape, p.input_data_type, false)); + topology.add(cldnn::convolution("conv2", { "reorder_input" }, { "weights" }, { "bias"}, 1, {1, 1}, {0, 0}, {1, 1}, p.out_shape, p.input_data_type, false)); topology.add(reorder("reorder_conv", "conv2", reorder_layout)); program::ptr prog = program::build_program(engine, topology, build_opt, false, true); diff --git a/src/plugins/intel_gpu/tests/test_cases/average_unpooling_gpu_test.cpp b/src/plugins/intel_gpu/tests/test_cases/average_unpooling_gpu_test.cpp index 5a1e9ea9a15..05eebe0f223 100644 --- a/src/plugins/intel_gpu/tests/test_cases/average_unpooling_gpu_test.cpp +++ b/src/plugins/intel_gpu/tests/test_cases/average_unpooling_gpu_test.cpp @@ -60,10 +60,10 @@ TEST(average_unpooling_gpu, basic_in2x2x2x1) { auto output_layout = output->get_layout(); EXPECT_EQ(output_layout.format, format::bfyx); - EXPECT_EQ(output_layout.size.spatial[1], 2); - EXPECT_EQ(output_layout.size.spatial[0], 3); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(1), 2); + EXPECT_EQ(output_layout.spatial(0), 3); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_output_vec = { 0.625f, -0.5f, -1.125, @@ -118,7 +118,7 @@ TEST(average_unpooling_gpu, basic_in2x2x3x2_with_average_pooling_unpooling) { topology topology; topology.add(input_layout("input", input->get_layout())); - topology.add(pooling("pooling", "input", pooling_mode::average_no_padding, { 1, 1, 2, 2 }, { 1, 1, 2, 2 })); + topology.add(pooling("pooling", "input", pooling_mode::average_no_padding, { 2, 2 }, { 2, 2 })); topology.add(average_unpooling("average_unpooling", "pooling", input->get_layout().size, { 1, 1, 2, 2 }, { 1, 1, 2, 2 })); network network(engine, topology); @@ -132,10 +132,10 @@ TEST(average_unpooling_gpu, basic_in2x2x3x2_with_average_pooling_unpooling) { auto output_layout = output->get_layout(); EXPECT_EQ(output_layout.format, format::bfyx); - EXPECT_EQ(output_layout.size.spatial[1], 2); - EXPECT_EQ(output_layout.size.spatial[0], 3); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(1), 2); + EXPECT_EQ(output_layout.spatial(0), 3); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_output_vec = { 0.625f, 0.625f, -6, @@ -199,10 +199,10 @@ TEST(average_unpooling_gpu, basic_in2x2x2x1_output_padding) { auto output_layout = output->get_layout(); EXPECT_EQ(output_layout.format, format::bfyx); - EXPECT_EQ(output_layout.size.spatial[1], 2); - EXPECT_EQ(output_layout.size.spatial[0], 3); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(1), 2); + EXPECT_EQ(output_layout.spatial(0), 3); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_output_vec = { 0.f, 0.f, 0.f, 0.f, 0.f, @@ -280,10 +280,10 @@ TEST(average_unpooling_gpu, basic_in2x2x2x1_fp16) { auto output_layout = output->get_layout(); EXPECT_EQ(output_layout.format, format::bfyx); - EXPECT_EQ(output_layout.size.spatial[1], 2); - EXPECT_EQ(output_layout.size.spatial[0], 3); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(1), 2); + EXPECT_EQ(output_layout.spatial(0), 3); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_output_vec = { 0.625f, -0.5f, -1.125, diff --git a/src/plugins/intel_gpu/tests/test_cases/binary_convolution_gpu_test.cpp b/src/plugins/intel_gpu/tests/test_cases/binary_convolution_gpu_test.cpp index 6f0854fbe78..986809f4b5c 100644 --- a/src/plugins/intel_gpu/tests/test_cases/binary_convolution_gpu_test.cpp +++ b/src/plugins/intel_gpu/tests/test_cases/binary_convolution_gpu_test.cpp @@ -189,9 +189,9 @@ TEST_P(binary_convolution_test, conv) { TestParams p = GetParam(); - cldnn::tensor stride = cldnn::tensor{cldnn::batch(1), cldnn::feature(1), cldnn::spatial(p.sw, p.sh)}; - cldnn::tensor pad = cldnn::tensor{cldnn::batch(0), cldnn::feature(0), cldnn::spatial(p.pw, p.ph)}; - cldnn::tensor dilation = {1,1,1,1}; + ov::Strides stride = {static_cast(p.sh), static_cast(p.sw)}; + ov::CoordinateDiff pad = {p.ph, p.pw}; + ov::Strides dilation = {1,1}; cldnn::tensor is_size{ cldnn::batch(p.b), cldnn::feature(p.ic), @@ -358,9 +358,9 @@ TEST(binary_convolution, basic_convolution_1x1_single_packed_channel) { input_layout("input", input->get_layout()), data("weights", weights), binary_convolution("binary_conv", "input", { "weights" }, - { 1,1,1,1 }, - { 0,0,0,0 }, - { 1,1,1,1 }, + { 1,1 }, + { 0,0 }, + { 1,1 }, { 1,4,2,2 }, 0, 0.0f, data_types::f32, @@ -384,10 +384,10 @@ TEST(binary_convolution, basic_convolution_1x1_single_packed_channel) { EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(output_layout.data_type, data_types::f32); - EXPECT_EQ(output_layout.size.batch[0], 1); - EXPECT_EQ(output_layout.size.feature[0], 4); - EXPECT_EQ(output_layout.size.spatial[1], 2); - EXPECT_EQ(output_layout.size.spatial[0], 2); + EXPECT_EQ(output_layout.batch(), 1); + EXPECT_EQ(output_layout.feature(), 4); + EXPECT_EQ(output_layout.spatial(1), 2); + EXPECT_EQ(output_layout.spatial(0), 2); for (size_t i = 0; i < output_layout.count(); i++) { @@ -442,9 +442,9 @@ TEST(binary_convolution, basic_convolution_1x1_single_packed_channel_fp16) { input_layout("input", input->get_layout()), data("weights", weights), binary_convolution("binary_conv", "input", { "weights" }, - { 1,1,1,1 }, - { 0,0,0,0 }, - { 1,1,1,1 }, + { 1,1 }, + { 0,0 }, + { 1,1 }, { 1,4,2,2 }, 0, 0.0f, data_types::f16, @@ -468,10 +468,10 @@ TEST(binary_convolution, basic_convolution_1x1_single_packed_channel_fp16) { EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(output_layout.data_type, data_types::f16); - EXPECT_EQ(output_layout.size.batch[0], 1); - EXPECT_EQ(output_layout.size.feature[0], 4); - EXPECT_EQ(output_layout.size.spatial[1], 2); - EXPECT_EQ(output_layout.size.spatial[0], 2); + EXPECT_EQ(output_layout.batch(), 1); + EXPECT_EQ(output_layout.feature(), 4); + EXPECT_EQ(output_layout.spatial(1), 2); + EXPECT_EQ(output_layout.spatial(0), 2); for (size_t i = 0; i < output_layout.count(); i++) { EXPECT_EQ(float16_to_float32(output_ptr[i]), output_vec[i]) << "index="<< i; diff --git a/src/plugins/intel_gpu/tests/test_cases/concatenation_gpu_test.cpp b/src/plugins/intel_gpu/tests/test_cases/concatenation_gpu_test.cpp index a4793a482a1..5d927ba378e 100644 --- a/src/plugins/intel_gpu/tests/test_cases/concatenation_gpu_test.cpp +++ b/src/plugins/intel_gpu/tests/test_cases/concatenation_gpu_test.cpp @@ -82,10 +82,10 @@ TEST(concat_gpu, mixed_input_types) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 3); EXPECT_EQ(x_size, 4); @@ -155,11 +155,11 @@ TEST(concat_gpu, mixed_input_types_5d) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int z_size = output_layout.size.spatial[2]; - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int z_size = output_layout.spatial(2); + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfzyx); EXPECT_EQ(z_size, 3); EXPECT_EQ(y_size, 4); @@ -206,8 +206,8 @@ TEST(concat_gpu, i8_optimization_with_pool) { layout reorder_layout(data_types::i8, format::yxfb, {7, 2, 2, 1}); topology topology(input_layout("input0", input0->get_layout()), input_layout("input1", input1->get_layout()), - pooling("pool0", "input0", pooling_mode::max, {1, 1, 2, 2}, {1, 1, 1, 1}), - pooling("pool1", "input1", pooling_mode::max, {1, 1, 2, 2}, {1, 1, 1, 1}), + pooling("pool0", "input0", pooling_mode::max, {2, 2}, {1, 1}), + pooling("pool1", "input1", pooling_mode::max, {2, 2}, {1, 1}), concatenation("concat", {"pool0", "pool1"}, 1, @@ -229,10 +229,10 @@ TEST(concat_gpu, i8_optimization_with_pool) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[0]; - int x_size = output_layout.size.spatial[1]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(0); + int x_size = output_layout.spatial(1); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::yxfb); EXPECT_EQ(y_size, 7); EXPECT_EQ(x_size, 2); @@ -316,7 +316,7 @@ TEST(concat_gpu, i8_optimization_with_conv) { "", padding{{0, 0, 0, 0}, 0}), data("weights", weights), - convolution("conv", "concat", { "weights" }, { 1,1,1,2 }), + convolution("conv", "concat", { "weights" }, { 2, 1 }), reorder("output", "conv", reorder_layout)); cldnn::build_options options; options.set_option(cldnn::build_option::optimize_data(true)); @@ -333,10 +333,10 @@ TEST(concat_gpu, i8_optimization_with_conv) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); @@ -409,8 +409,8 @@ TEST(concat_gpu, i8_optimization_with_pool_conv) { layout reorder_layout(data_types::i8, format::bfyx, {1, 1, 3, 1}); topology topology(input_layout("input0", input0->get_layout()), input_layout("input1", input1->get_layout()), - pooling("pool0", "input0", pooling_mode::max, {1, 1, 2, 2}, {1, 1, 1, 1}), - pooling("pool1", "input1", pooling_mode::max, {1, 1, 2, 2}, {1, 1, 1, 1}), + pooling("pool0", "input0", pooling_mode::max, {2, 2}, {1, 1}), + pooling("pool1", "input1", pooling_mode::max, {2, 2}, {1, 1}), concatenation("concat", {"pool0", "pool1"}, 1, @@ -418,7 +418,7 @@ TEST(concat_gpu, i8_optimization_with_pool_conv) { "", padding{{0, 0, 0, 0}, 0}), data("weights", weights), - convolution("conv", "concat", {"weights"}, {1, 1, 1, 1}, tensor{{0, 0, 1, 0}, 0}), + convolution("conv", "concat", {"weights"}, {1, 1}, {0, 1}), reorder("output", "conv", reorder_layout) ); cldnn::build_options options; options.set_option(cldnn::build_option::optimize_data(true)); @@ -434,10 +434,10 @@ TEST(concat_gpu, i8_optimization_with_pool_conv) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[0]; - int x_size = output_layout.size.spatial[1]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(0); + int x_size = output_layout.spatial(1); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 3); EXPECT_EQ(x_size, 1); @@ -830,7 +830,7 @@ public: in_memory.push_back(in_mem); topology.add(input_layout("input" + std::to_string(i), in_lay)); - topology.add(pooling("pool" + std::to_string(i), "input" + std::to_string(i), pooling_mode::max, {1, 1, 1, 1}, {1, 1, 1, 1})); + topology.add(pooling("pool" + std::to_string(i), "input" + std::to_string(i), pooling_mode::max, {1, 1}, {1, 1})); input_ids.push_back("input" + std::to_string(i)); pooling_ids.push_back("pool" + std::to_string(i)); @@ -851,7 +851,7 @@ public: } topology.add(data("weights" , weights_mem)); topology.add(convolution("conv", "concat", { "weights" })); - topology.add(pooling("pool_final", "conv", pooling_mode::max, {1, 1, 1, 1}, {1, 1, 1, 1})); + topology.add(pooling("pool_final", "conv", pooling_mode::max, {1, 1}, {1, 1})); topology.add(reorder("reorder", "pool_final", layout(data_type, format::bfyx, {(int32_t)batch_num, (int32_t)output_f, (int32_t)input_y, (int32_t)input_x}))); network concat_network(engine, topology, options); @@ -988,10 +988,10 @@ TEST(concat_gpu_onednn, basic_input_types) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 3); EXPECT_EQ(x_size, 4); @@ -1049,7 +1049,7 @@ public: in_memory.push_back(in_mem); topology.add(input_layout("input" + std::to_string(i), in_lay)); - topology.add(pooling("pool" + std::to_string(i), "input" + std::to_string(i), pooling_mode::max, {1, 1, 1, 1}, {1, 1, 1, 1})); + topology.add(pooling("pool" + std::to_string(i), "input" + std::to_string(i), pooling_mode::max, {1, 1}, {1, 1})); input_ids.push_back("input" + std::to_string(i)); pooling_ids.push_back("pool" + std::to_string(i)); @@ -1070,7 +1070,7 @@ public: } topology.add(data("weights" , weights_mem)); topology.add(convolution("conv", "concat", { "weights" })); - topology.add(pooling("pool_final", "conv", pooling_mode::max, {1, 1, 1, 1}, {1, 1, 1, 1})); + topology.add(pooling("pool_final", "conv", pooling_mode::max, {1, 1}, {1, 1})); topology.add(reorder("reorder", "pool_final", layout(data_type, format::bfyx, {(int32_t)batch_num, (int32_t)output_f, (int32_t)input_y, (int32_t)input_x}))); network concat_network(engine, topology, options); diff --git a/src/plugins/intel_gpu/tests/test_cases/convolution_gpu_test.cpp b/src/plugins/intel_gpu/tests/test_cases/convolution_gpu_test.cpp index 5a53219e278..1e6774f77a3 100644 --- a/src/plugins/intel_gpu/tests/test_cases/convolution_gpu_test.cpp +++ b/src/plugins/intel_gpu/tests/test_cases/convolution_gpu_test.cpp @@ -222,21 +222,21 @@ VVF reference_scale_post_op(const VVF& input, const T& scale, const T& shi void dump_buffer(memory::ptr mem, std::string const& name) { std::ofstream out(name); - auto size = mem->get_layout().get_buffer_size(); + auto l = mem->get_layout(); cldnn::mem_lock ptr(mem, get_test_stream()); auto pitches = mem->get_layout().get_pitches(); - out << "Data size: " << mem->get_layout().size << "\n"; + out << "Data size: " << l.to_string() << "\n"; out << "Lower padding: " << mem->get_layout().data_padding.lower_size() << "\n"; out << "Upper padding: " << mem->get_layout().data_padding.upper_size() << "\n"; out << "\n"; - for (int b = 0; b < size.batch[0]; ++b) { + for (int b = 0; b < l.batch(); ++b) { out << " ================ BATCH " << b << " =================\n\n"; - for (int f = 0; f < size.feature[0]; ++f) { + for (int f = 0; f < l.feature(); ++f) { out << "feature " << f << ":\n"; - for (int z = 0; z < size.spatial[2]; ++z) { - for (int y = 0; y < size.spatial[1]; ++y) { - for (int x = 0; x < size.spatial[0]; ++x) { + for (int z = 0; z < l.spatial(2); ++z) { + for (int y = 0; y < l.spatial(1); ++y) { + for (int x = 0; x < l.spatial(0); ++x) { size_t idx = b * pitches.batch[0] + f * pitches.feature[0] + z * pitches.spatial[2] + y * pitches.spatial[1] + x * pitches.spatial[0]; out << ptr[idx] << " "; } @@ -349,8 +349,8 @@ TEST(deformable_convolution_f32_fw_gpu, basic_deformable_convolution_def_group1_ { "biases" }, 1, 1, - { 1, 1, 1, 1 }, - tensor{ { 0, 0, 1, 1 }, 0 }, + { 1, 1 }, + { 1, 1 }, { 1, 1, 1, 1 }, { 1, 4, 4, 4 }) ); @@ -367,10 +367,10 @@ TEST(deformable_convolution_f32_fw_gpu, basic_deformable_convolution_def_group1_ auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 4); EXPECT_EQ(x_size, 4); @@ -480,8 +480,8 @@ TEST(deformable_convolution_f32_fw_gpu, basic_deformable_convolution_def_group1) { "biases" }, 1, 1, - { 1, 1, 1, 1 }, - tensor{ { 0, 0, 2, 2 }, 0 }, + { 1, 1 }, + { 2, 2 }, { 1, 1, 2, 2 }, { 1, 4, 4, 4 }) ); @@ -498,10 +498,10 @@ TEST(deformable_convolution_f32_fw_gpu, basic_deformable_convolution_def_group1) auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 4); EXPECT_EQ(x_size, 4); @@ -643,8 +643,8 @@ TEST(deformable_convolution_f32_fw_gpu, basic_deformable_convolution) { { "biases" }, 1, 2, - { 1, 1, 1, 1 }, - tensor{ { 0, 0, 2, 2 }, 0 }, + { 1, 1 }, + { 2, 2 }, { 1, 1, 2, 2 }, { 1, 4, 4, 4 }) ); @@ -661,10 +661,10 @@ TEST(deformable_convolution_f32_fw_gpu, basic_deformable_convolution) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 4); EXPECT_EQ(x_size, 4); @@ -710,7 +710,7 @@ TEST(convolution_f32_fw_gpu, basic_convolution_no_bias) { topology topology( input_layout("input", input->get_layout()), data("weights", weights), - convolution("conv", "input", { "weights" }, { 1, 1, 1, 2 })); + convolution("conv", "input", { "weights" }, { 2, 1 })); network network(engine, topology); network.set_input_data("input", input); @@ -723,10 +723,10 @@ TEST(convolution_f32_fw_gpu, basic_convolution_no_bias) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::yxfb); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); @@ -786,7 +786,7 @@ TEST(convolution_f32_fw_gpu, basic_convolution_int8_no_bias) { input_layout("input", input->get_layout()), reorder("to_int","input", { data_types::i8, format::bfyx, { 1, 1, 5, 4 } }), data("weights", weights), - convolution("conv", "to_int", { "weights" }, { 1, 1, 1, 2 }), + convolution("conv", "to_int", { "weights" }, {2, 1 }), reorder("output", "conv", { data_types::f32, format::bfyx, { 1, 1, 3, 2 } })); network network(engine, topology); @@ -800,10 +800,10 @@ TEST(convolution_f32_fw_gpu, basic_convolution_int8_no_bias) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); @@ -839,7 +839,7 @@ TEST(convolution_f32_fw_gpu, basic_convolution3D_no_bias) { topology topology( input_layout("input", input->get_layout()), data("weights", weights), - convolution("conv", "input", { "weights" }, { 1, 1, 1, 2 })); + convolution("conv", "input", { "weights" }, { 2, 1 })); network network(engine, topology); network.set_input_data("input", input); @@ -852,11 +852,11 @@ TEST(convolution_f32_fw_gpu, basic_convolution3D_no_bias) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int z_size = output_layout.size.spatial[2]; - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int z_size = output_layout.spatial(2); + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(z_size, 1); EXPECT_EQ(y_size, 2); @@ -975,7 +975,7 @@ TEST(convolution_f32_fw_gpu, basic_convolution3D) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - convolution("conv", "input", { "weights" }, { "biases" })); + convolution("conv", "input", { "weights" }, { "biases" }, {1, 1, 1}, {0, 0, 0}, {1, 1, 1})); network network(engine, topology); network.set_input_data("input", input); @@ -988,11 +988,11 @@ TEST(convolution_f32_fw_gpu, basic_convolution3D) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int z_size = output_layout.size.spatial[2]; - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int z_size = output_layout.spatial(2); + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfzyx); EXPECT_EQ(z_size, 3); EXPECT_EQ(y_size, 3); @@ -1010,11 +1010,11 @@ TEST(convolution_f32_fw_gpu, basic_convolution3D) { } TEST(convolution_f32_fw_gpu, basic_convolution3D_group2) { - // data is similar as in basic_convolution3D + // data is similar as in basic_convolution3D_split2 auto& engine = get_test_engine(); - auto input = engine.allocate_memory({ data_types::f32, format::bfzyx, { 1, 2, 4, 4, 4 } }); - auto weights_1 = engine.allocate_memory({ data_types::f32, format::goizyx, tensor(cldnn::group(2), cldnn::batch(1), cldnn::feature(1), cldnn::spatial(2, 2, 2))}); - auto biases_1 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor(feature(2)) }); + auto input = engine.allocate_memory({ data_types::f32, format::bfzyx,{ 1, 2, 4, 4, 4 } }); + auto weights = engine.allocate_memory({ data_types::f32, format::goizyx, tensor(format::goizyx, {2, 1, 1, 2, 2, 2 }) }); + auto biases = engine.allocate_memory({ data_types::f32, format::bfzyx,{ 1, 2, 1, 1, 1 } }); set_values(input, { 1.0f, 0.0f, 1.0f, 0.0f, @@ -1051,7 +1051,7 @@ TEST(convolution_f32_fw_gpu, basic_convolution3D_group2) { 1.0f, 1.0f, 0.0f, 2.0f, }); - set_values(weights_1, { + set_values(weights, { 0.0f, 1.0f, 0.0f, 0.0f, 2.0f, 1.0f, @@ -1062,7 +1062,7 @@ TEST(convolution_f32_fw_gpu, basic_convolution3D_group2) { 0.0f, 0.0f, }); - set_values(biases_1, { 1.0f, 2.0f }); + set_values(biases, { 1.0f, 2.0f }); VVVVF output_vec = { { @@ -1103,9 +1103,9 @@ TEST(convolution_f32_fw_gpu, basic_convolution3D_group2) { topology topology( input_layout("input", input->get_layout()), - data("weights_1", weights_1), - data("biases_1", biases_1), - convolution("conv", "input", { "weights_1" }, { "biases_1" }, 2, tensor(1), tensor(0), tensor(1), tensor{ 1, 2, 3, 3, 3 }, data_types::f32, true)); + data("weights", weights), + data("biases", biases), + convolution("conv", "input", { "weights" }, { "biases" }, 2, {1, 1, 1}, {0, 0, 0}, {1, 1, 1})); network network(engine, topology); network.set_input_data("input", input); @@ -1118,17 +1118,17 @@ TEST(convolution_f32_fw_gpu, basic_convolution3D_group2) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int z_size = output_layout.size.spatial[2]; - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int z_size = output_layout.spatial(2); + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfzyx); + EXPECT_EQ(b_size, 1); + EXPECT_EQ(f_size, 2); EXPECT_EQ(z_size, 3); EXPECT_EQ(y_size, 3); EXPECT_EQ(x_size, 3); - EXPECT_EQ(b_size, 1); - EXPECT_EQ(f_size, 2); for (int f = 0; f < f_size; ++f) { for (int z = 0; z < z_size; ++z) { for (int y = 0; y < y_size; ++y) { @@ -1152,8 +1152,8 @@ TEST(convolution_f32_fw_gpu, with_output_size_same_input) { input_layout("input", input->get_layout()), data("weights", weights), data("weights2", weights2), - convolution::create_with_output_size("conv1", "input", { "weights" }, { 1, 64, 160, 160 }, { 1, 1, 2, 2 }, { 0, 0, -3, -3 }), - convolution::create_with_output_size("conv2", "input", { "weights2" }, { 1, 64, 320, 320 }, { 1, 1, 1, 1 }, { 0, 0, -3, -3 }) + convolution::create_with_output_size("conv1", "input", { "weights" }, { 1, 64, 160, 160 }, { 2, 2 }, { 3, 3 }), + convolution::create_with_output_size("conv2", "input", { "weights2" }, { 1, 64, 320, 320 }, { 1, 1 }, { 3, 3 }) ); network network(engine, topology); @@ -1208,10 +1208,10 @@ TEST(convolution_f32_fw_gpu, three_convolutions_same_weights) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 2); @@ -1266,7 +1266,7 @@ TEST(convolution_f32_fw_gpu, basic_convolution) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - convolution( "conv", "input", { "weights" }, { "biases" }, { 0, 0, 1, 2 })); + convolution( "conv", "input", { "weights" }, { "biases" }, {2, 1})); network network(engine, topology); network.set_input_data("input", input); @@ -1279,10 +1279,10 @@ TEST(convolution_f32_fw_gpu, basic_convolution) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::yxfb); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); @@ -1325,13 +1325,7 @@ TEST(convolution_f32_fw_gpu, basic_convolution_bfyx_weights_as_input_layout) { input_layout("input", input->get_layout()), input_layout("weights", weights->get_layout()), input_layout("biases", biases->get_layout()), - convolution("conv", "input", - { "weights" } - , - { "biases" } - , - { 0, 0, 1, 2 } - )); + convolution("conv", "input", { "weights" }, { "biases" }, { 2, 1 }, { 0, 0 })); cldnn::build_options options; options.set_option(cldnn::build_option::optimize_data(true)); network network(engine, topology, options); @@ -1346,10 +1340,10 @@ TEST(convolution_f32_fw_gpu, basic_convolution_bfyx_weights_as_input_layout) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); @@ -1420,9 +1414,9 @@ TEST(convolution_f32_fw_gpu, basic_convolution_input_padding) { "input", { "weights" }, { "biases" }, - { 1, 1, 1, 1 }, - tensor{ { 0, 0, 1, 2 }, 0 }, - { 1, 1, 1, 1 }, + { 1, 1 }, + { 2, 1 }, + { 1, 1 }, "", padding{ { 0, 0, 0, 0 }, 0 }) ); @@ -1438,10 +1432,10 @@ TEST(convolution_f32_fw_gpu, basic_convolution_input_padding) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::yxfb); EXPECT_EQ(y_size, 6); EXPECT_EQ(x_size, 5); @@ -1521,11 +1515,11 @@ TEST(convolution_f32_fw_gpu, basic_convolution_sym_input_padding) { "input", { "weights" }, { "biases" }, - { 1, 1, 1, 1 }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }, - { 0, 0, 1, 2 }, - { 0, 0, 1, 2 }, + { 1, 1 }, + { 0, 0 }, + { 1, 1 }, + { 2, 1 }, + { 2, 1 }, "", padding{ { 0, 0, 0, 0 }, 0 }) ); @@ -1541,10 +1535,10 @@ TEST(convolution_f32_fw_gpu, basic_convolution_sym_input_padding) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::yxfb); EXPECT_EQ(y_size, 6); EXPECT_EQ(x_size, 5); @@ -1619,11 +1613,11 @@ TEST(convolution_f32_fw_gpu, basic_convolution_asym_input_padding) { "input", { "weights" }, { "biases" }, - { 1, 1, 1, 1 }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }, - tensor{ { 0, 0, 1, 2 }, 0 }, - tensor{ { 0, 0, 2, 3 }, 0 }, + { 1, 1 }, + { 0, 0 }, + { 1, 1 }, + { 2, 1 }, + { 3, 2 }, "", padding{ { 0, 0, 0, 0 }, 0 })); @@ -1638,10 +1632,10 @@ TEST(convolution_f32_fw_gpu, basic_convolution_asym_input_padding) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::yxfb); EXPECT_EQ(y_size, 7); EXPECT_EQ(x_size, 6); @@ -1726,11 +1720,11 @@ TEST(convolution_f32_fw_gpu, basic_convolution_sym_input_padding_with_pad) { "input", { "weights" }, { "biases" }, - { 1, 1, 1, 1 }, - { 0, 0, 1, 2 }, - { 1, 1, 1, 1 }, - { 0, 0, 1, 2 }, - { 0, 0, 1, 2 }, + { 1, 1 }, + { 2, 1 }, + { 1, 1 }, + { 2, 1 }, + { 2, 1 }, "", padding{ { 0, 0, 0, 0 }, 0 }) ); @@ -1746,10 +1740,10 @@ TEST(convolution_f32_fw_gpu, basic_convolution_sym_input_padding_with_pad) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::yxfb); EXPECT_EQ(y_size, 10); EXPECT_EQ(x_size, 7); @@ -1837,11 +1831,11 @@ TEST(convolution_f32_fw_gpu, basic_convolution_asym_input_padding_with_pad) { "input", { "weights" }, { "biases" }, - { 1, 1, 1, 1 }, - tensor{ { 0, 0, 1, 2 }, 0 }, - { 1, 1, 1, 1 }, - tensor{ { 0, 0, 1, 2 }, 0 }, - tensor{ { 0, 0, 2, 3 }, 0 }, + { 1, 1 }, + { 2, 1 }, + { 1, 1 }, + { 2, 1 }, + { 3, 2 }, "", padding{ { 0, 0, 0, 0 }, 0 })); @@ -1856,10 +1850,10 @@ TEST(convolution_f32_fw_gpu, basic_convolution_asym_input_padding_with_pad) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::yxfb); EXPECT_EQ(y_size, 11); EXPECT_EQ(x_size, 8); @@ -1937,11 +1931,11 @@ TEST(convolution_f32_fw_gpu, basic_convolution_input_and_output_padding) { "input", { "weights" }, { "biases" }, - { 1, 1, 1, 1 }, - tensor{ { 0, 0, 1, 2 }, 0 }, - { 1, 1, 1, 1 }, + { 1, 1 }, + { 2, 1 }, + { 1, 1 }, "", - padding{ { 0, 0, -x_pad, -y_pad }, 0 }) + padding{ { 0,0,x_pad,y_pad }, 0 }) ); network network(engine, topology); @@ -1953,19 +1947,25 @@ TEST(convolution_f32_fw_gpu, basic_convolution_input_and_output_padding) { auto output_memory = outputs.at("conv").get_memory(); auto output_layout = output_memory->get_layout(); - auto output_size = output_layout.get_buffer_size(); + auto padded_dims = output_layout.get_padded_dims(); + auto non_padded_dims = output_layout.get_dims(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_size.spatial[1]; - int x_size = output_size.spatial[0]; - int f_size = output_size.feature[0]; - int b_size = output_size.batch[0]; + int b_size = padded_dims[0]; + int f_size = padded_dims[1]; + int y_size = padded_dims[2]; + int x_size = padded_dims[3]; EXPECT_EQ(output_layout.format, format::yxfb); EXPECT_EQ(y_size, 8); EXPECT_EQ(x_size, 9); EXPECT_EQ(f_size, 1); EXPECT_EQ(b_size, 1); + EXPECT_EQ(non_padded_dims[0], 1); + EXPECT_EQ(non_padded_dims[1], 1); + EXPECT_EQ(non_padded_dims[2], 6); + EXPECT_EQ(non_padded_dims[3], 5); + for (int y = y_pad; y < y_size - y_pad; ++y) { for (int x = x_pad; x < x_size - x_pad; ++x) @@ -2036,7 +2036,7 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2_wstr2x2_in4x4x1x1_nopad_random) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - convolution("conv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }) + convolution("conv", "input", { "weights" }, { "biases" }, { 2, 2 }) ); network network(engine, topology); @@ -2106,7 +2106,7 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2_wstr2x2_in2x2x1x2_nopad_random) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - convolution("conv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }) + convolution("conv", "input", { "weights" }, { "biases" }, { 2, 2 }) ); network network(engine, topology); @@ -2164,7 +2164,7 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2_wstr2x2_in4x4x1x1_nopad) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - convolution("conv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }) + convolution("conv", "input", { "weights" }, { "biases" }, { 2, 2 }) ); network network(engine, topology); @@ -2218,7 +2218,7 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2_wstr2x2_in2x2x1x2_nopad) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - convolution("conv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 } ) + convolution("conv", "input", { "weights" }, { "biases" }, { 2, 2 } ) ); network network(engine, topology); @@ -2270,7 +2270,7 @@ TEST(convolution_f32_fw_gpu, basic_ofm_wsiz2x1x2x1_in1x2x1_nopad) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - convolution("conv", "input", { "weights" }, { "biases" }, { 1, 1, 5, 5 }) + convolution("conv", "input", { "weights" }, { "biases" }, { 5, 5 }) ); network network(engine, topology); @@ -2329,7 +2329,7 @@ TEST(convolution_f32_fw_gpu, basic_ofm_wsiz3x2x2x1_in2x2x1_nopad) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - convolution("conv", "input", { "weights" }, { "biases" }, { 1, 1, 5, 5 }) + convolution("conv", "input", { "weights" }, { "biases" }, { 5, 5 }) ); network network(engine, topology); @@ -2385,7 +2385,7 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2x1x3_wstr2x2_in2x2x1x1_nopad) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - convolution("conv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }) + convolution("conv", "input", { "weights" }, { "biases" }, { 2, 2 }) ); network network(engine, topology); @@ -2441,7 +2441,7 @@ TEST(convolution_f32_fw_gpu, wsiz3x3_wstr2x2_in2x2x1x1_zeropad) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - convolution("conv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }) + convolution("conv", "input", { "weights" }, { "biases" }, { 2, 2 }) ); network network(engine, topology); @@ -2503,9 +2503,9 @@ TEST(convolution_f32_fw_gpu, offsets_wsiz3x3_wstr2x2_in2x2x1x1_zeropad) { "input", { "weights" }, { "biases" }, - { 1, 1, 2, 2 }, - tensor{ { 0, 0, 1, 1 }, 0 }, - { 1, 1, 1, 1 }, + { 2, 2 }, + { 1, 1 }, + { 1, 1 }, "", padding{ { 0, 0, 1, 1 }, 0 }) ); @@ -2585,9 +2585,9 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2_wstr2x2_in4x4x2x1_nopad_split2) { { "weights1" }, { "biases1" }, 2, - { 0, 0, 2, 2 }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }) + { 2, 2 }, + { 0, 0 }, + { 1, 1 }) ); network network(engine, topology); @@ -2683,9 +2683,9 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2_wstr2x2_in4x4x2x2_nopad_split2) { { "weights1" }, { "biases1" }, 2, - { 1, 1, 2, 2 }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }) + { 2, 2 }, + { 0, 0 }, + { 1, 1 }) ); network network(engine, topology); @@ -2747,9 +2747,9 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2_wstr2x2_in4x4x2x1_nopad_group2) { { "weights" }, { "biases" }, 2, // number of groups - { 0, 0, 2, 2 }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }) + { 2, 2 }, + { 0, 0 }, + { 1, 1 }) ); network network(engine, topology); @@ -2805,9 +2805,9 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2_wstr2x2_in4x4x2x1_nopad_group2_bfyx) { "weights" }, { "biases" }, 2, // number of groups - { 0, 0, 2, 2 }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }) + { 2, 2 }, + { 0, 0 }, + { 1, 1 }) ); network network(engine, topology); @@ -2862,9 +2862,9 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2_wstr2x2_in4x4x2x2_nopad_group2) { { "weights" }, { "biases" }, 2, // number of groups - { 1, 1, 2, 2 }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }) + { 2, 2 }, + { 0, 0 }, + { 1, 1 }) ); network network(engine, topology); @@ -2957,9 +2957,9 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2_wstr2x2_in4x4x2x2_nopad_split2_depthw { weights_id }, { bias_id }, 16, // number of groups - { 1, 1, 2, 2 }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }) + { 2, 2 }, + { 0, 0 }, + { 1, 1 }) ); network network(engine, topology); @@ -3046,9 +3046,9 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2_wstr2x2_in4x4x2x2_nopad_split2_depthw { weights_id }, { bias_id }, 16, // number of groups - { 1, 1, 2, 2 }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }) + { 2, 2 }, + { 0, 0 }, + { 1, 1 }) ); network network(engine, topology); @@ -3145,9 +3145,9 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2_wstr2x2_in4x4x2x2_nopad_group16) { { "weights" }, { "bias" }, 16, - { 1, 1, 2, 2 }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }) + { 2, 2 }, + { 0, 0 }, + { 1, 1 }) ); network network(engine, topology); @@ -3240,9 +3240,9 @@ TEST(convolution_f32_fw_gpu, basic_wsiz2x2_wstr2x2_in4x4x2x2_nopad_group16_bfyx) { "weights" }, { "bias" }, 16, - { 1, 1, 2, 2 }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }) + { 2, 2 }, + { 0, 0 }, + { 1, 1 }) ); network network(engine, topology); @@ -3577,9 +3577,9 @@ TEST(convolution_gpu, trivial_convolution_relu) { "input", { "weights" }, { "biases" }, - { 1, 1, 2, 2 }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }), + { 2, 2 }, + { 0, 0 }, + { 1, 1 }), activation( "out", "conv", @@ -3654,9 +3654,9 @@ TEST(convolution_gpu, relu_with_negative_slope) { "input", { "weights" }, { "biases" }, - { 1, 1, 2, 2 }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }), + { 2, 2 }, + { 0, 0 }, + { 1, 1 }), activation( "out", "conv", @@ -3727,10 +3727,10 @@ TEST(convolution_gpu, DISABLED_two_1x1_kernels_after_each_other) { cldnn::mem_lock output_ptr(output_prim, get_test_stream()); auto output_layout = output_prim->get_layout(); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); int f_offset = y_size * x_size; int b_offset = f_size * f_offset; for (int b = 0; b < b_size; ++b) { @@ -3882,9 +3882,9 @@ TEST(convolution_gpu, basic_yxfb_4_4_yxfb_2_2_b16_if2_of16_st2_2_p0_sp1_fp32) "input", { "weights" }, { "biases" }, - { 1, 1, stride_x, stride_y }, - { 0, 0, 0, 0 }, - { 1, 1, 1, 1 }), + { stride_y, stride_x }, + { 0, 0 }, + { 1, 1 }), activation( "out", "conv", @@ -3942,7 +3942,7 @@ void add_primitives(engine& engine, topology& topology) { topology.add( data("weights", weights), data("biases", biases), - convolution("conv", "input", { "weights" }, { "biases" }, { 0, 0, 1, 2 }, { 0, 0, 0, 0 }, { 1, 1, 1, 1 }), + convolution("conv", "input", { "weights" }, { "biases" }, { 2, 1 }, { 0, 0 }, { 1, 1 }), activation( "out", "conv", activation_func::relu) ); } @@ -4009,10 +4009,10 @@ TEST(convolution_f32_fw_gpu, byte_activation) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); @@ -4060,7 +4060,7 @@ TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_symmetric) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - convolution("conv", "input", { "weights" }, { "biases" }, tensor{ 0, 0, 2, 2 }, tensor(0), tensor{ 1, 1, 1, 1 }, tensor{ 1, 2, 3, 2 }), + convolution("conv", "input", { "weights" }, { "biases" }, { 2, 2 }, {0, 0}, { 1, 1 }, tensor{ 1, 2, 3, 2 }), reorder("out", "conv", format::bfyx, data_types::f32)); build_options opts; @@ -4075,10 +4075,10 @@ TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_symmetric) { cldnn::mem_lock output_ptr(output_memory, get_test_stream()); auto output_layout = output_memory->get_layout(); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); @@ -4134,7 +4134,7 @@ TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_asymmetric_weight_an data("a_zp", a_zp), data("w_zp", w_zp), convolution("conv", "input", { "weights" }, { "biases" }, { "w_zp" }, { "a_zp" }, 1, data_types::f32, - tensor{ 0, 0, 2, 2 }, tensor(0), tensor{ 1, 1, 1, 1 }, tensor{ 1, 2, 3, 2 }, false), + { 2, 2 }, { 0, 0 }, { 1, 1 }, tensor{ 1, 2, 3, 2 }, false), reorder("out", "conv", format::bfyx, data_types::f32)); build_options opts; @@ -4149,10 +4149,10 @@ TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_asymmetric_weight_an cldnn::mem_lock output_ptr(output_memory, get_test_stream()); auto output_layout = output_memory->get_layout(); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); @@ -4205,7 +4205,7 @@ TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_asymmetric_activatio data("biases", biases), data("a_zp", a_zp), convolution("conv", "input", { "weights" }, { "biases" }, { }, { "a_zp" }, 1, data_types::f32, - tensor{ 0, 0, 2, 2 }, tensor(0), tensor{ 1, 1, 1, 1 }, tensor{ 1, 2, 3, 2 }, false), + { 2, 2 }, { 0, 0 }, { 1, 1 }, tensor{ 1, 2, 3, 2 }, false), reorder("out", "conv", format::bfyx, data_types::f32)); build_options opts; @@ -4220,10 +4220,10 @@ TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_asymmetric_activatio cldnn::mem_lock output_ptr(output_memory, get_test_stream()); auto output_layout = output_memory->get_layout(); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); @@ -4290,7 +4290,7 @@ TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_asymmetric_activatio data("biases", biases), data("a_zp", a_zp), convolution("conv", "input", { "weights" }, { "biases" }, { }, { "a_zp" }, 1, data_types::f32, - tensor{ 0, 0, 2, 2 }, tensor(0), tensor{ 1, 1, 1, 1 }, tensor{ 1, 2, 3, 2 }, false), + { 2, 2 }, { 0, 0 }, { 1, 1 }, tensor{ 1, 2, 3, 2 }, false), reorder("out", "conv", format::bfyx, data_types::f32)); build_options opts; @@ -4305,10 +4305,10 @@ TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_asymmetric_activatio cldnn::mem_lock output_ptr(output_memory, get_test_stream()); auto output_layout = output_memory->get_layout(); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); @@ -4391,7 +4391,7 @@ TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_asymmetric_activatio activation("activation", "input", activation_func::relu), // needed just to add padding eltwise("in", { "activation", "a_zp" }, eltwise_mode::sub, data_types::f32), convolution("conv", "in", { "weights" }, { "biases" }, 1, - tensor{ 0, 0, 2, 2 }, tensor(0), tensor{ 1, 1, 1, 1 }, tensor{ 1, 2, 3, 2 }, data_types::f32, false), + { 2, 2 }, { 0, 0 }, { 1, 1 }, tensor{ 1, 2, 3, 2 }, data_types::f32, false), reorder("out", "conv", format::bfyx, data_types::f32)); build_options opts; @@ -4406,10 +4406,10 @@ TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_asymmetric_activatio cldnn::mem_lock output_ptr(output_memory, get_test_stream()); auto output_layout = output_memory->get_layout(); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); @@ -4462,7 +4462,7 @@ TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_asymmetric_weights_p data("biases", biases), data("w_zp", w_zp), convolution("conv", "input", { "weights" }, { "biases" }, { "w_zp" }, { }, 1, data_types::f32, - tensor{ 0, 0, 2, 2 }, tensor(0), tensor{ 1, 1, 1, 1 }, tensor{ 1, 2, 3, 2 }, false), + { 2, 2 }, { 0, 0 }, { 1, 1 }, tensor{ 1, 2, 3, 2 }, false), reorder("out", "conv", format::bfyx, data_types::f32)); build_options opts; @@ -4477,10 +4477,10 @@ TEST(convolution_int8_fw_gpu, quantized_convolution_u8s8f32_asymmetric_weights_p cldnn::mem_lock output_ptr(output_memory, get_test_stream()); auto output_layout = output_memory->get_layout(); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); @@ -4659,7 +4659,7 @@ TEST(convolution_gpu, basic_yxfb_4_4_yxfb_2_2_b16_if2_of16_st2_2_p0_sp1_fp16) "cvt_input", { "cvt_weights" }, { "cvt_biases" }, - { 1, 1, stride_x, stride_y }), + { stride_y, stride_x }), reorder("output", "conv", { data_types::f32, output_format, output_size }) ); @@ -4905,7 +4905,7 @@ TEST_P(convolution_gpu_fs_byx_fsv32, fs_byx_fsv32) const int input_f = testing::get<1>(GetParam()); const int output_f = 64; const int filter_xy = testing::get<0>(GetParam()); - const int stride = testing::get<2>(GetParam()); + const uint64_t stride = testing::get<2>(GetParam()); const int output_padding = testing::get<3>(GetParam()); const bool with_bias = testing::get<4>(GetParam()); const int pad = filter_xy / 2; @@ -4960,7 +4960,7 @@ TEST_P(convolution_gpu_fs_byx_fsv32, fs_byx_fsv32) topology.add(data("biases_fsv", biases_mem)); auto conv_fsv = convolution("conv_fsv", "input_fsv", { "weights_fsv" }, { "biases_fsv" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad }, 0 }); + { stride, stride }, { pad, pad }); conv_fsv.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_fsv); @@ -4983,7 +4983,7 @@ TEST_P(convolution_gpu_fs_byx_fsv32, fs_byx_fsv32) } auto conv_fsv = convolution("conv_fsv", "input_fsv", { "weights_fsv" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad }, 0 }); + { stride, stride }, { pad, pad }); conv_fsv.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_fsv); @@ -5039,7 +5039,7 @@ TEST(convolution_f16_fsv_gpu, convolution_f16_fsv_gpu_padding) { const int input_f = 96; const int output_f = 192; const int filter_xy = 1; - const int stride = 1; + const uint64_t stride = 1; const int output_xy = 1 + (input_xy - filter_xy) / stride; auto input_size = tensor(batch_num, input_f, input_xy, input_xy); @@ -5087,7 +5087,7 @@ TEST(convolution_f16_fsv_gpu, convolution_f16_fsv_gpu_padding) { topology.add(data("biases_fsv", biases_mem)); auto conv_fsv = convolution("conv_fsv", "input_fsv", { "weights_fsv" }, { "biases_fsv" }, - { 1, 1, stride, stride }, { 0, 0, 0, 0 }); + { stride, stride }, { 0, 0 }); topology.add(conv_fsv); @@ -5170,7 +5170,7 @@ TEST_P(convolution_gpu_fs_byx_fsv32_crop, fs_byx_fsv32_crop) const int input_xy = testing::get<1>(GetParam()); const int input_f = testing::get<2>(GetParam()); const int output_f = input_f; - const int stride = testing::get<3>(GetParam()); + const uint64_t stride = testing::get<3>(GetParam()); const int output_padding = testing::get<4>(GetParam()); const bool with_bias = testing::get<5>(GetParam()); @@ -5251,7 +5251,7 @@ TEST_P(convolution_gpu_fs_byx_fsv32_crop, fs_byx_fsv32_crop) topology.add(data("biases_fsv", biases_mem)); auto conv_fsv = convolution("conv_fsv", "right_crop", { "weights_fsv" }, { "biases_fsv" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad }, 0 }); + { stride, stride }, { pad, pad }); conv_fsv.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_fsv); } @@ -5273,7 +5273,7 @@ TEST_P(convolution_gpu_fs_byx_fsv32_crop, fs_byx_fsv32_crop) } auto conv_fsv = convolution("conv_fsv", "right_crop", { "weights_fsv" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad }, 0 }); + { stride, stride }, { pad, pad }); conv_fsv.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_fsv); } @@ -5368,7 +5368,7 @@ TEST(convolution_f32_fw_gpu, convolution_int8_b_fs_yx_fsv4_to_bfyx) { reorder("to_int", "input", { data_types::i8, format::bfyx, { batch_num, input_f, input_size_x, input_size_y } }), data("weights", weights), data("biases", biases), - convolution("conv", "to_int", { "weights" }, { "biases" }, { 1, 1, 1, 1 }, tensor{ { 0, 0, 2, 2 }, 0 }, { 1, 1, 1, 1 }, "", + convolution("conv", "to_int", { "weights" }, { "biases" }, { 1, 1 }, { 2, 2 }, { 1, 1 }, "", padding{ { 0, 0, output_padding, output_padding }, 0 }), reorder("output", "conv", { data_types::f32, format::bfyx, { batch_num, input_f, input_size_x, input_size_y } })); @@ -5390,7 +5390,7 @@ TEST(convolution_f32_fw_gpu, convolution_int8_b_fs_yx_fsv4_to_bfyx) { reorder("to_int", "input", { data_types::i8,format::b_fs_yx_fsv4, { batch_num, input_f, input_size_x, input_size_y } }), data("weights", weights), data("biases", biases), - convolution("conv", "to_int", { "weights" }, { "biases" }, { 1, 1, 1, 1 }, tensor{ { 0, 0, 2, 2 }, 0 }, { 1, 1, 1, 1 }, "", + convolution("conv", "to_int", { "weights" }, { "biases" }, { 1, 1 }, { 2, 2 }, { 1, 1 }, "", padding{ { 0, 0, output_padding, output_padding }, 0 }), reorder("output", "conv", { data_types::f32,format::bfyx, { batch_num, input_f, input_size_x, input_size_y } })); @@ -5408,10 +5408,10 @@ TEST(convolution_f32_fw_gpu, convolution_int8_b_fs_yx_fsv4_to_bfyx) { auto output_memory_act = outputs_act.at("output").get_memory(); cldnn::mem_lock output_act_ptr(output_memory_act, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 720); EXPECT_EQ(x_size, 1280); @@ -5442,7 +5442,7 @@ TEST(convolution_gpu, bfyx_iyxo_5x5_fp16) const int input_f = 32; const int filter_xy = 5; - const int stride = 1; + const uint64_t stride = 1; const int output_padding = 0; const bool with_bias = false; const int input_size_x = 64; @@ -5502,7 +5502,7 @@ TEST(convolution_gpu, bfyx_iyxo_5x5_fp16) topology.add(data("biases_fsv", biases_mem)); auto conv_fsv = convolution("conv_fsv", "input", { "weights_fsv" }, { "biases_fsv" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad }, 0 }); + { stride, stride }, { pad, pad }); conv_fsv.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_fsv); @@ -5527,7 +5527,7 @@ TEST(convolution_gpu, bfyx_iyxo_5x5_fp16) auto conv_fsv = convolution("conv_fsv", "input", { "weights_fsv" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad }, 0 }); + { stride, stride }, { pad, pad }); conv_fsv.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_fsv); @@ -5672,7 +5672,7 @@ TEST_P(convolution_gpu_block_layout3D, bfzyx_bsv16_fsv16_fp32) const int input_f = testing::get<1>(GetParam()); const int output_f = testing::get<2>(GetParam()); const int filter_xy = testing::get<3>(GetParam()); - const int stride = testing::get<4>(GetParam()); + const uint64_t stride = testing::get<4>(GetParam()); const int output_padding = testing::get<5>(GetParam()); const bool with_bias = testing::get<6>(GetParam()); const int input_xy = testing::get<7>(GetParam()); @@ -5730,7 +5730,7 @@ TEST_P(convolution_gpu_block_layout3D, bfzyx_bsv16_fsv16_fp32) topology.add(data("biases", biases_mem)); auto conv_bsv16_fsv16 = convolution("conv_bsv16_fsv16", "input_bsv16_fsv16", { "weights" }, { "biases" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad, 0 }, 0 }); + { 1, stride, stride }, { 0, pad, pad }); conv_bsv16_fsv16.output_padding = padding({ 0, 0, output_padding, output_padding, 0 }, 0.f); topology.add(conv_bsv16_fsv16); @@ -5753,7 +5753,7 @@ TEST_P(convolution_gpu_block_layout3D, bfzyx_bsv16_fsv16_fp32) } auto conv_bsv16_fsv16 = convolution("conv_bsv16_fsv16", "input_bsv16_fsv16", { "weights" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad, 0 }, 0 }); + { 1, stride, stride }, { 0, pad, pad }); conv_bsv16_fsv16.output_padding = padding({ 0, 0, output_padding, output_padding, 0 }, 0.f); topology.add(conv_bsv16_fsv16); @@ -5808,7 +5808,7 @@ TEST_P(convolution_gpu_block_layout3D, bfzyx_bsv16_fsv16_fp16) const int input_f = testing::get<1>(GetParam()); const int output_f = testing::get<2>(GetParam()); const int filter_xy = testing::get<3>(GetParam()); - const int stride = testing::get<4>(GetParam()); + const uint64_t stride = testing::get<4>(GetParam()); const int output_padding = testing::get<5>(GetParam()); const bool with_bias = testing::get<6>(GetParam()); const int input_xy = testing::get<7>(GetParam()); @@ -5867,7 +5867,7 @@ TEST_P(convolution_gpu_block_layout3D, bfzyx_bsv16_fsv16_fp16) topology.add(data("biases", biases_mem)); auto conv_bsv16_fsv16 = convolution("conv_bsv16_fsv16", "input_bsv16_fsv16", { "weights" }, { "biases" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad, 0 }, 0 }); + { 1, stride, stride }, { 0, pad, pad }); conv_bsv16_fsv16.output_padding = padding({ 0, 0, output_padding, output_padding, 0 }, 0.f); topology.add(conv_bsv16_fsv16); @@ -5890,7 +5890,7 @@ TEST_P(convolution_gpu_block_layout3D, bfzyx_bsv16_fsv16_fp16) } auto conv_bsv16_fsv16 = convolution("conv_bsv16_fsv16", "input_bsv16_fsv16", { "weights" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad, 0 }, 0 }); + { 1, stride, stride }, { 0, pad, pad }); conv_bsv16_fsv16.output_padding = padding({ 0, 0, output_padding, output_padding, 0 }, 0.f); topology.add(conv_bsv16_fsv16); @@ -5938,7 +5938,7 @@ TEST_P(convolution_gpu_block_layout3D, bfzyx_bsv16_fsv16_fp32_fused_ops) const int input_f = testing::get<1>(GetParam()); const int output_f = testing::get<2>(GetParam()); const int filter_xy = testing::get<3>(GetParam()); - const int stride = testing::get<4>(GetParam()); + const uint64_t stride = testing::get<4>(GetParam()); const int output_padding = testing::get<5>(GetParam()); const bool with_bias = testing::get<6>(GetParam()); const int input_xy = testing::get<7>(GetParam()); @@ -5996,7 +5996,7 @@ TEST_P(convolution_gpu_block_layout3D, bfzyx_bsv16_fsv16_fp32_fused_ops) topology.add(data("biases", biases_mem)); auto conv_bsv16_fsv16 = convolution("conv_bsv16_fsv16", "input_bsv16_fsv16", { "weights" }, { "biases" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad, 0 }, 0 }); + { 1, stride, stride }, { 0, pad, pad }); conv_bsv16_fsv16.output_padding = padding({ 0, 0, output_padding, output_padding, 0 }, 0.f); topology.add(conv_bsv16_fsv16); @@ -6019,7 +6019,7 @@ TEST_P(convolution_gpu_block_layout3D, bfzyx_bsv16_fsv16_fp32_fused_ops) } auto conv_bsv16_fsv16 = convolution("conv_bsv16_fsv16", "input_bsv16_fsv16", { "weights" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad, 0 }, 0 }); + { 1, stride, stride }, { 0, pad, pad }); conv_bsv16_fsv16.output_padding = padding({ 0, 0, output_padding, output_padding, 0 }, 0.f); topology.add(conv_bsv16_fsv16); @@ -6103,7 +6103,7 @@ TEST_P(convolution_gpu_block_layout, bfyx_bsv16_fsv16_fp32) const int input_f = testing::get<1>(GetParam()); const int output_f = testing::get<2>(GetParam()); const int filter_xy = testing::get<3>(GetParam()); - const int stride = testing::get<4>(GetParam()); + const uint64_t stride = testing::get<4>(GetParam()); const int output_padding = testing::get<5>(GetParam()); const bool with_bias = testing::get<6>(GetParam()); const int pad = filter_xy / 2; @@ -6164,7 +6164,7 @@ TEST_P(convolution_gpu_block_layout, bfyx_bsv16_fsv16_fp32) topology.add(data("biases", biases_mem)); auto conv_bsv16_fsv16 = convolution("conv_bsv16_fsv16", "input_bsv16_fsv16", { "weights" }, { "biases" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad }, 0 }); + { stride, stride }, { pad, pad }); conv_bsv16_fsv16.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_bsv16_fsv16); @@ -6187,7 +6187,7 @@ TEST_P(convolution_gpu_block_layout, bfyx_bsv16_fsv16_fp32) } auto conv_bsv16_fsv16 = convolution("conv_bsv16_fsv16", "input_bsv16_fsv16", { "weights" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad }, 0 }); + { stride, stride }, { pad, pad }); conv_bsv16_fsv16.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_bsv16_fsv16); @@ -6242,7 +6242,7 @@ TEST_P(convolution_gpu_block_layout, bfyx_bsv16_fsv16_fp16) const int input_f = testing::get<1>(GetParam()); const int output_f = testing::get<2>(GetParam()); const int filter_xy = testing::get<3>(GetParam()); - const int stride = testing::get<4>(GetParam()); + const uint64_t stride = testing::get<4>(GetParam()); const int output_padding = testing::get<5>(GetParam()); const bool with_bias = testing::get<6>(GetParam()); const int pad = filter_xy / 2; @@ -6304,7 +6304,7 @@ TEST_P(convolution_gpu_block_layout, bfyx_bsv16_fsv16_fp16) topology.add(data("biases", biases_mem)); auto conv_bsv16_fsv16 = convolution("conv_bsv16_fsv16", "input_bsv16_fsv16", { "weights" }, { "biases" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad }, 0 }); + { stride, stride }, { pad, pad }); conv_bsv16_fsv16.output_padding = padding({ 0, 0, output_padding, output_padding, 0 }, 0.f); topology.add(conv_bsv16_fsv16); @@ -6327,7 +6327,7 @@ TEST_P(convolution_gpu_block_layout, bfyx_bsv16_fsv16_fp16) } auto conv_bsv16_fsv16 = convolution("conv_bsv16_fsv16", "input_bsv16_fsv16", { "weights" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad }, 0 }); + { stride, stride }, { pad, pad }); conv_bsv16_fsv16.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_bsv16_fsv16); @@ -6381,7 +6381,7 @@ TEST_P(convolution_gpu_block_layout, bfyx_bsv16_fsv16_fp32_fused_ops) const int input_f = testing::get<1>(GetParam()); const int output_f = testing::get<2>(GetParam()); const int filter_xy = testing::get<3>(GetParam()); - const int stride = testing::get<4>(GetParam()); + const uint64_t stride = testing::get<4>(GetParam()); const int output_padding = testing::get<5>(GetParam()); const bool with_bias = testing::get<6>(GetParam()); const int pad = filter_xy / 2; @@ -6435,7 +6435,7 @@ TEST_P(convolution_gpu_block_layout, bfyx_bsv16_fsv16_fp32_fused_ops) topology.add(data("biases", biases_mem)); auto conv_bsv16_fsv16 = convolution("conv_bsv16_fsv16", "input_bsv16_fsv16", { "weights" }, { "biases" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad }, 0 }); + { stride, stride }, { pad, pad }); conv_bsv16_fsv16.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_bsv16_fsv16); @@ -6458,7 +6458,7 @@ TEST_P(convolution_gpu_block_layout, bfyx_bsv16_fsv16_fp32_fused_ops) } auto conv_bsv16_fsv16 = convolution("conv_bsv16_fsv16", "input_bsv16_fsv16", { "weights" }, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad, pad }, 0 }); + { stride, stride }, { pad, pad }); conv_bsv16_fsv16.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_bsv16_fsv16); @@ -6558,7 +6558,7 @@ TEST_P(convolution_depthwise_gpu, depthwise_conv_fs_b_yx_fsv32) const int output_f = groups; const int filter_y = testing::get<1>(GetParam()); const int filter_x = testing::get<2>(GetParam()); - const int stride = testing::get<4>(GetParam()); + const uint64_t stride = testing::get<4>(GetParam()); const int output_padding = testing::get<5>(GetParam()); const int pad_y = filter_y / 2; const int pad_x = filter_x / 2; @@ -6606,7 +6606,7 @@ TEST_P(convolution_depthwise_gpu, depthwise_conv_fs_b_yx_fsv32) } auto conv_fsv = convolution("conv_fsv", "input_fsv", { "weights_fsv" }, groups, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad_x, pad_y }, 0 }); + { stride, stride }, { pad_y, pad_x }); conv_fsv.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_fsv); @@ -6699,7 +6699,7 @@ TEST_P(convolution_depthwise_gpu_fsv16, depthwise_conv_b_fs_yx_fsv16) const int output_f = groups; const int filter_y = testing::get<1>(GetParam()); const int filter_x = testing::get<2>(GetParam()); - const int stride = testing::get<4>(GetParam()); + const uint64_t stride = testing::get<4>(GetParam()); const int output_padding = testing::get<5>(GetParam()); const int pad_y = filter_y / 2; const int pad_x = filter_x / 2; @@ -6749,7 +6749,7 @@ TEST_P(convolution_depthwise_gpu_fsv16, depthwise_conv_b_fs_yx_fsv16) } auto conv_fsv = convolution("conv_fsv", "input_fsv", { "weights_fsv" }, groups, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad_x, pad_y }, 0 }); + { stride, stride }, { pad_y, pad_x }); conv_fsv.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_fsv); @@ -6802,9 +6802,9 @@ TEST(convolution_depthwise_gpu_fsv16, depthwise_conv_b_fs_yx_fsv16_in_feature_pa auto input_size = tensor{ 1, num_groups, 1, 2 }; auto weights_size = tensor(group(num_groups), batch(1), feature(1), spatial(1, 1)); auto bias_size = tensor{ 1, num_groups, 1, 1 }; - auto stride = tensor{ 1, 1, 1, 1 }; - auto pad = tensor{ 0 }; - auto dilation = tensor{ 1, 1, 1, 1 }; + ov::Strides stride = { 1, 1 }; + ov::CoordinateDiff pad = { 0, 0 }; + ov::Strides dilation = { 1, 1 }; auto output_size = tensor{ 1, num_groups, 1, 2 }; auto input_lower_sizes = { 0, 16, 0, 0 }; auto input_upper_sizes = { 0, 64, 0, 0 }; @@ -6864,10 +6864,10 @@ TEST(convolution_depthwise_gpu_fsv16, depthwise_conv_b_fs_yx_fsv16_in_feature_pa auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); @@ -6909,7 +6909,7 @@ TEST_P(convolution_depthwise_gpu_bfyx, depthwise_conv_bfyx) const int output_f = groups; const int filter_y = testing::get<1>(GetParam()); const int filter_x = testing::get<2>(GetParam()); - const int stride = testing::get<4>(GetParam()); + const uint64_t stride = testing::get<4>(GetParam()); const int output_padding = testing::get<5>(GetParam()); const int pad_y = filter_y / 2; const int pad_x = filter_x / 2; @@ -6956,7 +6956,7 @@ TEST_P(convolution_depthwise_gpu_bfyx, depthwise_conv_bfyx) } auto conv_fsv = convolution("conv", "input", { "weights" }, groups, - { 1, 1, stride, stride }, tensor{ { 0, 0, pad_x, pad_y }, 0 }); + { stride, stride }, { pad_y, pad_x }); conv_fsv.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_fsv); @@ -7109,11 +7109,11 @@ TEST_P(convolution_grouped_gpu, base) { filter_y = testing::get<6>(GetParam()), filter_z = testing::get<7>(GetParam()), groups = testing::get<8>(GetParam()), - stride = testing::get<9>(GetParam()), batch_num = testing::get<10>(GetParam()), pad_z = (filter_z - 1) / 2, pad_y = (filter_y - 1) / 2, pad_x = (filter_x - 1) / 2; + const uint64_t stride = testing::get<9>(GetParam()); const auto has_input_zp = testing::get<11>(GetParam()); const auto has_weights_zp = testing::get<12>(GetParam()); const auto has_comp = testing::get<13>(GetParam()); @@ -7246,9 +7246,12 @@ TEST_P(convolution_grouped_gpu, base) { auto comp = engine.allocate_memory(comp_lay); set_values(comp, comp_val); - auto stride_tensor = tensor(batch(1), feature(1), spatial(stride, stride, stride, 1)); - if (num_in_spatial_dims == 2) { - stride_tensor = tensor(batch(1), feature(1), spatial(stride, stride, 1, 1)); + ov::Strides strides = {stride, stride}; + ov::Strides dilations(num_in_spatial_dims, 1); + ov::CoordinateDiff pad = { pad_y, pad_x }; + if (num_in_spatial_dims == 3) { + strides.insert(strides.begin(), stride); + pad.insert(pad.begin(), pad_z); } topology topology(input_layout("input", input->get_layout()), @@ -7263,9 +7266,9 @@ TEST_P(convolution_grouped_gpu, base) { comp_prim_name, groups, data_types::f32, - stride_tensor, - tensor(batch(0), feature(0), spatial(pad_x, pad_y, pad_z, 0)), - tensor(batch(1), feature(1), spatial(1, 1, 1, 1)), + strides, + pad, + dilations, ref_conv_out_size, true), reorder("out", "conv", { data_types::f32, format::bfzyx, ref_conv_out_size })); @@ -7294,11 +7297,11 @@ TEST_P(convolution_grouped_gpu, base) { auto out_lay = out_mem->get_layout(); ASSERT_EQ(out_mem->get_layout().format, input_data_format); - ASSERT_EQ(out_lay.size.batch[0], expected_result.size()); - ASSERT_EQ(out_lay.size.feature[0], expected_result[0].size()); - ASSERT_EQ(out_lay.size.spatial[2], expected_result[0][0].size()); - ASSERT_EQ(out_lay.size.spatial[1], expected_result[0][0][0].size()); - ASSERT_EQ(out_lay.size.spatial[0], expected_result[0][0][0][0].size()); + ASSERT_EQ(out_lay.batch(), expected_result.size()); + ASSERT_EQ(out_lay.feature(), expected_result[0].size()); + ASSERT_EQ(out_lay.spatial(2), expected_result[0][0].size()); + ASSERT_EQ(out_lay.spatial(1), expected_result[0][0][0].size()); + ASSERT_EQ(out_lay.spatial(0), expected_result[0][0][0][0].size()); for (int bi = 0; bi < batch_num; ++bi) for (int ofi = 0; ofi < output_f; ++ofi) @@ -7355,11 +7358,11 @@ TEST_P(convolution_general_gpu, conv_fp16_cases) { filter_x = testing::get<5>(GetParam()), filter_y = testing::get<6>(GetParam()), groups = testing::get<8>(GetParam()), - stride = testing::get<9>(GetParam()), batch_num = testing::get<10>(GetParam()), output_padding = 0, pad_y = (filter_y - 1) / 2, pad_x = (filter_x - 1) / 2; + const uint64_t stride = testing::get<9>(GetParam()); auto input_data_format = testing::get<11>(GetParam()); auto impl_name = testing::get<12>(GetParam()); auto with_bias = testing::get<13>(GetParam()); @@ -7409,8 +7412,8 @@ TEST_P(convolution_general_gpu, conv_fp16_cases) { { "weights_fsv" }, { "bias" }, groups, - { 1, 1, stride, stride }, - tensor{ { 0, 0, pad_x, pad_y }, 0 }); + { stride, stride }, + { pad_y, pad_x }); conv_fsv.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_fsv); @@ -7435,8 +7438,8 @@ TEST_P(convolution_general_gpu, conv_fp16_cases) { "input_fsv", { "weights_fsv" }, groups, - { 1, 1, stride, stride }, - tensor{ { 0, 0, pad_x, pad_y }, 0 }); + { stride, stride }, + { pad_y, pad_x }); conv_fsv.output_padding = padding({ 0, 0, output_padding, output_padding }, 0.f); topology.add(conv_fsv); } @@ -7454,15 +7457,15 @@ TEST_P(convolution_general_gpu, conv_fp16_cases) { auto out_lay = out_mem->get_layout(); ASSERT_EQ(out_mem->get_layout().format, input_data_format); - ASSERT_EQ(out_lay.size.batch[0], expected_result.size()); - ASSERT_EQ(out_lay.size.feature[0], expected_result[0].size()); - ASSERT_EQ(out_lay.size.spatial[1], expected_result[0][0].size()); - ASSERT_EQ(out_lay.size.spatial[0], expected_result[0][0][0].size()); + ASSERT_EQ(out_lay.batch(), expected_result.size()); + ASSERT_EQ(out_lay.feature(), expected_result[0].size()); + ASSERT_EQ(out_lay.spatial(1), expected_result[0][0].size()); + ASSERT_EQ(out_lay.spatial(0), expected_result[0][0][0].size()); - for (int bi = 0; bi < out_lay.size.batch[0]; ++bi) - for (int ofi = 0; ofi < out_lay.size.feature[0]; ++ofi) - for (int yi = 0; yi < out_lay.size.spatial[1]; ++yi) - for (int xi = 0; xi < out_lay.size.spatial[0]; ++xi) { + for (int bi = 0; bi < out_lay.batch(); ++bi) + for (int ofi = 0; ofi < out_lay.feature(); ++ofi) + for (int yi = 0; yi < out_lay.spatial(1); ++yi) + for (int xi = 0; xi < out_lay.spatial(0); ++xi) { tensor coords = tensor(batch(bi), feature(ofi), spatial(xi, yi, 0, 0)); auto offset = out_lay.get_linear_offset(coords); auto val = out_ptr[offset]; @@ -7511,10 +7514,10 @@ TEST_P(convolution_gpu_fsv16_to_bfyx, conv_b_fs_yx_fsv16_to_bfyx_padding) const int filter_x = testing::get<5>(GetParam()); const int filter_y = testing::get<6>(GetParam()); - const int stride = testing::get<9>(GetParam()); + const uint64_t stride = testing::get<9>(GetParam()); - const int pad_y = (filter_y - 1) / 2; - const int pad_x = (filter_x - 1) / 2; + const std::ptrdiff_t pad_y = (filter_y - 1) / 2; + const std::ptrdiff_t pad_x = (filter_x - 1) / 2; auto input_size = tensor(input_b, input_f, input_x, input_y); auto input_data = generate_random_4d(input_b, input_f, input_y, input_x, -1, 1); @@ -7535,13 +7538,10 @@ TEST_P(convolution_gpu_fsv16_to_bfyx, conv_b_fs_yx_fsv16_to_bfyx_padding) reorder("input_fsv16", "input_origin", { data_types::f16, format::b_fs_yx_fsv16, input_size })); // format 3 to 8 // Add convolution - auto input_stride = tensor(1, 1, stride, stride); - auto pad = tensor({ 0, 0, pad_x, pad_y }, 0); - auto input_dilation = tensor(1, 1, 1, 1); - auto input_padding_before = tensor({ 0, 0, pad_x, pad_y }, 0); - auto input_padding_after = tensor({ 0, 0, pad_x, pad_y }, 0); + ov::CoordinateDiff input_padding_before = { pad_y, pad_x }; + ov::CoordinateDiff input_padding_after = { pad_y, pad_x }; - auto conv_fsv = convolution("conv_fsv", "input_fsv16", { "weights_fsv" }, input_stride, pad, input_dilation, input_padding_before, input_padding_after); + auto conv_fsv = convolution("conv_fsv", "input_fsv16", { "weights_fsv" }, {stride, stride}, {pad_y, pad_x}, {1, 1}, input_padding_before, input_padding_after); conv_fsv.output_padding = padding({ 0, 32, 2, 2 }, 0.f); topology.add(conv_fsv); // format 8 to 8 -> after fusing, format 8 to 3 @@ -7613,10 +7613,10 @@ TEST_P(convolution_gpu_fsv16_to_bfyx, conv_b_fs_yx_fsv16_to_bfyx_different_type) const int filter_x = testing::get<5>(GetParam()); const int filter_y = testing::get<6>(GetParam()); - const int stride = testing::get<9>(GetParam()); + const uint64_t stride = testing::get<9>(GetParam()); - const int pad_y = (filter_y - 1) / 2; - const int pad_x = (filter_x - 1) / 2; + const std::ptrdiff_t pad_y = (filter_y - 1) / 2; + const std::ptrdiff_t pad_x = (filter_x - 1) / 2; auto input_size = tensor(input_b, input_f, input_x, input_y); auto input_data = generate_random_4d(input_b, input_f, input_y, input_x, -1, 1); @@ -7637,12 +7637,9 @@ TEST_P(convolution_gpu_fsv16_to_bfyx, conv_b_fs_yx_fsv16_to_bfyx_different_type) reorder("input_fsv16", "input_origin", { data_types::f16, format::b_fs_yx_fsv16, input_size })); // format 3 to 8 // Add convolution - auto input_stride = tensor(1, 1, stride, stride); - auto pad = tensor({ 0, 0, pad_x, pad_y }, 0); - auto input_dilation = tensor(1, 1, 1, 1); - auto no_padding = tensor({ 0, 0, pad_x, pad_y }, 0); + ov::CoordinateDiff no_padding = { pad_y, pad_x }; - auto conv_fsv = convolution("conv_fsv", "input_fsv16", { "weights_fsv" }, input_stride, pad, input_dilation, no_padding, no_padding); + auto conv_fsv = convolution("conv_fsv", "input_fsv16", { "weights_fsv" }, {stride, stride}, {pad_y, pad_x}, {1, 1}, no_padding, no_padding); topology.add(conv_fsv); // format 8 to 8 -> after fusing, format 8 to 3 // Add reorder to bfyx @@ -7733,9 +7730,9 @@ public: input_id, { weights_id }, static_cast(groups()), - tensor(batch(0), feature(0), spatial(_stride_x, _stride_y)), - tensor({ 0, 0, _offset_x, _offset_y }, 0), - tensor(batch(0), feature(0), spatial(_dilation_x, _dilation_y))); + {static_cast(_stride_y), static_cast(_stride_x)}, + {static_cast(_offset_y), static_cast(_offset_x)}, + {static_cast(_dilation_y), static_cast(_dilation_x)}); conv_prim.output_data_type = output_type(); topo.add(conv_prim); } else { @@ -7749,9 +7746,9 @@ public: { weights_id }, { "bias" }, static_cast(groups()), - tensor(batch(0), feature(0), spatial(_stride_x, _stride_y)), - tensor({ 0, 0, _offset_x, _offset_y }, 0), - tensor(batch(0), feature(0), spatial(_dilation_x, _dilation_y))); + {static_cast(_stride_y), static_cast(_stride_x)}, + {static_cast(_offset_y), static_cast(_offset_x)}, + {static_cast(_dilation_y), static_cast(_dilation_x)}); conv_prim.output_data_type = output_type(); topo.add(conv_prim); } @@ -7808,10 +7805,10 @@ public: } ASSERT_EQ(out_lay.data_type, output_type()); - ASSERT_EQ(out_lay.size.batch[0], expected.size()); - ASSERT_EQ(out_lay.size.feature[0], expected[0].size()); - ASSERT_EQ(out_lay.size.spatial[1], expected[0][0].size()); - ASSERT_EQ(out_lay.size.spatial[0], expected[0][0][0].size()); + ASSERT_EQ(out_lay.batch(), expected.size()); + ASSERT_EQ(out_lay.feature(), expected[0].size()); + ASSERT_EQ(out_lay.spatial(1), expected[0][0].size()); + ASSERT_EQ(out_lay.spatial(0), expected[0][0][0].size()); for (size_t bi = 0; bi < batch_num(); ++bi) for (size_t fi = 0; fi < output_features(); ++fi) @@ -8098,9 +8095,9 @@ public: input_id, { weights_id }, static_cast(this->groups()), - tensor(batch(0), feature(0), spatial(this->_stride_x, this->_stride_y)), - tensor({ 0, 0, this->_offset_x, this->_offset_y }, 0), - tensor(batch(0), feature(0), spatial(this->_dilation_x, this->_dilation_y))); + {static_cast(this->_stride_y), static_cast(this->_stride_x)}, + {static_cast(this->_offset_y), static_cast(this->_offset_x)}, + {static_cast(this->_dilation_y), static_cast(this->_dilation_x)}); conv_prim.output_data_type = this->output_type(); topo.add(conv_prim); } else { @@ -8114,9 +8111,9 @@ public: { weights_id }, { "bias" }, static_cast(this->groups()), - tensor(batch(0), feature(0), spatial(this->_stride_x, this->_stride_y)), - tensor({ 0, 0, this->_offset_x, this->_offset_y }, 0), - tensor(batch(0), feature(0), spatial(this->_dilation_x, this->_dilation_y))); + {static_cast(this->_stride_y), static_cast(this->_stride_x)}, + {static_cast(this->_offset_y), static_cast(this->_offset_x)}, + {static_cast(this->_dilation_y), static_cast(this->_dilation_x)}); conv_prim.output_data_type = this->output_type(); topo.add(conv_prim); } @@ -8168,10 +8165,10 @@ public: } ASSERT_EQ(out_lay.data_type, this->output_type()); - ASSERT_EQ(out_lay.size.batch[0], expected.size()); - ASSERT_EQ(out_lay.size.feature[0], expected[0].size()); - ASSERT_EQ(out_lay.size.spatial[1], expected[0][0].size()); - ASSERT_EQ(out_lay.size.spatial[0], expected[0][0][0].size()); + ASSERT_EQ(out_lay.batch(), expected.size()); + ASSERT_EQ(out_lay.feature(), expected[0].size()); + ASSERT_EQ(out_lay.spatial(1), expected[0][0].size()); + ASSERT_EQ(out_lay.spatial(0), expected[0][0][0].size()); for (size_t bi = 0; bi < this->batch_num(); ++bi) for (size_t fi = 0; fi < this->output_features(); ++fi) @@ -8452,7 +8449,6 @@ INSTANTIATE_TEST_SUITE_P( ); class convolution_test : public tests::generic_test { - public: static void TearDownTestCase() { @@ -8469,9 +8465,23 @@ public: const std::vector& weights = { "input1" }; const std::vector& bias = { "input2" }; - std::vector stride_sizes = { tensor(1, 1, 1, 1), tensor(1, 1, 2, 3), tensor(1, 1, 4, 1), tensor(1, 1, 5, 5) }; - std::vector dilation_sizes = { tensor(1, 1, 1, 1), tensor(1, 1, 5, 4), tensor(1, 1, 1, 3), tensor(1, 1, 7, 2) }; - std::vector pad_sizes = { tensor(0, 0, 0, 0), tensor(0, 0, 2, 2), tensor(0, 0, -5, -2), tensor(0, 0, 3, -3) }; + std::vector stride_sizes = { + ov::Strides{1, 1}, + ov::Strides{3, 2}, + ov::Strides{1, 4}, + ov::Strides{5, 5} + }; + std::vector dilation_sizes = { + ov::Strides{1, 1}, + ov::Strides{4, 5}, + ov::Strides{3, 1}, + ov::Strides{2, 7} + }; + std::vector pad_sizes = { + ov::CoordinateDiff{0, 0}, + ov::CoordinateDiff{2, 2}, + ov::CoordinateDiff{-2, -5}, + ov::CoordinateDiff{-3, 3} }; // No padding all_layer_params.emplace_back(new convolution("convolution_no_relu", "input0", weights, bias, stride_sizes[0], pad_sizes[0], dilation_sizes[0])); @@ -8518,7 +8528,7 @@ public: for (cldnn::tensor kernel_size : kernel_sizes) { for (auto output_features : output_features_sizes) { std::shared_ptr params = std::make_shared(data_type, input_format, input_size.batch[0], input_size.feature[0], tensor(1, 1, input_size.spatial[0], input_size.spatial[1]), network_build_options); - int input_features = params->input_layouts[0].size.feature[0]; + int input_features = params->input_layouts[0].feature(); params->input_layouts.push_back(cldnn::layout(params->data_type, weights_format, cldnn::tensor(output_features, input_features, kernel_size.spatial[0], kernel_size.spatial[1]))); // weights params->input_layouts.push_back(cldnn::layout(params->data_type, params->fmt, cldnn::tensor(1, 1, output_features, 1))); // biases all_generic_params.push_back(params); @@ -8546,17 +8556,17 @@ public: cldnn::tensor get_expected_output_tensor() override { auto convolution = std::static_pointer_cast(layer_params); tensor input_size = generic_params->input_layouts[0].size; - tensor dilation = convolution->dilation; - tensor stride = convolution->stride; - tensor pad = convolution->pad; + auto dilation = convolution->dilation; + auto stride = convolution->stride; + auto pad = convolution->pad; tensor weights_size = generic_params->input_layouts[1].size; - int kernel_extent_y = dilation.spatial[1] * (weights_size.spatial[1] - 1) + 1; - int kernel_extent_x = dilation.spatial[0] * (weights_size.spatial[0] - 1) + 1; + int kernel_extent_y = dilation[dilation.size() - 2] * (weights_size.spatial[1] - 1) + 1; + int kernel_extent_x = dilation[dilation.size() - 1] * (weights_size.spatial[0] - 1) + 1; // Calculate output size - int output_size_y = 1 + (input_size.spatial[1] - kernel_extent_y + 2 * pad.spatial[1]) / stride.spatial[1]; - int output_size_x = 1 + (input_size.spatial[0] - kernel_extent_x + 2 * pad.spatial[0]) / stride.spatial[0]; + int output_size_y = 1 + (input_size.spatial[1] - kernel_extent_y + 2 * pad[0]) / stride[0]; + int output_size_x = 1 + (input_size.spatial[0] - kernel_extent_x + 2 * pad[1]) / stride[1]; int output_features = weights_size.batch[0]; return cldnn::tensor(input_size.batch[0], output_features, output_size_x, output_size_y); @@ -8604,9 +8614,9 @@ public: data_types dt = inputs[0]->get_layout().data_type; tensor input_size = inputs[0]->get_layout().size; - tensor dilation = convolution->dilation; - tensor stride = convolution->stride; - tensor pad = convolution->pad; + ov::Strides dilation = convolution->dilation; + ov::Strides stride = convolution->stride; + ov::CoordinateDiff pad = convolution->pad; tensor weights_size = inputs[1]->get_layout().size; padding output_padding = convolution->output_padding; @@ -8665,13 +8675,13 @@ public: output_index += (lower_output_padding.spatial[1] + output_yi) * output_buffer_size.spatial[0] + lower_output_padding.spatial[0] + output_xi; for (int kernel_y = 0; kernel_y < weights_size.spatial[1]; kernel_y++) { - int input_yi = y * stride.spatial[1] - pad.spatial[1] + kernel_y * dilation.spatial[1]; + int input_yi = y * stride[0] - pad[0] + kernel_y * dilation[0]; if ((input_yi < 0) || (input_yi >= input_size.spatial[1])) { continue; } for (int kernel_x = 0; kernel_x < weights_size.spatial[0]; kernel_x++) { - int input_xi = x * stride.spatial[0] - pad.spatial[0] + kernel_x * dilation.spatial[0]; + int input_xi = x * stride[1] - pad[1] + kernel_x * dilation[1]; if ((input_xi < 0) || (input_xi >= input_size.spatial[0])) { continue; } @@ -8804,8 +8814,8 @@ TEST_P(convolution_gpu_onednn, conv_onednn_cases) { filter_x = testing::get<5>(GetParam()), filter_y = testing::get<6>(GetParam()), groups = testing::get<8>(GetParam()), - stride = testing::get<9>(GetParam()), batch_num = testing::get<10>(GetParam()); + const uint64_t stride = testing::get<9>(GetParam()); auto input_data_format = testing::get<11>(GetParam()); auto impl_name = testing::get<12>(GetParam()); auto prim_impl_types = testing::get<13>(GetParam()); @@ -8856,8 +8866,8 @@ TEST_P(convolution_gpu_onednn, conv_onednn_cases) { { "weights_fsv" }, { "bias" }, groups, - { 1, 1, stride, stride }, - { 0, 0, 0, 0 }); + { stride, stride }, + { 0, 0 }); conv_fsv.output_padding = padding({ 0, 0, 0, 0 }, 0.f); topology.add(conv_fsv); @@ -8882,8 +8892,8 @@ TEST_P(convolution_gpu_onednn, conv_onednn_cases) { "input_fsv", { "weights_fsv" }, groups, - { 1, 1, stride, stride }, - { 0, 0, 0, 0 }); + { stride, stride }, + { 0, 0 }); conv_fsv.output_padding = padding({ 0, 0, 0, 0 }, 0.f); topology.add(conv_fsv); } @@ -8904,15 +8914,15 @@ TEST_P(convolution_gpu_onednn, conv_onednn_cases) { auto out_lay = out_mem->get_layout(); ASSERT_EQ(out_mem->get_layout().format, input_data_format); - ASSERT_EQ(out_lay.size.batch[0], expected_result.size()); - ASSERT_EQ(out_lay.size.feature[0], expected_result[0].size()); - ASSERT_EQ(out_lay.size.spatial[1], expected_result[0][0].size()); - ASSERT_EQ(out_lay.size.spatial[0], expected_result[0][0][0].size()); + ASSERT_EQ(out_lay.batch(), expected_result.size()); + ASSERT_EQ(out_lay.feature(), expected_result[0].size()); + ASSERT_EQ(out_lay.spatial(1), expected_result[0][0].size()); + ASSERT_EQ(out_lay.spatial(0), expected_result[0][0][0].size()); - for (int bi = 0; bi < out_lay.size.batch[0]; ++bi) - for (int ofi = 0; ofi < out_lay.size.feature[0]; ++ofi) - for (int yi = 0; yi < out_lay.size.spatial[1]; ++yi) - for (int xi = 0; xi < out_lay.size.spatial[0]; ++xi) { + for (int bi = 0; bi < out_lay.batch(); ++bi) + for (int ofi = 0; ofi < out_lay.feature(); ++ofi) + for (int yi = 0; yi < out_lay.spatial(1); ++yi) + for (int xi = 0; xi < out_lay.spatial(0); ++xi) { tensor coords = tensor(batch(bi), feature(ofi), spatial(xi, yi, 0, 0)); auto offset = out_lay.get_linear_offset(coords); auto val = out_ptr[offset]; @@ -8950,7 +8960,7 @@ TEST(convolution_gpu_onednn, padding_for_cldnn_kernel_after_onednn) { auto weights = data("weights", weights_mem); auto input_reorder = reorder("input_fsv", "input", { data_types::f16, format::b_fs_yx_fsv16, input_size }); auto conv1 = convolution("conv1", "input_fsv", { "weights" }); - auto conv2 = convolution("conv2", "conv1", { "weights" }, { 1, 1, 1, 1 }, { 0, 0, -1, -1 }, { 1, 1, 1, 1 }, { output_b, output_f, output_x, output_x }); + auto conv2 = convolution("conv2", "conv1", { "weights" }, { 1, 1 }, { 1, 1 }, { 1, 1 }, { output_b, output_f, output_x, output_x }); auto output_reorder = reorder("reorder", "conv2", { data_types::f32, format::bfyx, { output_b, output_f, output_x, output_x } }); topology topology_test(input, weights, input_reorder, conv1, conv2, output_reorder); @@ -8990,15 +9000,15 @@ TEST(convolution_gpu_onednn, padding_for_cldnn_kernel_after_onednn) { auto output_layout_ref = output_memory_ref->get_layout(); cldnn::mem_lock output_ptr_ref(output_memory_ref, get_test_stream()); - EXPECT_EQ(output_layout_test.size.spatial[0], output_x); - EXPECT_EQ(output_layout_test.size.spatial[1], output_y); - EXPECT_EQ(output_layout_test.size.feature[0], output_f); - EXPECT_EQ(output_layout_test.size.batch[0], output_b); + EXPECT_EQ(output_layout_test.spatial(0), output_x); + EXPECT_EQ(output_layout_test.spatial(1), output_y); + EXPECT_EQ(output_layout_test.feature(), output_f); + EXPECT_EQ(output_layout_test.batch(), output_b); - EXPECT_EQ(output_layout_ref.size.spatial[0], output_x); - EXPECT_EQ(output_layout_ref.size.spatial[1], output_y); - EXPECT_EQ(output_layout_ref.size.feature[0], output_f); - EXPECT_EQ(output_layout_ref.size.batch[0], output_b); + EXPECT_EQ(output_layout_ref.spatial(0), output_x); + EXPECT_EQ(output_layout_ref.spatial(1), output_y); + EXPECT_EQ(output_layout_ref.feature(), output_f); + EXPECT_EQ(output_layout_ref.batch(), output_b); for (size_t i = 0; i < output_memory_ref->count(); i++) { ASSERT_EQ(output_ptr_ref.data()[i], output_ptr_test.data()[i]); diff --git a/src/plugins/intel_gpu/tests/test_cases/deconvolution_gpu_test.cpp b/src/plugins/intel_gpu/tests/test_cases/deconvolution_gpu_test.cpp index dc89b37c783..2c17ec8483a 100644 --- a/src/plugins/intel_gpu/tests/test_cases/deconvolution_gpu_test.cpp +++ b/src/plugins/intel_gpu/tests/test_cases/deconvolution_gpu_test.cpp @@ -57,8 +57,8 @@ VVVF reference_deconvolution( const VVVVF& input, // fyx dimensions order const VVVVF& weights, float bias, - tensor stride, - tensor offset, + ov::Strides stride, + ov::CoordinateDiff offset, size_t input_f_start ) { auto ifm = weights.size(); @@ -70,13 +70,13 @@ VVVF reference_deconvolution( auto in_y = static_cast(input[0][0].size()); auto in_x = static_cast(input[0][0][0].size()); - auto stride_x = stride.spatial[0]; - auto stride_y = stride.spatial[1]; - auto stride_z = stride.spatial[2]; + auto offset_x = offset.size() >= 1 ? -offset[offset.size() - 1] : 0; + auto offset_y = offset.size() >= 2 ? -offset[offset.size() - 2] : 0; + auto offset_z = offset.size() >= 3 ? -offset[offset.size() - 3] : 0; - auto offset_x = -offset.spatial[0]; - auto offset_y = -offset.spatial[1]; - auto offset_z = -offset.spatial[2]; + auto stride_x = stride.size() >= 1 ? stride[stride.size() - 1] : 1; + auto stride_y = stride.size() >= 2 ? stride[stride.size() - 2] : 1; + auto stride_z = stride.size() >= 3 ? stride[stride.size() - 3] : 1; int out_x = 2 * offset_x + (in_x - 1) * stride_x + filter_x; int out_y = 2 * offset_y + (in_y - 1) * stride_y + filter_y; @@ -155,7 +155,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_nopad) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1,1,1,1 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1,1 }) ); network network(engine, topology); @@ -273,7 +273,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_nopad_bfyx) { // Filt input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1,1,1,1 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1,1 }) ); network network(engine, topology); @@ -333,7 +333,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_pad1) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 1, 1 }, tensor{ {0, 0, 1, 1}, 0 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1 }, { 1, 1}) ); network network(engine, topology); @@ -384,7 +384,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_stride2_nopad) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1,1,2,2 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 2,2 }) ); network network(engine, topology); @@ -449,7 +449,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_stride4_pad2) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 4, 4 }, tensor{ {0, 0, 2, 2}, 0 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, {4, 4 }, { 2, 2 }) ); network network(engine, topology); @@ -511,7 +511,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x2_stride2_pad1) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, tensor{ {0, 0, 1, 1}, 0 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 2, 2 }, { 1, 1 }) ); network network(engine, topology); @@ -578,7 +578,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2x2_in2x2x1x1_stride2_pad1) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, tensor{ {0, 0, 1, 1}, 0 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 2, 2 }, { 1, 1 }) ); network network(engine, topology, options); @@ -639,7 +639,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x2_bfyx_stride2_pad1) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, tensor{ {0, 0, 1, 1}, 0 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 2, 2 }, { 1, 1 }) ); network network(engine, topology); @@ -702,7 +702,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x2_bfyx_stride2_pad1_input_p reorder("reorder", "input", input->get_layout().with_padding(padding{ { 0, 0, 1, 2 }, 0 })), data("weights", weights), data("biases", biases), - deconvolution("deconv", "reorder", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, tensor{ {0, 0, 1, 1}, 0 }) + deconvolution("deconv", "reorder", { "weights" }, { "biases" }, { 2, 2 }, { 1, 1 }) ); network network(engine, topology); @@ -771,7 +771,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2x2_in2x2x1x1_stride2_pad1_input_padd reorder("reorder", "input", input->get_layout().with_padding(padding{ { 0, 0, 1, 2 }, 0 })), data("weights", weights), data("biases", biases), - deconvolution("deconv", "reorder", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, tensor{ {0, 0, 1, 1}, 0 }) + deconvolution("deconv", "reorder", { "weights" }, { "biases" }, { 2, 2 }, { 1, 1 }) ); network network(engine, topology, options); @@ -832,7 +832,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x2_bfyx_yxfb_stride2_pad1) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, tensor{ {0, 0, 1, 1}, 0 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 2, 2 }, { 1, 1 }) ); network network(engine, topology); @@ -901,7 +901,7 @@ TEST(deconvolution_f16_fw_gpu, basic_wsiz2x2_in2x2x1x2_bfyx_yxfb_stride2_pad1) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, tensor{ {0, 0, 1, 1}, 0 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 2, 2 }, { 1, 1 }) ); network network(engine, topology, options); @@ -969,7 +969,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_split2) input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 1, 1, 2, 2 }, { 0, 0, 1, 1 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 2, 2 }, { 1, 1 }) ); network network(engine, topology); @@ -1014,7 +1014,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_group2) input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 1, 1, 2, 2 }, { 0, 0, 1, 1 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 2, 2 }, { 1, 1 }) ); network network(engine, topology); @@ -1091,7 +1091,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_group16 data("bias", biases) ); - topology.add(deconvolution("deconv", "input", { "weights" }, { "bias" }, 16, { 1, 1, 2, 2 }, { 0, 0, 1, 1 })); + topology.add(deconvolution("deconv", "input", { "weights" }, { "bias" }, 16, { 2, 2 }, { 1, 1 })); network network(engine, topology); network.set_input_data("input", input); @@ -1180,7 +1180,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_group16 data("bias", biases) ); - topology.add(deconvolution("deconv", "input", { "weights" }, { "bias" }, 16, { 1, 1, 2, 2 }, { 0, 0, 1, 1 })); + topology.add(deconvolution("deconv", "input", { "weights" }, { "bias" }, 16, { 2, 2 }, { 1, 1 })); network network(engine, topology); network.set_input_data("input", input); @@ -1235,7 +1235,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x6x1x1_bfyx_stride2_pad1_group2_ input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 1, 1, 1, 1 }, { 0, 0, 0, 0 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 1, 1 }, { 0, 0 }) ); network network(engine, topology); @@ -1292,7 +1292,7 @@ TEST(deconvolution_f32_fw_gpu, basic3D_wsiz2x2x1_in1x1x2x2x1_nopad) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1,1,1,1,1 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1,1,1 }, {0, 0, 0}) ); network network(engine, topology); @@ -1443,7 +1443,7 @@ TEST(deconvolution_f32_fw_gpu, basic3D_wsiz3x3x3_in1x1x4x4x4_nopad) { topology topology( input_layout("input", input->get_layout()), data("weights", weights), - deconvolution("deconv", "input", { "weights" }) + deconvolution("deconv", "input", { "weights" }, {1, 1, 1}, {0, 0, 0}) ); network network(engine, topology); @@ -1539,7 +1539,7 @@ TEST(deconvolution_f32_fw_gpu, basic3D_wsiz2x2x2_in1x1x2x2x2_stride2_nopad) { topology topology( input_layout("input", input->get_layout()), data("weights", weights), - deconvolution("deconv", "input", { "weights" }, { 1,1,2,2,2 }) + deconvolution("deconv", "input", { "weights" }, { 2,2,2 }, {0, 0, 0}) ); network network(engine, topology); @@ -1612,7 +1612,7 @@ TEST(deconvolution_f32_fw_gpu, basic3D_wsiz2x2x2_in1x1x2x2x2_stride2_pad1) { topology topology( input_layout("input", input->get_layout()), data("weights", weights), - deconvolution("deconv", "input", { "weights" }, { 1,1,2,2,2 }, tensor{ {0, 0, 1, 1, 1 }, 0}) + deconvolution("deconv", "input", { "weights" }, { 2,2,2 }, { 1, 1, 1 }) ); network network(engine, topology); @@ -1675,7 +1675,7 @@ TEST(deconvolution_f16_gpu, basic_k9x9_s2x2_pad4x4) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, tensor{{ 0, 0, 4, 4 }, 0}, tensor{ 1, 1, 32, 32 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 2, 2 }, { 4, 4 }, tensor{ 1, 1, 32, 32 }) ); network network_ref(engine, topology_ref); @@ -1696,7 +1696,7 @@ TEST(deconvolution_f16_gpu, basic_k9x9_s2x2_pad4x4) { input_layout("input_act", input->get_layout()), data("weights_f32", weights_f32), data("biases_f32", biases_f32), - deconvolution("deconv_act", "input_act", { "weights_f32" }, { "biases_f32" }, { 1, 1, 2, 2 }, tensor{{ 0, 0, 4, 4 }, 0}), + deconvolution("deconv_act", "input_act", { "weights_f32" }, { "biases_f32" }, { 2, 2 }, { 4, 4 }), reorder("out", "deconv_act", format::bfyx, data_types::f16) ); @@ -1754,7 +1754,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x2_b_fs_yx_fsv16_stride2_pad input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, tensor{ {0, 0, 1, 1}, 0 }), + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 2, 2 }, { 1, 1 }), reorder("out", "deconv", format::bfyx, data_types::f32) ); @@ -1825,7 +1825,7 @@ TEST(deconvolution_f16_fw_gpu, basic_wsiz2x2_in2x2x1x2_b_fs_yx_fsv16_stride2_pad input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, tensor{ {0, 0, 1, 1}, 0 }), + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 2, 2 }, { 1, 1 }), reorder("out", "deconv", format::bfyx, data_types::f16) ); @@ -1874,7 +1874,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x2x2x2_b_fs_yx_fsv16_stride2_pad input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 1, 1, 2, 2 }, tensor{{ 0, 0, 1, 1 }, 0}), + deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 2, 2 }, { 1, 1 }), reorder("out", "deconv", format::bfyx, data_types::f32) ); @@ -1922,7 +1922,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x2x2x2_b_fs_yx_fsv16_stride2_pad input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 1, 1, 2, 2 }, tensor{{ 0, 0, 1, 1 }, 0}), + deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 2, 2 }, { 1, 1 }), reorder("out", "deconv", format::bfyx, data_types::f32) ); @@ -1968,7 +1968,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_nopad_b_fs_yx_fsv16_dw) { data("weights", weights), data("biases", biases), reorder("input_fsv16", "input", format::b_fs_yx_fsv16, data_types::f32), - deconvolution("deconv", "input_fsv16", { "weights" }, { "biases" }, 2, { 1,1,1,1 }, { 0, 0, 0, 0 }), + deconvolution("deconv", "input_fsv16", { "weights" }, { "biases" }, 2, { 1, 1 }, { 0, 0 }), reorder("out", "deconv", format::bfyx, data_types::f32) ); @@ -2022,7 +2022,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_pad1_b_fs_yx_fsv16_dw) { data("weights", weights), data("biases", biases), reorder("input_fsv16", "input", format::b_fs_yx_fsv16, data_types::f32), - deconvolution("deconv", "input_fsv16", { "weights" }, { "biases" }, 2, { 1, 1, 1, 1 }, tensor{{ 0, 0, 1, 1 }, 0}), + deconvolution("deconv", "input_fsv16", { "weights" }, { "biases" }, 2, { 1, 1 }, { 1, 1 }), reorder("out", "deconv", format::bfyx, data_types::f32) ); @@ -2064,7 +2064,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_stride2_nopad_b_fs_yx_fsv input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 1,1,2,2 }), + deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 2,2 }), reorder("out", "deconv", format::bfyx, data_types::f32) ); @@ -2120,7 +2120,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_stride4_pad2_b_fs_yx_fsv1 input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 1, 1, 4, 4 }, tensor{{ 0, 0, 2, 2 }, 0}), + deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 4, 4 }, { 2, 2 }), reorder("out", "deconv", format::bfyx, data_types::f32) ); @@ -2176,7 +2176,7 @@ TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_stride4_pad2_b_fs_yx_fsv1 input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 1, 1, 4, 4 }, tensor{{ 0, 0, 2, 2 }, 0}), + deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 4, 4 }, { 2, 2 }), reorder("out", "deconv", format::bfyx, data_types::f32) ); @@ -2261,7 +2261,7 @@ TEST(deconvolution_f32_fw_gpu, bs_fs_zyx_bsv16_fsv16_wsiz2x2x2_in1x1x2x2x2_strid topology topology( input_layout("input", input->get_layout()), data("weights", weights), - deconvolution("deconv", "input", { "weights" }, { 1,1,2,2,2 }, tensor{ {0, 0, 1, 1, 1 }, 0}), + deconvolution("deconv", "input", { "weights" }, { 2,2,2 }, { 1, 1, 1 }), reorder("out", "deconv", format::bfzyx, data_types::f32) ); @@ -2313,7 +2313,7 @@ TEST(deconvolution_f16_fw_gpu, basic_wsiz2x2_in1x2x2x2_fs_b_yx_fsv32_stride1_pad reorder("reorder", "input", format::fs_b_yx_fsv32, data_types::f16), data("weights", weights), data("biases", biases), - deconvolution("deconv", "reorder", { "weights" }, { "biases" }, 1, { 1, 1, 1, 1 }, { 0, 0, 0, 0 }), + deconvolution("deconv", "reorder", { "weights" }, { "biases" }, 1, { 1, 1 }, { 0, 0 }), reorder("out", "deconv", format::bfyx, data_types::f32) ); @@ -2351,8 +2351,8 @@ struct deconvolution_random_test_params { data_types weights_type; format::type weights_format; tensor weights_size; - tensor strides; - tensor pad; + ov::Strides strides; + ov::CoordinateDiff pad; bool with_bias; data_types output_type; cldnn::implementation_desc deconv_desc; @@ -2375,6 +2375,22 @@ struct deconvolution_random_test_params { to_string_neg(size.spatial[2]); }; + auto print_strides = [&](const ov::Strides& s) { + std::string res = to_string_neg(s[0]); + for (size_t i = 1; i < s.size(); i++) { + res += "x" + to_string_neg(s[i]); + } + return res; + }; + + auto print_coord = [&](const ov::CoordinateDiff& cd) { + std::string res = to_string_neg(cd[0]); + for (size_t i = 1; i < cd.size(); i++) { + res += "x" + to_string_neg(cd[i]); + } + return res; + }; + // construct a readable name return "in_" + dt_to_str(param.input_type) + "_" + fmt_to_str(param.input_format) + @@ -2383,8 +2399,8 @@ struct deconvolution_random_test_params { "_" + fmt_to_str(param.weights_format) + "_" + print_tensor(param.weights_size) + (param.with_bias ? "_bias" : "") + - "_s_" + print_tensor(param.strides) + - "_off_" + print_tensor(param.pad) + + "_s_" + print_strides(param.strides) + + "_off_" + print_coord(param.pad) + "_out_" + dt_to_str(param.output_type) + (!param.deconv_desc.kernel_name.empty() ? "_kernel_" + param.deconv_desc.kernel_name : "") + (param.deconv_desc.output_format != format::any ? "_fmt_" + fmt_to_str(param.deconv_desc.output_format) : ""); @@ -2546,7 +2562,7 @@ public: auto bias_size = cldnn::tensor(feature(params.weights_size.batch[0] * params.weights_size.group[0])); auto bias_lay = cldnn::layout(cldnn::type_to_data_type::value, cldnn::format::bfyx, bias_size); auto bias_mem = eng.allocate_memory(bias_lay); - bias_data = generate_random_1d(bias_lay.size.feature[0], -1, 1); + bias_data = generate_random_1d(bias_lay.feature(), -1, 1); set_values(bias_mem, bias_data); topo.add(cldnn::data("bias", bias_mem)); topo.add(cldnn::deconvolution("deconv", "input", { "weights" }, { "bias" }, groups, params.strides, params.pad)); @@ -2575,8 +2591,8 @@ public: { cldnn::mem_lock ptr(out_mem, get_test_stream()); - auto b = static_cast(out_mem->get_layout().size.batch[0]); - auto of = static_cast(out_mem->get_layout().size.feature[0]); + auto b = static_cast(out_mem->get_layout().batch()); + auto of = static_cast(out_mem->get_layout().feature()); for (size_t bi = 0; bi < b; ++bi) { for (size_t fi = 0; fi < of; ++fi) { @@ -2589,9 +2605,9 @@ public: params.pad, group * ifm); - ASSERT_EQ(reference.size(), out_mem->get_layout().size.spatial[2]); - ASSERT_EQ(reference[0].size(), out_mem->get_layout().size.spatial[1]); - ASSERT_EQ(reference[0][0].size(), out_mem->get_layout().size.spatial[0]); + ASSERT_EQ(reference.size(), out_mem->get_layout().spatial(2)); + ASSERT_EQ(reference[0].size(), out_mem->get_layout().spatial(1)); + ASSERT_EQ(reference[0][0].size(), out_mem->get_layout().spatial(0)); for (size_t zi = 0; zi < reference.size(); zi++) { for (size_t yi = 0; yi < reference[0].size(); yi++) { @@ -2700,21 +2716,21 @@ public: std::vector batches = { 1, 2 }; for (auto b : batches) { // 1x1 - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 15, 7, 7}, wei_dt, format::oiyx, {15, 15, 1, 1}, tensor(1), tensor(0), true, out_dt, implementation_desc{out_fmt, ""} }); - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 15, 7, 7}, wei_dt, format::oiyx, {15, 15, 1, 1}, {1, 1, 2, 2}, tensor(0), true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 15, 7, 7}, wei_dt, format::oiyx, {15, 15, 1, 1}, {1, 1}, {0, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 15, 7, 7}, wei_dt, format::oiyx, {15, 15, 1, 1}, {2, 2}, {0, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); // 3x3 - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 15, 7, 7}, wei_dt, format::oiyx, {15, 15, 3, 3}, tensor(1), tensor{{0, 0, 1, 1, 0}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 15, 7, 7}, wei_dt, format::oiyx, {15, 15, 3, 3}, {1, 1, 2, 2}, tensor{{0, 0, 1, 1, 0}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 15, 7, 7}, wei_dt, format::oiyx, {15, 15, 3, 3}, {1, 1}, {1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 15, 7, 7}, wei_dt, format::oiyx, {15, 15, 3, 3}, {2, 2}, {1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); // Grouped - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7}, wei_dt, format::goiyx, tensor(group(2), batch(16), feature(4), spatial(1, 1)), tensor(1), tensor(0), true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7}, wei_dt, format::goiyx, tensor(group(2), batch(16), feature(4), spatial(1, 1)), {1, 1, 2, 2}, tensor(0), true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7}, wei_dt, format::goiyx, tensor(group(2), batch(16), feature(4), spatial(3, 3)), tensor(1), tensor{{0, 0, 1, 1, 0}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7}, wei_dt, format::goiyx, tensor(group(2), batch(16), feature(4), spatial(3, 3)), {1, 1, 2, 2}, tensor{{0, 0, 1, 1, 0}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7}, wei_dt, format::goiyx, tensor(group(2), batch(16), feature(4), spatial(1, 1)), {1, 1}, {0, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7}, wei_dt, format::goiyx, tensor(group(2), batch(16), feature(4), spatial(1, 1)), {2, 2}, {0, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7}, wei_dt, format::goiyx, tensor(group(2), batch(16), feature(4), spatial(3, 3)), {1, 1}, {1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7}, wei_dt, format::goiyx, tensor(group(2), batch(16), feature(4), spatial(3, 3)), {2, 2}, {1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); // Depthwise - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7}, wei_dt, format::goiyx, tensor(group(16), spatial(1, 1)), tensor(1), tensor(0), true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7}, wei_dt, format::goiyx, tensor(group(16), spatial(1, 1)), {1, 1, 2, 2}, tensor(0), true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7}, wei_dt, format::goiyx, tensor(group(16), spatial(3, 3)), tensor(1), tensor{{0, 0, 1, 1, 0}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7}, wei_dt, format::goiyx, tensor(group(16), spatial(3, 3)), {1, 1, 2, 2}, tensor{{0, 0, 1, 1, 0}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7}, wei_dt, format::goiyx, tensor(group(16), spatial(1, 1)), {1, 1}, {0, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7}, wei_dt, format::goiyx, tensor(group(16), spatial(1, 1)), {2, 2}, {0, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7}, wei_dt, format::goiyx, tensor(group(16), spatial(3, 3)), {1, 1}, {1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7}, wei_dt, format::goiyx, tensor(group(16), spatial(3, 3)), {2, 2}, {1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); } return *this; } @@ -2723,21 +2739,21 @@ public: std::vector batches = { 1, 2, 16, 32 }; for (auto b : batches) { // 1x1 - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 15, 7, 7, 7}, wei_dt, format::oizyx, {15, 15, 1, 1, 1}, tensor(1), tensor(0), true, out_dt, implementation_desc{out_fmt, ""} }); - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 15, 7, 7, 7}, wei_dt, format::oizyx, {15, 15, 1, 1, 1}, {1, 1, 2, 2, 2}, tensor(0), true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 15, 7, 7, 7}, wei_dt, format::oizyx, {15, 15, 1, 1, 1}, {1, 1, 1}, {0, 0, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 15, 7, 7, 7}, wei_dt, format::oizyx, {15, 15, 1, 1, 1}, {2, 2, 2}, {0, 0, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); // 3x3 - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 15, 7, 7, 7}, wei_dt, format::oizyx, {15, 15, 3, 3, 3}, tensor(1), tensor{{0, 0, 1, 1, 1}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 15, 7, 7, 7}, wei_dt, format::oizyx, {15, 15, 3, 3, 3}, {1, 1, 2, 2, 2}, tensor{{0, 0, 1, 1, 1}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 15, 7, 7, 7}, wei_dt, format::oizyx, {15, 15, 3, 3, 3}, {1, 1, 1}, {1, 1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 15, 7, 7, 7}, wei_dt, format::oizyx, {15, 15, 3, 3, 3}, {2, 2, 2}, {1, 1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); // Grouped - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(2), batch(16), feature(4), spatial(1, 1, 1)), tensor(1), tensor(0), true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(2), batch(16), feature(4), spatial(1, 1, 1)), {1, 1, 2, 2, 2}, tensor(0), true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(2), batch(16), feature(4), spatial(3, 3, 3)), tensor(1), tensor{{0, 0, 1, 1, 1}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(2), batch(16), feature(4), spatial(3, 3, 3)), {1, 1, 2, 2, 2}, tensor{{0, 0, 1, 1, 1}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(2), batch(16), feature(4), spatial(1, 1, 1)), {1, 1, 1}, {0, 0, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(2), batch(16), feature(4), spatial(1, 1, 1)), {2, 2, 2}, {0, 0, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(2), batch(16), feature(4), spatial(3, 3, 3)), {1, 1, 1}, {1, 1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 8, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(2), batch(16), feature(4), spatial(3, 3, 3)), {2, 2, 2}, {1, 1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); // Depthwise - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(16), spatial(1, 1, 1)), tensor(1), tensor(0), true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(16), spatial(1, 1, 1)), {1, 1, 2, 2, 2}, tensor(0), true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(16), spatial(3, 3, 3)), tensor(1), tensor{{0, 0, 1, 1, 1}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(16), spatial(3, 3, 3)), {1, 1, 2, 2, 2}, tensor{{0, 0, 1, 1, 1}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(16), spatial(1, 1, 1)), {1, 1, 1}, {0, 0, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(16), spatial(1, 1, 1)), {2, 2, 2}, {0, 0, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(16), spatial(3, 3, 3)), {1, 1, 1}, {1, 1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 16, 7, 7, 7}, wei_dt, format::goizyx, tensor(group(16), spatial(3, 3, 3)), {2, 2, 2}, {1, 1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); } return *this; } @@ -2746,19 +2762,19 @@ public: std::vector batches = { 1, 2, 16 }; for (auto b : batches) { // 1x1 - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17}, wei_dt, format::oiyx, {41, 31, 1, 1}, tensor(1), tensor(0), true, out_dt, implementation_desc{out_fmt, ""} }); - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17}, wei_dt, format::oiyx, {41, 31, 1, 1}, {1, 1, 2, 2}, tensor(0), true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17}, wei_dt, format::oiyx, {41, 31, 1, 1}, {1, 1}, {0, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17}, wei_dt, format::oiyx, {41, 31, 1, 1}, {2, 2}, {0, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); // 3x3 - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 31, 19, 17}, wei_dt, format::oiyx, {41, 31, 3, 3}, tensor(1), tensor{{0, 0, 1, 1, 0}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 31, 19, 17}, wei_dt, format::oiyx, {41, 31, 3, 3}, {1, 1, 2, 2}, tensor{{0, 0, 1, 1, 0}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 31, 19, 17}, wei_dt, format::oiyx, {41, 31, 3, 3}, {1, 1}, {1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 31, 19, 17}, wei_dt, format::oiyx, {41, 31, 3, 3}, {2, 2}, {1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); // Asymmetric weights - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 31, 19, 17}, wei_dt, format::oiyx, {41, 31, 3, 2}, tensor(1), tensor{{0, 0, 0, 1, 0}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 31, 19, 17}, wei_dt, format::oiyx, {41, 31, 3, 2}, {1, 1, 2, 2}, tensor{{0, 0, 0, 1, 0}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 31, 19, 17}, wei_dt, format::oiyx, {41, 31, 3, 2}, {1, 1}, {1, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 31, 19, 17}, wei_dt, format::oiyx, {41, 31, 3, 2}, {2, 2}, {1, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); // Uneven groups - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 27, 19, 17}, wei_dt, format::goiyx, tensor(group(3), batch(7), feature(9), spatial(1, 1)), tensor(1), tensor(0), true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 27, 19, 17}, wei_dt, format::goiyx, tensor(group(3), batch(7), feature(9), spatial(1, 1)), {1, 1, 2, 2}, tensor(0), true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 27, 19, 17}, wei_dt, format::goiyx, tensor(group(3), batch(7), feature(9), spatial(3, 3)), tensor(1), tensor{{0, 0, 1, 1, 0}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); - push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 27, 19, 17}, wei_dt, format::goiyx, tensor(group(3), batch(7), feature(9), spatial(3, 3)), {1, 1, 2, 2}, tensor{{0, 0, 1, 1, 0}, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 27, 19, 17}, wei_dt, format::goiyx, tensor(group(3), batch(7), feature(9), spatial(1, 1)), {1, 1}, {0, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 27, 19, 17}, wei_dt, format::goiyx, tensor(group(3), batch(7), feature(9), spatial(1, 1)), {2, 2}, {0, 0}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 27, 19, 17}, wei_dt, format::goiyx, tensor(group(3), batch(7), feature(9), spatial(3, 3)), {1, 1}, {1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); + push_back(deconvolution_random_test_params{in_dt, in_fmt, {b, 27, 19, 17}, wei_dt, format::goiyx, tensor(group(3), batch(7), feature(9), spatial(3, 3)), {2, 2}, {1, 1}, true, out_dt, implementation_desc{out_fmt, ""}}); } return *this; } @@ -2767,19 +2783,19 @@ public: std::vector batches = { 1, 2, 16 }; for (auto b : batches) { // 1x1 - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17, 11}, wei_dt, format::oizyx, {41, 31, 1, 1, 1}, tensor(1), tensor(0), true, out_dt, implementation_desc{out_fmt, ""} }); - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17, 11}, wei_dt, format::oizyx, {41, 31, 1, 1, 1}, {1, 1, 2, 2, 2}, tensor(0), true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17, 11}, wei_dt, format::oizyx, {41, 31, 1, 1, 1}, {1, 1, 1}, {0, 0, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17, 11}, wei_dt, format::oizyx, {41, 31, 1, 1, 1}, {2, 2, 2}, {0, 0, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); // 3x3 - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17, 11}, wei_dt, format::oizyx, {41, 31, 3, 3, 3}, tensor(1), tensor{{0, 0, 1, 1, 1}, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17, 11}, wei_dt, format::oizyx, {41, 31, 3, 3, 3}, {1, 1, 2, 2, 2}, tensor{{0, 0, 1, 1, 1}, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17, 11}, wei_dt, format::oizyx, {41, 31, 3, 3, 3}, {1, 1, 1}, {1, 1, 1}, true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17, 11}, wei_dt, format::oizyx, {41, 31, 3, 3, 3}, {2, 2, 2}, {1, 1, 1}, true, out_dt, implementation_desc{out_fmt, ""} }); // Asymmetric weights - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17, 11}, wei_dt, format::oizyx, {41, 31, 3, 2, 4}, tensor(1), tensor{{0, 0, 0, 1, 2}, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17, 11}, wei_dt, format::oizyx, {41, 31, 3, 2, 4}, {1, 1, 2, 2, 2}, {0, 0, 0, -1, -2}, true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17, 11}, wei_dt, format::oizyx, {41, 31, 3, 2, 4}, {1, 1, 1}, {2, 1, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 31, 19, 17, 11}, wei_dt, format::oizyx, {41, 31, 3, 2, 4}, {2, 2, 2}, {2, 1, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); // Uneven groups - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 27, 19, 17, 11}, wei_dt, format::goizyx, tensor(group(3), batch(7), feature(9), spatial(1, 1, 1)), tensor(1), tensor(0), true, out_dt, implementation_desc{out_fmt, ""} }); - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 27, 19, 17, 11}, wei_dt, format::goizyx, tensor(group(3), batch(7), feature(9), spatial(1, 1, 1)), {1, 1, 2, 2, 2}, tensor(0), true, out_dt, implementation_desc{out_fmt, ""} }); - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 27, 19, 17, 11}, wei_dt, format::goizyx, tensor(group(3), batch(7), feature(9), spatial(3, 3, 3)), tensor(1), tensor{{0, 0, -1, 1, 1}, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); - push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 27, 19, 17, 11}, wei_dt, format::goizyx, tensor(group(3), batch(7), feature(9), spatial(3, 3, 3)), {1, 1, 2, 2, 2}, tensor{{0, 0, 1, 1, 1}, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 27, 19, 17, 11}, wei_dt, format::goizyx, tensor(group(3), batch(7), feature(9), spatial(1, 1, 1)), {1, 1, 1}, {0, 0, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 27, 19, 17, 11}, wei_dt, format::goizyx, tensor(group(3), batch(7), feature(9), spatial(1, 1, 1)), {2, 2, 2}, {0, 0, 0}, true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 27, 19, 17, 11}, wei_dt, format::goizyx, tensor(group(3), batch(7), feature(9), spatial(3, 3, 3)), {1, 1, 1}, {1, 1, 1}, true, out_dt, implementation_desc{out_fmt, ""} }); + push_back(deconvolution_random_test_params{ in_dt, in_fmt, {b, 27, 19, 17, 11}, wei_dt, format::goizyx, tensor(group(3), batch(7), feature(9), spatial(3, 3, 3)), {2, 2, 2}, {1, 1, 1}, true, out_dt, implementation_desc{out_fmt, ""} }); } return *this; } @@ -2859,7 +2875,7 @@ TEST(deconvolution_f32_fw_gpu_onednn, basic_wsiz2x2_in2x2x1x1_stride2_nopad) { input_layout("input", input->get_layout()), data("weights", weights), data("biases", biases), - deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1,1,2,2 }) + deconvolution("deconv", "input", { "weights" }, { "biases" }, { 2,2 }) ); build_options bo; diff --git a/src/plugins/intel_gpu/tests/test_cases/depth_concatenate_gpu_test.cpp b/src/plugins/intel_gpu/tests/test_cases/depth_concatenate_gpu_test.cpp index 538ea0a7a00..4531527ce43 100644 --- a/src/plugins/intel_gpu/tests/test_cases/depth_concatenate_gpu_test.cpp +++ b/src/plugins/intel_gpu/tests/test_cases/depth_concatenate_gpu_test.cpp @@ -247,8 +247,8 @@ TEST(concatenate_f32_gpu, test_concatenation_of_pool_and_unpool) { topology.add(input_layout("input1", input1->get_layout())); topology.add(pooling("pool1", "input1", cldnn::pooling_mode::max, - {1, 1, 2, 1}, /*kernel*/ - {1, 1, 1, 1} /*stride*/ + {1, 2}, /*kernel*/ + {1, 1} /*stride*/ )); topology.add(resample("unpool1", "input1", tensor(1, 1, 2, 2), 0, resample_type::nearest)); topology.add(concatenation("concat1", {"pool1", "unpool1"}, 3)); @@ -450,7 +450,7 @@ TEST(depth_concatenate_f32_gpu, test06_padded_input) { topology.add(activation("actv1", "input1", activation_func::linear, { 0.75f, 0.0f })); topology.add(activation("actv2", "input2", activation_func::linear, { 0.5f, 0.0f })); topology.add(data("weights", weights)); - topology.add(convolution("conv", "actv2", { "weights" }, tensor(1), tensor(batch(0), feature(0), spatial(1, 1, 0, 0)))); + topology.add(convolution("conv", "actv2", { "weights" }, {1, 1}, {1, 1})); topology.add(concatenation("depth1", { "actv1", "actv2" }, 1)); topology.add(concatenation("depth2", { "depth1", "conv" }, 1)); topology.add(reorder("output", "depth2", format::bfyx, data_types::f32)); @@ -528,7 +528,7 @@ TEST(depth_concatenate_f32_gpu, test07_padded_output) { topology.add(activation("actv2", "input2", activation_func::linear, { 0.5f, 0.0f })); topology.add(concatenation("depth1", { "actv1", "actv2" }, 1)); topology.add(data("weights", weights)); - topology.add(convolution("conv", "depth1", { "weights" }, tensor(1), tensor(batch(0), feature(0), spatial(1, 1, 0, 0)))); + topology.add(convolution("conv", "depth1", { "weights" }, {1, 1}, {1, 1})); topology.add(reorder("output", "conv", format::bfyx, data_types::f32)); cldnn::build_options options; @@ -1182,7 +1182,7 @@ public: cldnn::tensor get_expected_output_tensor() override { cldnn::tensor::value_type features = 0; for (const auto& t : generic_params->input_layouts) { - features += t.size.feature[0]; + features += t.feature(); } const auto& t = generic_params->input_layouts[0].size; @@ -1193,18 +1193,18 @@ public: memory::ptr generate_reference_typed(const std::vector& inputs) { assert(!inputs.empty()); - const int in_b = inputs[0]->get_layout().size.batch[0]; - const int in_h = inputs[0]->get_layout().size.spatial[1]; - const int in_w = inputs[0]->get_layout().size.spatial[0]; + const int in_b = inputs[0]->get_layout().batch(); + const int in_h = inputs[0]->get_layout().spatial(1); + const int in_w = inputs[0]->get_layout().spatial(0); int out_f = 0; for (const memory::ptr& input : inputs) { - assert(input->get_layout().size.batch[0] == in_b); - assert(input->get_layout().size.spatial[1] == in_h); - assert(input->get_layout().size.spatial[0] == in_w); + assert(input->get_layout().batch() == in_b); + assert(input->get_layout().spatial(1) == in_h); + assert(input->get_layout().spatial(0) == in_w); - out_f += input->get_layout().size.feature[0]; + out_f += input->get_layout().feature(); assert(input->get_layout().data_type == inputs[0]->get_layout().data_type); assert(input->get_layout().format.value == inputs[0]->get_layout().format.value); @@ -1219,7 +1219,7 @@ public: const auto input_desc = get_linear_memory_desc(input->get_layout()); const auto output_desc = get_linear_memory_desc(output->get_layout()); - const int in_f = input->get_layout().size.feature[0]; + const int in_f = input->get_layout().feature(); cldnn::mem_lock in_mem(input, get_test_stream()); for (int n = 0; n < in_b; ++n) diff --git a/src/plugins/intel_gpu/tests/test_cases/max_unpooling_gpu_test.cpp b/src/plugins/intel_gpu/tests/test_cases/max_unpooling_gpu_test.cpp index 5bc6d9ce5b6..271b4ff155b 100644 --- a/src/plugins/intel_gpu/tests/test_cases/max_unpooling_gpu_test.cpp +++ b/src/plugins/intel_gpu/tests/test_cases/max_unpooling_gpu_test.cpp @@ -76,10 +76,10 @@ TEST(max_unpooling_gpu, basic_in2x3x2x2) { auto output_layout = output->get_layout(); EXPECT_EQ(output_layout.format, format::bfyx); - EXPECT_EQ(output_layout.size.spatial[1], 2); - EXPECT_EQ(output_layout.size.spatial[0], 3); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(1), 2); + EXPECT_EQ(output_layout.spatial(0), 3); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_output_vec = { 0.f, 0.f, 0.f, @@ -158,10 +158,10 @@ TEST(max_unpooling_gpu, basic_in2x3x2x2_output_padding) { auto output_layout = output->get_layout(); EXPECT_EQ(output_layout.format, format::bfyx); - EXPECT_EQ(output_layout.size.spatial[1], 2); - EXPECT_EQ(output_layout.size.spatial[0], 3); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(1), 2); + EXPECT_EQ(output_layout.spatial(0), 3); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_output_vec = { 0.f, 0.f, 0.f, 0.f, 0.f, @@ -249,10 +249,10 @@ TEST(max_unpooling_gpu, basic_in2x3x2x2_output_size) { auto output_layout = output->get_layout(); EXPECT_EQ(output_layout.format, format::bfyx); - EXPECT_EQ(output_layout.size.spatial[1], 2); - EXPECT_EQ(output_layout.size.spatial[0], 3); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(1), 2); + EXPECT_EQ(output_layout.spatial(0), 3); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_output_vec = { 0.f, 0.f, 0.f, @@ -330,10 +330,10 @@ TEST(max_unpooling_gpu, basic_in2x3x2x2_fp16) { auto output_layout = output->get_layout(); EXPECT_EQ(output_layout.format, format::bfyx); - EXPECT_EQ(output_layout.size.spatial[1], 2); - EXPECT_EQ(output_layout.size.spatial[0], 3); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(1), 2); + EXPECT_EQ(output_layout.spatial(0), 3); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_output_vec = { 0.f, 0.f, 0.f, @@ -394,7 +394,7 @@ TEST(max_unpooling_gpu, basic_in2x2x3x2_max_with_argmax_pooling_unpooling) { topology topology; topology.add(input_layout("input", input->get_layout())); topology.add(mutable_data("arg_max", arg_max)); - topology.add(pooling("pooling_max_with_argmax", "input", "arg_max", pooling_mode::max_with_argmax, { 1, 1, 2, 2 }, { 1, 1, 1, 1 })); + topology.add(pooling("pooling_max_with_argmax", "input", "arg_max", pooling_mode::max_with_argmax, { 2, 2 }, { 1, 1 })); topology.add(max_unpooling("max_unpooling", "pooling_max_with_argmax", "arg_max", { 1, 1, 2, 2 }, { 1, 1, 1, 1 }, { 0, 0, 0, 0 }, "")); network network(engine, topology); @@ -409,10 +409,10 @@ TEST(max_unpooling_gpu, basic_in2x2x3x2_max_with_argmax_pooling_unpooling) { cldnn::mem_lock argmax_ptr(arg_max, get_test_stream()); EXPECT_EQ(output_layout.format, format::bfyx); - EXPECT_EQ(output_layout.size.spatial[1], 2); - EXPECT_EQ(output_layout.size.spatial[0], 3); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(1), 2); + EXPECT_EQ(output_layout.spatial(0), 3); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_argmax_vec = { 4.0f, 4.0f, diff --git a/src/plugins/intel_gpu/tests/test_cases/memory_test.cpp b/src/plugins/intel_gpu/tests/test_cases/memory_test.cpp index 21db9a18143..d81b4b8eda2 100644 --- a/src/plugins/intel_gpu/tests/test_cases/memory_test.cpp +++ b/src/plugins/intel_gpu/tests/test_cases/memory_test.cpp @@ -105,7 +105,7 @@ TEST(memory_pool, basic_non_padded_relu_and_pooling_pipe) { topology.add(input_layout("input", input->get_layout())); topology.add(activation("relu", "input", activation_func::relu)); topology.add(activation("relu1", "relu", activation_func::relu)); - topology.add(pooling("pool1", "relu1", pooling_mode::max, { 1, 1, 3, 3 }, { 1, 1, 2, 2 })); + topology.add(pooling("pool1", "relu1", pooling_mode::max, { 3, 3 }, { 2, 2 })); topology.add(activation("relu2", "pool1", activation_func::relu)); topology.add(activation("relu3", "relu2", activation_func::relu)); topology.add(activation("relu4", "relu3", activation_func::relu)); @@ -254,10 +254,10 @@ TEST(memory_pool, DISABLED_shared_mem_pool_same_topology_twice) { EXPECT_EQ(output_layout_first, output_layout_second); - int y_size = output_layout_first.size.spatial[1]; - int x_size = output_layout_first.size.spatial[0]; - int f_size = output_layout_first.size.feature[0]; - int b_size = output_layout_first.size.batch[0]; + int y_size = output_layout_first.spatial(1); + int x_size = output_layout_first.spatial(0); + int f_size = output_layout_first.feature(); + int b_size = output_layout_first.batch(); int f_offset = y_size*x_size; int b_offset = f_size * f_offset; for (int b = 0; b < b_size; ++b) @@ -335,10 +335,10 @@ TEST(memory_pool, DISABLED_shared_mem_pool_same_topology_twice_weights) { EXPECT_TRUE(is_correct) << "Memory max peak is not correct"; EXPECT_EQ(output_layout_first, output_layout_second); - int y_size = output_layout_first.size.spatial[1]; - int x_size = output_layout_first.size.spatial[0]; - int f_size = output_layout_first.size.feature[0]; - int b_size = output_layout_first.size.batch[0]; + int y_size = output_layout_first.spatial(1); + int x_size = output_layout_first.spatial(0); + int f_size = output_layout_first.feature(); + int b_size = output_layout_first.batch(); int f_offset = y_size * x_size; int b_offset = f_size * f_offset; for (int b = 0; b < b_size; ++b) @@ -380,12 +380,14 @@ TEST(memory_pool, shared_mem_pool_diff_batches) { set_values(input_1, dummy_input_data_1); set_values(input_8, dummy_input_data_8); - set_values(weights, { 0.10f, 0.2f, 0.1f, 0.2f, 0.1f, 0.2f }); + set_values(weights, { 0.10f, 0.2f, 0.1f, 0.2f, 0.1f, 0.2f, + 0.10f, 0.2f, 0.1f, 0.2f, 0.1f, 0.2f, + 0.10f, 0.2f, 0.1f, 0.2f, 0.1f, 0.2f }); topology topo( input_layout("input", input_8->get_layout()), data("weights", weights), - convolution("conv", "input", { "weights" }, { 1, 1, 1, 2 }), + convolution("conv", "input", { "weights" }, { 2, 1 }), softmax("softmax", "conv")); build_options bo; @@ -396,14 +398,14 @@ TEST(memory_pool, shared_mem_pool_diff_batches) { auto outputs = network_first.execute(); auto dev_info = engine->get_device_info(); - EXPECT_EQ(engine->get_max_used_device_memory(), (uint64_t) 4744); + EXPECT_EQ(engine->get_max_used_device_memory(), (uint64_t)4744); topo.change_input_layout("input", input_1->get_layout());//change input layout to batch=1 network network_second(*engine, topo, bo); network_second.set_input_data("input", input_1); auto outputs_second = network_second.execute(); - EXPECT_EQ(engine->get_max_used_device_memory(), (uint64_t) 5912); + EXPECT_EQ(engine->get_max_used_device_memory(), (uint64_t)5912); } TEST(memory_pool, shared_dep_two_output) { diff --git a/src/plugins/intel_gpu/tests/test_cases/pooling_gpu_test.cpp b/src/plugins/intel_gpu/tests/test_cases/pooling_gpu_test.cpp index dfd05f3a268..3b6a3e947b8 100644 --- a/src/plugins/intel_gpu/tests/test_cases/pooling_gpu_test.cpp +++ b/src/plugins/intel_gpu/tests/test_cases/pooling_gpu_test.cpp @@ -225,7 +225,7 @@ TEST(pooling_forward_gpu, basic_max_byxf_f32_wsiz3x3_wstr1x1_i1x3x3x8_nopad) { topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); - topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, { 1, 1, 3, 3 }, { 1, 1, 1, 1 })); + topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, { 3, 3 }, { 1, 1 })); network network(engine, topology); set_values(input_prim, { 0.5f, -0.5f, -0.5f, -0.5f, 0.5f, -0.5f, -0.5f, -0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.5f, -0.5f, -0.5f, -0.5f, @@ -270,7 +270,7 @@ TEST(pooling_forward_gpu, basic_max_yxfb_f32_wsiz3x3_wstr1x1_i3x3x1x1_nopad) { topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); - topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, { 1, 1, 3, 3 }, { 1, 1, 1, 1 })); + topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, { 3, 3 }, { 1, 1 })); network network(engine, topology); set_values(input_prim, { -0.5f, 1.0f, 0.5f, 2.0f, 1.5f, -0.5f, 0.0f, -1.0f, 0.5f }); @@ -444,7 +444,7 @@ TEST(pooling_forward_gpu, basic_max_pooling_int8) { input, // 2. reorder primitive with id "reorder_input" reorder("reorder_input", input, byte_layout), - pooling("pool1", "reorder_input", pooling_mode::max, { 1, 1, 3, 3 }, {1, 1, 1, 1}), + pooling("pool1", "reorder_input", pooling_mode::max, { 3, 3 }, { 1, 1 }), reorder("reorder2", "pool1", out_layout) ); @@ -496,7 +496,7 @@ TEST(pooling_forward_gpu, basic_avg_pooling_int8) { input, // 2. reorder primitive with id "reorder_input" reorder("reorder_input", input, byte_layout), - pooling("pool1", "reorder_input", pooling_mode::average, { 1, 1, 3, 3 }, { 1, 1, 1, 1 }), + pooling("pool1", "reorder_input", pooling_mode::average, { 3, 3 }, { 1, 1 }), reorder("reorder2", "pool1", out_layout) ); @@ -539,7 +539,7 @@ TEST(pooling_forward_gpu, basic_max_yxfb_f32_wsiz2x2_wstr1x1_i3x3x1x1_nopad) { topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); - topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, { 1, 1, 2, 2 }, { 1, 1, 1, 1 })); + topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, { 2, 2 }, { 1, 1 })); network network(engine, topology); set_values(input_prim, { -0.5f, 1.0f, 0.5f, 2.0f, 1.5f, -0.5f, 0.0f, -1.0f, 0.5f }); @@ -583,7 +583,7 @@ TEST(pooling_forward_gpu, basic_max_yxfb_f32_wsiz2x2_wstr2x2_i4x4x1x1_nopad) { topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); - topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, { 1, 1, 2, 2 }, { 1, 1, 2, 2 })); + topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, { 2, 2 }, { 2, 2 })); network network(engine, topology); set_values(input_prim, { -0.25f, 1.00f, 0.50f, 0.25f, 2.00f, 1.50f, -0.50f, -0.75f, 0.00f, -1.00f, 0.50f, 0.25f, 0.50f, -2.00f, -1.50f, -2.50f }); @@ -637,7 +637,7 @@ TEST(pooling_forward_gpu, basic_max_yxfb_f32_wsiz2x2_wstr1x1_i3x3x2x2_nopad) { topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); - topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, { 1, 1, 2, 2 }, { 1, 1, 1, 1 })); + topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, { 2, 2 }, { 1, 1 })); network network(engine, topology); set_values(input_prim, { -0.5f, 0.5f, -1.5f, 0.0f, 0.5f, 0.0f, -0.5f, 0.5f, 0.0f, -0.5f, 0.0f, -0.5f, 1.0f, -2.0f, 0.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -2.0f, 1.0f, 1.5f, 0.0f, -1.0f, -0.5f, -2.0f, 0.5f, -0.5f, -1.0f, 1.0f, -0.5f, -0.5f, 1.5f, -0.5f, 0.0f }); @@ -687,7 +687,7 @@ TEST(pooling_forward_gpu, offsets_max_yxfb_f32_wsiz2x2_wstr2x2_i2x2x1x1_zeropad) topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); - topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, {1, 1, 2, 2}, {1, 1, 2, 2}, tensor{{0, 0, 1, 1}, 0})); + topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, {2, 2}, {2, 2}, {1, 1})); network network(engine, topology); set_values(input_prim, { 1.50f, -0.50f, -1.00f, 0.50f }); @@ -732,7 +732,7 @@ TEST(pooling_forward_gpu, offsets_max_yxfb_f32_wsiz2x2_wstr2x2_i3x3x1x1_zeropad) topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); - topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, {1, 1, 2, 2}, {1, 1, 2, 2}, tensor{{0, 0, 1, 1}, 0})); + topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, {2, 2}, {2, 2}, {1, 1})); network network(engine, topology); @@ -781,7 +781,7 @@ TEST(pooling_forward_gpu, basic_avg_yxfb_f32_wsiz2x2_wstr1x1_i3x3x1x1_nopad) { topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); - topology.add(pooling("pool_prim", "input_prim", pooling_mode::average,{ 1, 1, 2, 2 },{ 1, 1, 1, 1 })); + topology.add(pooling("pool_prim", "input_prim", pooling_mode::average, {2, 2}, {1, 1})); network network(engine, topology); set_values(input_prim, { -0.5f, 1.0f, 0.5f, 2.0f, 1.5f, -0.5f, 4.0f, -1.0f, 3.5f }); @@ -826,7 +826,7 @@ TEST(pooling_forward_gpu, offsets_avg_yxfb_f32_wsiz2x2_wstr2x2_i2x2x1x1_zeropad) topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); - topology.add(pooling("pool_prim", "input_prim", pooling_mode::average, {1, 1, 2, 2}, {1, 1, 2, 2}, tensor{{0, 0, 1, 1}, 0})); + topology.add(pooling("pool_prim", "input_prim", pooling_mode::average, {2, 2}, {2, 2}, {1, 1})); network network(engine, topology); set_values(input_prim, { 1.5f, -0.5f, -1.0f, 0.5f }); @@ -871,7 +871,7 @@ TEST(pooling_forward_gpu, offsets_avg_bfyx_f32_wsiz3x3_wstr3x3_i1x1x3x3_zeropad) topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); - topology.add(pooling("pool_prim", "input_prim", pooling_mode::average, { 1, -1, 3, 3 }, { 1, 1, 3, 3 }, tensor{{ 0,0,1,1 }, 0})); + topology.add(pooling("pool_prim", "input_prim", pooling_mode::average, { 3, 3 }, { 3, 3 }, {1, 1})); network network(engine, topology); @@ -919,7 +919,7 @@ TEST(pooling_forward_gpu, offsets_avg_yxfb_f32_wsiz2x2_wstr2x2_i3x3x1x1_zeropad) topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); - topology.add(pooling("pool_prim", "input_prim", pooling_mode::average, {1, 1, 2, 2}, {1, 1, 2, 2}, tensor{{0, 0, 1, 1}, 0})); + topology.add(pooling("pool_prim", "input_prim", pooling_mode::average, {2, 2}, {2, 2}, {1, 1})); network network(engine, topology); set_values(input_prim, { 1.5f, -0.5f, 2.5f, -1.0f, 0.5f, 3.0f, 0.5f, 0.0f, -8.0f }); @@ -974,7 +974,7 @@ TEST(pooling_forward_gpu, offsets_avg_yxfb_bfyx_f32_wsiz2x2_wstr2x2_i2x2x1x1_out topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); - topology.add(pooling("pool_prim", "input_prim", pooling_mode::average, {1, 1, 2, 2}, {1, 1, 2, 2}, tensor{{0, 0, 1, 1}, 0}, "", padding{{0, 0, 2, 2}, 0})); + topology.add(pooling("pool_prim", "input_prim", pooling_mode::average, {2, 2}, {2, 2}, {1, 1}, "", padding{{0, 0, 2, 2}, 0})); network network(engine, topology); set_values(input_prim, { 1.5f, -0.5f, -1.0f, 0.5f }); @@ -1035,7 +1035,7 @@ TEST(pooling_forward_gpu, offsets_max_yxfb_bfyx_f32_wsiz2x2_wstr2x2_i3x3x1x1_out topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); - topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, {1, 1, 2, 2}, {1, 1, 2, 2}, tensor{{0, 0, 1, 1}, 0}, "", padding{{0, 0, 1, 1}, 0})); + topology.add(pooling("pool_prim", "input_prim", pooling_mode::max, {2, 2}, {2, 2}, {1, 1}, "", padding{{0, 0, 1, 1}, 0})); network network(engine, topology); @@ -1106,7 +1106,7 @@ TEST(pooling_forward_gpu, offsets_avg_yxfb_bfyx_f32_wsiz2x2_wstr2x2_i2x2x1x1_inp topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); topology.add(reorder("reorder", "input_prim", input_prim->get_layout().with_padding(padding{ {0,0,1,2}, 0 }))); - topology.add(pooling("pool_prim", "reorder", pooling_mode::average, {1, 1, 2, 2}, {1, 1, 2, 2}, tensor{{0, 0, 1, 1}, 0}, "", padding{{0, 0, 2, 2}, 0})); + topology.add(pooling("pool_prim", "reorder", pooling_mode::average, {2, 2}, {2, 2}, {1, 1}, "", padding{{0, 0, 2, 2}, 0})); network network(engine, topology); set_values(input_prim, { 1.5f, -0.5f, -1.0f, 0.5f }); @@ -1169,7 +1169,7 @@ TEST(pooling_forward_gpu, offsets_max_yxfb_bfyx_f32_wsiz2x2_wstr2x2_i3x3x1x1_inp topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); topology.add(reorder("reorder", "input_prim", input_prim->get_layout().with_padding(padding{ { 0, 0, 1, 2 }, 0 }))); - topology.add(pooling("pool_prim", "reorder", pooling_mode::max, {1, 1, 2, 2}, {1, 1, 2, 2}, tensor{{0, 0, 1, 1}, 0}, "", padding{{0, 0, 1, 1}, 0})); + topology.add(pooling("pool_prim", "reorder", pooling_mode::max, {2, 2}, {2, 2}, {1, 1}, "", padding{{0, 0, 1, 1}, 0})); network network(engine, topology); @@ -1240,7 +1240,7 @@ TEST(pooling_forward_gpu, avg_yxfb_bfyx_f32_wsiz2x2_wstr2x2_i2x2x1x1_inpad2x1_ou topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); topology.add(reorder("reorder", "input_prim", input_prim->get_layout().with_padding(padding{ { 0, 0, 2, 1 }, 0 }))); - topology.add(pooling("pool_prim", "reorder", pooling_mode::average, { 1, 1, 2, 2 }, { 1, 1, 2, 2 }, { 0, 0, 0, 0 }, "", padding{ { 0, 0, 2, 2 }, 0 })); + topology.add(pooling("pool_prim", "reorder", pooling_mode::average, { 2, 2 }, { 2, 2 }, { 0, 0 }, "", padding{ { 0, 0, 2, 2 }, 0 })); network network(engine, topology); set_values(input_prim, { @@ -1308,7 +1308,7 @@ TEST(pooling_forward_gpu, max_yxfb_bfyx_f32_wsiz2x2_wstr2x2_i3x3x1x1_inpad2x1_ou topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); topology.add(reorder("reorder", "input_prim", input_prim->get_layout().with_padding(padding{ { 0, 0, 2, 1 }, 0 }))); - topology.add(pooling("pool_prim", "reorder", pooling_mode::max, {1, 1, 2, 2}, {1, 1, 2, 2}, tensor{{0, 0, 1, 1}, 0}, "", padding{{0, 0, 1, 1}, 0})); + topology.add(pooling("pool_prim", "reorder", pooling_mode::max, { 2, 2}, { 2, 2}, {1, 1}, "", padding{{0, 0, 1, 1}, 0})); network network(engine, topology); @@ -1383,7 +1383,7 @@ TEST(pooling_forward_gpu, basic_in2x2x3x2_max_with_argmax) { topology topology; topology.add(input_layout("input", input->get_layout())); topology.add(mutable_data("arg_max", arg_max)); - topology.add(pooling("pooling", "input", "arg_max", pooling_mode::max_with_argmax, { 1, 1, 2, 2 }, { 1, 1, 1, 1 })); + topology.add(pooling("pooling", "input", "arg_max", pooling_mode::max_with_argmax, { 2, 2 }, { 1, 1 })); network network(engine, topology); @@ -1397,10 +1397,10 @@ TEST(pooling_forward_gpu, basic_in2x2x3x2_max_with_argmax) { cldnn::mem_lock argmax_ptr(arg_max, get_test_stream()); EXPECT_EQ(output_layout.format, format::bfyx); - EXPECT_EQ(output_layout.size.spatial[1], 1); - EXPECT_EQ(output_layout.size.spatial[0], 2); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(1), 1); + EXPECT_EQ(output_layout.spatial(0), 2); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_argmax_vec = { 4.0f, 4.0f, @@ -1460,7 +1460,7 @@ TEST(pooling_forward_gpu, basic_in2x2x3x2x1_max_with_argmax) { topology topology; topology.add(input_layout("input", input->get_layout())); topology.add(mutable_data("arg_max", arg_max)); - topology.add(pooling("pooling", "input", "arg_max", pooling_mode::max_with_argmax, { 1, 1, 2, 2, 1 }, { 1, 1, 1, 1, 1 })); + topology.add(pooling("pooling", "input", "arg_max", pooling_mode::max_with_argmax, { 1, 2, 2 }, { 1, 1, 1 })); network network(engine, topology); @@ -1474,11 +1474,11 @@ TEST(pooling_forward_gpu, basic_in2x2x3x2x1_max_with_argmax) { cldnn::mem_lock argmax_ptr(arg_max, get_test_stream()); EXPECT_EQ(output_layout.format, format::bfzyx); - EXPECT_EQ(output_layout.size.spatial[2], 1); - EXPECT_EQ(output_layout.size.spatial[1], 1); - EXPECT_EQ(output_layout.size.spatial[0], 2); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(2), 1); + EXPECT_EQ(output_layout.spatial(1), 1); + EXPECT_EQ(output_layout.spatial(0), 2); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_argmax_vec = { 4.0f, 4.0f, @@ -1540,7 +1540,7 @@ TEST(pooling_forward_gpu, basic_in2x2x3x2_max_with_argmax_input_padding) { topology.add(input_layout("input", input->get_layout())); topology.add(reorder("reorder", "input", input->get_layout().with_padding(padding{ { 0, 0, 2, 2 }, 0 }))); topology.add(mutable_data("arg_max", arg_max)); - topology.add(pooling("pooling", "reorder", "arg_max", pooling_mode::max_with_argmax, { 1, 1, 2, 2 }, { 1, 1, 1, 1 })); + topology.add(pooling("pooling", "reorder", "arg_max", pooling_mode::max_with_argmax, { 2, 2 }, { 1, 1 })); network network(engine, topology); @@ -1554,10 +1554,10 @@ TEST(pooling_forward_gpu, basic_in2x2x3x2_max_with_argmax_input_padding) { cldnn::mem_lock argmax_ptr(arg_max, get_test_stream()); EXPECT_EQ(output_layout.format, format::bfyx); - EXPECT_EQ(output_layout.size.spatial[1], 1); - EXPECT_EQ(output_layout.size.spatial[0], 2); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(1), 1); + EXPECT_EQ(output_layout.spatial(0), 2); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_argmax_vec = { 4.0f, 4.0f, @@ -1619,7 +1619,7 @@ TEST(pooling_forward_gpu, basic_in2x2x3x2_max_with_argmax_output_padding) { topology.add(input_layout("input", input->get_layout())); topology.add(reorder("reorder", "input", input->get_layout().with_padding(padding{ { 0, 0, 2, 2 }, 0 }))); topology.add(mutable_data("arg_max", arg_max)); - topology.add(pooling("pooling", "reorder", "arg_max", pooling_mode::max_with_argmax, { 1, 1, 2, 2 }, { 1, 1, 1, 1 }, { 0, 0, 0, 0 }, "", padding({ 0, 0, 1, 1 }, 0))); + topology.add(pooling("pooling", "reorder", "arg_max", pooling_mode::max_with_argmax, { 2, 2 }, { 1, 1 }, { 0, 0 }, "", padding({ 0, 0, 1, 1 }, 0))); network network(engine, topology); @@ -1633,10 +1633,10 @@ TEST(pooling_forward_gpu, basic_in2x2x3x2_max_with_argmax_output_padding) { cldnn::mem_lock argmax_ptr(arg_max, get_test_stream()); EXPECT_EQ(output_layout.format, format::bfyx); - EXPECT_EQ(output_layout.size.spatial[1], 1); - EXPECT_EQ(output_layout.size.spatial[0], 2); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(1), 1); + EXPECT_EQ(output_layout.spatial(0), 2); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_argmax_vec = { 4.0f, 4.0f, @@ -1707,7 +1707,7 @@ TEST(pooling_forward_gpu, basic_in2x2x3x2_max_with_argmax_with_output_size) { topology topology; topology.add(input_layout("input", input->get_layout())); topology.add(mutable_data("arg_max", arg_max)); - topology.add(pooling("pooling", "input", "arg_max", pooling_mode::max_with_argmax, { 1, 1, 2, 2 }, { 1, 1, 1, 1 }, { 0, 0, 0, 0 }, { 2, 2, 2, 1 }, "")); + topology.add(pooling("pooling", "input", "arg_max", pooling_mode::max_with_argmax, { 2, 2 }, { 1, 1 }, { 0, 0 }, { 2, 2, 2, 1 }, "")); network network(engine, topology); @@ -1721,10 +1721,10 @@ TEST(pooling_forward_gpu, basic_in2x2x3x2_max_with_argmax_with_output_size) { cldnn::mem_lock argmax_ptr(arg_max, get_test_stream()); EXPECT_EQ(output_layout.format, format::bfyx); - EXPECT_EQ(output_layout.size.spatial[1], 1); - EXPECT_EQ(output_layout.size.spatial[0], 2); - EXPECT_EQ(output_layout.size.feature[0], 2); - EXPECT_EQ(output_layout.size.batch[0], 2); + EXPECT_EQ(output_layout.spatial(1), 1); + EXPECT_EQ(output_layout.spatial(0), 2); + EXPECT_EQ(output_layout.feature(), 2); + EXPECT_EQ(output_layout.batch(), 2); std::vector expected_argmax_vec = { 4.0f, 4.0f, @@ -1747,7 +1747,7 @@ TEST(pooling_forward_gpu, basic_in2x2x3x2_max_with_argmax_with_output_size) { } template -static void generic_average_wo_padding_test(format fmt, tensor output, tensor input, tensor window, tensor stride, tensor offset) +static void generic_average_wo_padding_test(format fmt, tensor output, tensor input, ov::Shape window, ov::Strides stride, ov::Shape offset) { constexpr auto dt = std::is_same::value ? data_types::f32 : data_types::f16; @@ -1766,10 +1766,15 @@ static void generic_average_wo_padding_test(format fmt, tensor output, tensor in topology tpl; tpl.add(input_layout("in", input_mem->get_layout())); + tensor off(0); + for (size_t i = 0; i < offset.size(); i++) { + off.spatial[i] = offset[offset.size() - i - 1]; + } + auto pool_in = "in"; - if (offset != tensor()) + if (off != tensor()) { - tpl.add(reorder("reorder", "in", input_mem->get_layout().with_padding((padding) offset.sizes()))); + tpl.add(reorder("reorder", "in", input_mem->get_layout().with_padding((padding) off.sizes()))); pool_in = "reorder"; } tpl.add(pooling("pool", pool_in, pooling_mode::average_no_padding, window, stride, offset)); @@ -1789,137 +1794,137 @@ static void generic_average_wo_padding_test(format fmt, tensor output, tensor in //bfyx fp32 TEST(pooling_forward_gpu, bfyx_average_without_padding_i3x3_w2x2_s2x2) { - generic_average_wo_padding_test(format::bfyx, (tensor) spatial(2, 2), (tensor) spatial(3, 3), (tensor) spatial(2, 2), tensor{ 0,0,2,2 }, tensor{}); + generic_average_wo_padding_test(format::bfyx, (tensor) spatial(2, 2), (tensor) spatial(3, 3), {2, 2}, {2, 2}, {0, 0}); } TEST(pooling_forward_gpu, bfyx_average_without_padding_i3x3_w2x2_s2x2_o1x1) { - generic_average_wo_padding_test(format::bfyx, (tensor) spatial(2, 2), (tensor) spatial(3, 3), (tensor) spatial(2, 2), tensor{ 0,0,2,2 }, tensor{ {0,0,1,1}, 0 }); + generic_average_wo_padding_test(format::bfyx, (tensor) spatial(2, 2), (tensor) spatial(3, 3), {2, 2}, {2, 2}, {1, 1}); } TEST(pooling_forward_gpu, bfyx_average_without_padding_i3x3_w2x2_s3x3_o1x1) { - generic_average_wo_padding_test(format::bfyx, (tensor) spatial(2, 2), (tensor) spatial(3, 3), (tensor) spatial(3, 3), tensor{ 0,0,2,2 }, tensor{ {0,0,1,1}, 0 }); + generic_average_wo_padding_test(format::bfyx, (tensor) spatial(2, 2), (tensor) spatial(3, 3), {3, 3}, {2, 2}, {1, 1}); } TEST(pooling_forward_gpu, bfyx_average_without_padding_i1x1_w3x3_s1x1_o1x1) { - generic_average_wo_padding_test(format::bfyx, (tensor) spatial(1, 1), (tensor) spatial(1, 1), (tensor) spatial(3, 3), tensor{ 0,0,1,1 }, tensor{ {0,0,1,1}, 0 }); + generic_average_wo_padding_test(format::bfyx, (tensor) spatial(1, 1), (tensor) spatial(1, 1), {3, 3}, {1, 1}, {1, 1}); } //bfyx fp16 TEST(pooling_forward_gpu, bfyx_average_without_padding_i3x3_w2x2_s2x2_fp16) { - generic_average_wo_padding_test(format::bfyx, (tensor) spatial(2, 2), (tensor) spatial(3, 3), (tensor) spatial(2, 2), tensor{ 0,0,2,2 }, tensor{}); + generic_average_wo_padding_test(format::bfyx, (tensor) spatial(2, 2), (tensor) spatial(3, 3), {2, 2}, {2, 2}, {0, 0}); } TEST(pooling_forward_gpu, bfyx_average_without_padding_i3x3_w2x2_s2x2_o1x1_fp16) { - generic_average_wo_padding_test(format::bfyx, (tensor) spatial(2, 2), (tensor) spatial(3, 3), (tensor) spatial(2, 2), tensor{ 0,0,2,2 }, tensor{ {0,0,1,1}, 0 }); + generic_average_wo_padding_test(format::bfyx, (tensor) spatial(2, 2), (tensor) spatial(3, 3), {2, 2}, {2, 2}, {1, 1}); } TEST(pooling_forward_gpu, bfyx_average_without_padding_i3x3_w2x2_s3x3_o1x1_fp16) { - generic_average_wo_padding_test(format::bfyx, (tensor) spatial(2, 2), (tensor) spatial(3, 3), (tensor) spatial(3, 3), tensor{ 0,0,2,2 }, tensor{ {0,0,1,1}, 0 }); + generic_average_wo_padding_test(format::bfyx, (tensor) spatial(2, 2), (tensor) spatial(3, 3), {3, 3}, {2, 2}, {1, 1}); } TEST(pooling_forward_gpu, bfyx_average_without_padding_i1x1_w3x3_s1x1_o1x1_fp16) { - generic_average_wo_padding_test(format::bfyx, (tensor) spatial(1, 1), (tensor) spatial(1, 1), (tensor) spatial(3, 3), tensor{ 0,0,1,1 }, tensor{ {0,0,1,1}, 0 }); + generic_average_wo_padding_test(format::bfyx, (tensor) spatial(1, 1), (tensor) spatial(1, 1), {3, 3}, {1, 1}, {1, 1}); } //yxfb fp32 TEST(pooling_forward_gpu, yxfb_average_without_padding_i3x3_w2x2_s2x2) { - generic_average_wo_padding_test(format::yxfb, (tensor) spatial(2, 2), (tensor) spatial(3, 3), (tensor) spatial(2, 2), tensor{ 0,0,2,2 }, tensor{}); + generic_average_wo_padding_test(format::yxfb, (tensor) spatial(2, 2), (tensor) spatial(3, 3), {2, 2}, {2, 2}, {0, 0}); } TEST(pooling_forward_gpu, yxfb_average_without_padding_i3x3_w2x2_s2x2_o1x1) { - generic_average_wo_padding_test(format::yxfb, (tensor) spatial(2, 2), (tensor) spatial(3, 3), (tensor) spatial(2, 2), tensor{ 0,0,2,2 }, tensor{ {0,0,1,1}, 0 }); + generic_average_wo_padding_test(format::yxfb, (tensor) spatial(2, 2), (tensor) spatial(3, 3), {2, 2}, {2, 2}, {1, 1}); } TEST(pooling_forward_gpu, yxfb_average_without_padding_i3x3_w2x2_s3x3_o1x1) { - generic_average_wo_padding_test(format::yxfb, (tensor) spatial(2, 2), (tensor) spatial(3, 3), (tensor) spatial(3, 3), tensor{ 0,0,2,2 }, tensor{ {0,0,1,1}, 0 }); + generic_average_wo_padding_test(format::yxfb, (tensor) spatial(2, 2), (tensor) spatial(3, 3), {3, 3}, {2, 2}, {1, 1}); } TEST(pooling_forward_gpu, yxfb_average_without_padding_i1x1_w3x3_s1x1_o1x1) { - generic_average_wo_padding_test(format::yxfb, (tensor) spatial(1, 1), (tensor) spatial(1, 1), (tensor) spatial(3, 3), tensor{ 0,0,1,1 }, tensor{ {0,0,1,1}, 0 }); + generic_average_wo_padding_test(format::yxfb, (tensor) spatial(1, 1), (tensor) spatial(1, 1), {3, 3}, {1, 1}, {1, 1}); } //yxfb fp16 TEST(pooling_forward_gpu, yxfb_average_without_padding_i3x3_w2x2_s2x2_fp16) { - generic_average_wo_padding_test(format::yxfb, (tensor) spatial(2, 2), (tensor) spatial(3, 3), (tensor) spatial(2, 2), tensor{ 0,0,2,2 }, tensor{}); + generic_average_wo_padding_test(format::yxfb, (tensor) spatial(2, 2), (tensor) spatial(3, 3), {2, 2}, {2, 2}, {0, 0}); } TEST(pooling_forward_gpu, yxfb_average_without_padding_i3x3_w2x2_s2x2_o1x1_fp16) { - generic_average_wo_padding_test(format::yxfb, (tensor) spatial(2, 2), (tensor) spatial(3, 3), (tensor) spatial(2, 2), tensor{ 0,0,2,2 }, tensor{ {0,0,1,1}, 0 }); + generic_average_wo_padding_test(format::yxfb, (tensor) spatial(2, 2), (tensor) spatial(3, 3), {2, 2}, {2, 2}, {1, 1}); } TEST(pooling_forward_gpu, yxfb_average_without_padding_i3x3_w2x2_s3x3_o1x1_fp16) { - generic_average_wo_padding_test(format::yxfb, (tensor) spatial(2, 2), (tensor) spatial(3, 3), (tensor) spatial(3, 3), tensor{ 0,0,2,2 }, tensor{ {0,0,1,1}, 0 }); + generic_average_wo_padding_test(format::yxfb, (tensor) spatial(2, 2), (tensor) spatial(3, 3), {3, 3}, {2, 2}, {1, 1}); } TEST(pooling_forward_gpu, yxfb_average_without_padding_i1x1_w3x3_s1x1_o1x1_fp16) { - generic_average_wo_padding_test(format::yxfb, (tensor) spatial(1, 1), (tensor) spatial(1, 1), (tensor) spatial(3, 3), tensor{ 0,0,1,1 }, tensor{ {0,0,1,1}, 0 }); + generic_average_wo_padding_test(format::yxfb, (tensor) spatial(1, 1), (tensor) spatial(1, 1), {3, 3}, {1, 1}, {1, 1}); } //bfzyx fp32 TEST(pooling_forward_gpu, bfzyx_average_without_padding_i3x3x3_w2x2x2_s2x2x2) { - generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(2, 2, 2), (tensor) spatial(3, 3, 3), (tensor) spatial(2, 2, 2), tensor{ 0,0,2,2,2 }, tensor{}); + generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(2, 2, 2), (tensor) spatial(3, 3, 3), {2, 2, 2}, {2, 2, 2}, {0, 0, 0}); } TEST(pooling_forward_gpu, bfzyx_average_without_padding_i3x3x3_w2x2x2_s2x2x2_o1x1x1) { - generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(2, 2, 2), (tensor) spatial(3, 3, 3), (tensor) spatial(2, 2, 3), tensor{ 0,0,2,2,3 }, tensor{ {0,0,1,1,1}, 0 }); + generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(2, 2, 2), (tensor) spatial(3, 3, 3), {3, 2, 2}, {3, 2, 2}, {1, 1, 1}); } TEST(pooling_forward_gpu, bfzyx_average_without_padding_i3x3x3_w2x2x2_s3x3x3_o1x1x1) { - generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(2, 2, 2), (tensor) spatial(3, 3, 3), (tensor) spatial(3, 3, 3), tensor{ 0,0,2,2,2 }, tensor{ {0,0,1,1,1}, 0 }); + generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(2, 2, 2), (tensor) spatial(3, 3, 3), {3, 3, 3}, {2, 2, 2}, {1, 1, 1}); } TEST(pooling_forward_gpu, bfzyx_average_without_padding_i1x1x1_w3x3x3_s1x1x1_o1x1x1) { - generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(1, 1, 1), (tensor) spatial(1, 1, 1), (tensor) spatial(3, 3, 3), tensor{ 0,0,1,1,1 }, tensor{ {0,0,1,1,1}, 0 }); + generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(1, 1, 1), (tensor) spatial(1, 1, 1), {3, 3, 3}, {1, 1, 1}, {1, 1, 1}); } TEST(pooling_forward_gpu, bfzyx_average_without_padding_i3x3x3_w3x3x3_s3x3x3) { - generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(1, 1, 1), (tensor) spatial(3, 3, 3), (tensor) spatial(3, 3, 3), tensor{ 0,0,3,3,3 }, tensor{}); + generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(1, 1, 1), (tensor) spatial(3, 3, 3), {3, 3, 3}, {3, 3, 3}, {0, 0, 0}); } //bfzyx fp16 TEST(pooling_forward_gpu, bfzyx_average_without_padding_i3x3x3_w2x2x2_s2x2x2_fp16) { - generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(2, 2, 2), (tensor) spatial(3, 3, 3), (tensor) spatial(2, 2, 2), tensor{ 0,0,2,2,2 }, tensor{}); + generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(2, 2, 2), (tensor) spatial(3, 3, 3), {2, 2, 2}, {2, 2, 2}, {0, 0, 0}); } TEST(pooling_forward_gpu, bfzyx_average_without_padding_i3x3x3_w2x2x2_s2x2x2_o1x1x1_fp16) { - generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(2, 2, 2), (tensor) spatial(3, 3, 3), (tensor) spatial(2, 2, 2), tensor{ 0,0,2,2,2 }, tensor{ {0,0,1,1,1}, 0 }); + generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(2, 2, 2), (tensor) spatial(3, 3, 3), {2, 2, 2}, {2, 2, 2}, {1, 1, 1}); } TEST(pooling_forward_gpu, bfzyx_average_without_padding_i3x3x3_w2x2x3_s3x3x3_o1x1x1_fp16) { - generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(2, 2, 2), (tensor) spatial(3, 3, 3), (tensor) spatial(3, 3, 3), tensor{ 0,0,2,2,2 }, tensor{ {0,0,1,1,1}, 0 }); + generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(2, 2, 2), (tensor) spatial(3, 3, 3), {3, 3, 3}, {2, 2, 2}, {1, 1, 1}); } TEST(pooling_forward_gpu, bfzyx_average_without_padding_i1x1x1_w3x3x3_s1x1x1_o1x1x1_fp16) { - generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(1, 1, 1), (tensor) spatial(1, 1, 1), (tensor) spatial(3, 3, 3), tensor{ 0,0,1,1,1 }, tensor{ {0,0,1,1,1}, 0 }); + generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(1, 1, 1), (tensor) spatial(1, 1, 1), {3, 3, 3}, {1, 1, 1}, {1, 1, 1}); } TEST(pooling_forward_gpu, bfzyx_average_without_padding_i3x3x3_w3x3x3_s3x3x3_fp16) { - generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(1, 1, 1), (tensor) spatial(3, 3, 3), (tensor) spatial(3, 3, 3), tensor{ 0,0,3,3,3 }, tensor{}); + generic_average_wo_padding_test(format::bfzyx, (tensor) spatial(1, 1, 1), (tensor) spatial(3, 3, 3), {3, 3, 3}, {3, 3, 3}, {0, 0, 0}); } TEST(pooling_forward_gpu, b_fs_yx_fsv4) @@ -1937,11 +1942,11 @@ TEST(pooling_forward_gpu, b_fs_yx_fsv4) int in_X = I_array[j], in_Y = in_X; - int W_X = W_array[j], - W_Y = W_X; + size_t W_X = W_array[j], + W_Y = W_X; - int S_X = S_array[j], - S_Y = S_X; + uint64_t S_X = S_array[j], + S_Y = S_X; // Input data init std::vector Data(in_B * in_F * in_X * in_Y); @@ -1965,8 +1970,8 @@ TEST(pooling_forward_gpu, b_fs_yx_fsv4) auto pool = pooling("pool_GOLD", "input", pooling_mode::max, - { 1, 1, W_X, W_Y }, // kernel_size - { 1, 1, S_X, S_Y }); // stride + { W_Y, W_X }, // kernel_size + { S_Y, S_X }); // stride // Create a topology with a simple Convolution layer topology topology(input_layout("input", input->get_layout()), @@ -2012,8 +2017,8 @@ TEST(pooling_forward_gpu, b_fs_yx_fsv4) topology.add(pooling("pool_IMAD", "reorder_Swizzelled", pooling_mode::max, - { 1, 1, W_X, W_Y }, // kernel_size - { 1, 1, S_X, S_Y })); // stride + { W_Y, W_X }, // kernel_size + { S_Y, S_X })); // stride // Back reordering (a-ka unswizzelling) output from MMAD/IMAD pooling topology.add(reorder("reorder_UnSwizzelled", @@ -2073,7 +2078,7 @@ TEST(pooling_forward_gpu, fs_b_yx_fsv32_avg_3x3_input_2x2_pool_1x1_stride_2x2_ou topology topology; topology.add(input_layout("input", input_prim->get_layout())); topology.add(reorder("reorder_input", "input", layout(data_types::f16, format::fs_b_yx_fsv32, { 1, 1, 3, 3 }))); - topology.add(pooling("avg_pooling", "reorder_input", pooling_mode::average, { 1, 1, 2, 2 }, { 1, 1, 1, 1 })); + topology.add(pooling("avg_pooling", "reorder_input", pooling_mode::average, { 2, 2 }, { 1, 1 })); topology.add(reorder("reorder_after_pooling", "avg_pooling", layout(data_types::f16, format::bfyx, { 1, 1, 2, 2 }))); network network(engine, topology); @@ -2125,7 +2130,7 @@ TEST(pooling_forward_gpu, fs_b_yx_fsv32_avg_3x3_input_2x2_pool_2x2_stride) topology topology; topology.add(input_layout("input", input_prim->get_layout())); topology.add(reorder("reorder_input", "input", layout(data_types::f16, format::fs_b_yx_fsv32, { 1, 1, 3, 3 }))); - topology.add(pooling("avg_pooling", "reorder_input", pooling_mode::average, { 1, 1, 2, 2 }, { 1, 1, 2, 2 })); + topology.add(pooling("avg_pooling", "reorder_input", pooling_mode::average, { 2, 2 }, { 2, 2 })); topology.add(reorder("reorder_after_pooling", "avg_pooling", layout(data_types::f16, format::bfyx, { 1, 1, 3, 3 }))); network network(engine, topology); @@ -2191,7 +2196,7 @@ TEST(pooling_forward_gpu, fs_b_yx_fsv32_avg_2x2x3x3_input_2x2_pool_2x2_stride) topology topology; topology.add(input_layout("input", input_prim->get_layout())); topology.add(reorder("reorder_input", "input", layout(data_types::f16, format::fs_b_yx_fsv32, { batch_count, features_count, 3, 3 }))); - topology.add(pooling("avg_pooling", "reorder_input", pooling_mode::average, { 1, 1, 2, 2 }, { 1, 1, 2, 2 })); + topology.add(pooling("avg_pooling", "reorder_input", pooling_mode::average, { 2, 2 }, { 2, 2 })); topology.add(reorder("reorder_after_pooling", "avg_pooling", layout(data_types::f16, format::bfyx, { batch_count, features_count, out_y, out_x }))); network network(engine, topology); @@ -2262,7 +2267,7 @@ TEST(pooling_forward_gpu, fs_b_yx_fsv32_max_1x1x3x3_input_2x2_pool_2x2_stride_2x topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); topology.add(reorder("reorder_input", "input_prim", layout(data_types::f16, format::fs_b_yx_fsv32, input_tensor))); - topology.add(pooling("pool_prim", "reorder_input", pooling_mode::max, {1, 1, 2, 2}, {1, 1, 2, 2}, tensor{{0, 0, 1, 1}, 0}, "", padding{{0, 0, 1, 1}, 0})); + topology.add(pooling("pool_prim", "reorder_input", pooling_mode::max, {2, 2}, {2, 2}, {1, 1}, "", padding{{0, 0, 1, 1}, 0})); topology.add(reorder("reorder_pooling", "pool_prim", layout(data_types::f16, format::bfyx, { 1,1,4,4 }, padding{ { 0, 0, 1, 1 }, 0 }))); network network(engine, topology); @@ -2335,7 +2340,7 @@ TEST(pooling_forward_gpu, fs_b_yx_fsv32_max_1x1x5x5_input_2x2_pool_2x2_stride_2x topology topology; topology.add(input_layout("input_prim", input_prim->get_layout())); topology.add(reorder("reorder_input", "input_prim", layout(data_types::f16, format::fs_b_yx_fsv32, input_tensor, padding{ { 0, 0, 2, 1 } , 0 }))); - topology.add(pooling("pool_prim", "reorder_input", pooling_mode::max, {1, 1, 2, 2}, {1, 1, 2, 2}, tensor{{0, 0, 1, 1}, 0}, "", padding{{0, 0, 1, 1}, 0})); + topology.add(pooling("pool_prim", "reorder_input", pooling_mode::max, {2, 2}, {2, 2}, {1, 1}, "", padding{{0, 0, 1, 1}, 0})); topology.add(reorder("reorder_pooling", "pool_prim", layout(data_types::f16, format::bfyx, input_tensor, padding{ { 0, 0, 1, 1 }, 0 }))); network network(engine, topology); @@ -2412,7 +2417,7 @@ TEST(pooling_forward_gpu, fs_b_yx_fsv32_avg_65x5x6x7_input_3x3_pool_4x4_stride_3 topology golden_topology; golden_topology.add(input_layout("input", input_prim->get_layout())); golden_topology.add(reorder("reorder_input", "input", input_prim->get_layout().with_padding(padding{ {0,0,x_in_pad,y_in_pad},0 }))); - golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::average, { 1, 1, pool_size, pool_size }, { 1, 1, stride_size, stride_size }, { 0, 0, 0, 0 }, "", padding{ { 0, 0, x_out_pad, y_out_pad }, 0 })); + golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::average, { pool_size, pool_size }, { stride_size, stride_size }, { 0, 0 }, "", padding{ { 0, 0, x_out_pad, y_out_pad }, 0 })); network golden_network(engine, golden_topology); golden_network.set_input_data("input", input_prim); @@ -2429,7 +2434,7 @@ TEST(pooling_forward_gpu, fs_b_yx_fsv32_avg_65x5x6x7_input_3x3_pool_4x4_stride_3 topology golden_topology; golden_topology.add(input_layout("input", input_prim->get_layout())); golden_topology.add(reorder("reorder_input", "input", layout(data_types::f16, format::fs_b_yx_fsv32, input_tensor, padding{ {0, 0, x_in_pad, y_in_pad}, 0 }))); - golden_topology.add(pooling("fsv32_pooling", "reorder_input", pooling_mode::average, { 1, 1, pool_size, pool_size }, { 1, 1, stride_size, stride_size }, { 0, 0, 0, 0 }, "", padding{ { 0, 0, x_out_pad, y_out_pad }, 0 })); + golden_topology.add(pooling("fsv32_pooling", "reorder_input", pooling_mode::average, { pool_size, pool_size }, { stride_size, stride_size }, { 0, 0 }, "", padding{ { 0, 0, x_out_pad, y_out_pad }, 0 })); golden_topology.add(reorder("reorder_pooling", "fsv32_pooling", layout(data_types::f16, format::bfyx, input_tensor, padding{ { 0,0,x_out_pad,y_out_pad },0 }))); network fsv32_network(engine, golden_topology); @@ -2463,15 +2468,23 @@ public: topology topo; topo.add(input_layout("input", input_lay)); + ov::Shape kernel = {pool_y(), pool_x()}; + ov::Strides stride = {stride_y(), stride_x()}; + ov::Shape pad = {offset_y(), offset_x()}; + if (input_lay.get_spatial_rank() == 3) { + kernel.insert(kernel.begin(), pool_z()); + stride.insert(stride.begin(), stride_z()); + pad.insert(pad.begin(), offset_z()); + } if (global_pooling()) topo.add(pooling("pool", "input", pool_mode())); else topo.add(pooling("pool", "input", pool_mode(), - tensor(batch(0), feature(0), spatial(pool_x(), pool_y(), pool_z())), - tensor(batch(0), feature(0), spatial(stride_x(), stride_y(), stride_z())), - tensor(batch(0), feature(0), spatial(offset_x(), offset_y(), offset_z())))); + kernel, + stride, + pad)); return topo; } @@ -2521,11 +2534,11 @@ public: SCOPED_TRACE("\nkernel: " + kernel); ASSERT_EQ(out_lay.data_type, output_type()); - ASSERT_EQ(out_lay.size.batch[0], expected.size()); - ASSERT_EQ(out_lay.size.feature[0], expected[0].size()); - ASSERT_EQ(out_lay.size.spatial[2], expected[0][0].size()); - ASSERT_EQ(out_lay.size.spatial[1], expected[0][0][0].size()); - ASSERT_EQ(out_lay.size.spatial[0], expected[0][0][0][0].size()); + ASSERT_EQ(out_lay.batch(), expected.size()); + ASSERT_EQ(out_lay.feature(), expected[0].size()); + ASSERT_EQ(out_lay.spatial(2), expected[0][0].size()); + ASSERT_EQ(out_lay.spatial(1), expected[0][0][0].size()); + ASSERT_EQ(out_lay.spatial(0), expected[0][0][0][0].size()); bool compare_with_tolerance = input_type() == data_types::f16; @@ -2568,12 +2581,12 @@ public: size_t pool_x() { return _pool_x; } size_t pool_y() { return _pool_y; } size_t pool_z() { return _pool_z; } - int stride_x() { return _stride_x; } - int stride_y() { return _stride_y; } - int stride_z() { return _stride_z; } - int offset_x() { return _offset_x; } - int offset_y() { return _offset_y; } - int offset_z() { return _offset_z; } + uint64_t stride_x() { return _stride_x; } + uint64_t stride_y() { return _stride_y; } + uint64_t stride_z() { return _stride_z; } + size_t offset_x() { return _offset_x; } + size_t offset_y() { return _offset_y; } + size_t offset_z() { return _offset_z; } bool global_pooling() { return _global_pooling; } void set_input(format::type input_fmt, VVVVVF input_data) { @@ -2859,10 +2872,10 @@ TEST(pooling_forward_gpu, bsv16_fsv16_max_16x16x8x8_input_2x2_pool_2x2_stride) const int x_input = 8; const int y_input = 8; - const int pool_size = 2; - const int stride_size = 2; - const int x_in_pad = 2; - const int y_in_pad = 2; + const size_t pool_size = 2; + const uint64_t stride_size = 2; + const size_t x_in_pad = 2; + const size_t y_in_pad = 2; const tensor input_tensor(batches, features, x_input, y_input); @@ -2879,8 +2892,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_max_16x16x8x8_input_2x2_pool_2x2_stride) topology golden_topology; golden_topology.add(input_layout("input", input_prim->get_layout())); golden_topology.add(reorder("reorder_input", "input", input_prim->get_layout())); - golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::max, {1, 1, pool_size, pool_size}, - {1, 1, stride_size, stride_size}, tensor{{0, 0, x_in_pad, y_in_pad}, 0})); + golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::max, {pool_size, pool_size}, + {stride_size, stride_size},{y_in_pad, x_in_pad})); network golden_network(engine, golden_topology); golden_network.set_input_data("input", input_prim); @@ -2899,8 +2912,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_max_16x16x8x8_input_2x2_pool_2x2_stride) tested_topology.add(input_layout("input", input_prim->get_layout())); tested_topology.add(reorder("reorder_input", "input", layout(data_types::f32, format::bs_fs_yx_bsv16_fsv16, input_tensor))); - tested_topology.add(pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::max, {1, 1, pool_size, pool_size}, - {1, 1, stride_size, stride_size}, tensor{{0, 0, x_in_pad, y_in_pad}, 0})); + tested_topology.add(pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::max, {pool_size, pool_size}, + {stride_size, stride_size}, {y_in_pad, x_in_pad})); tested_topology.add(reorder("reorder_pooling", "bsv16_fsv16_pooling", layout(data_types::f32, format::bfyx, input_tensor))); @@ -2943,10 +2956,10 @@ TEST(pooling_forward_gpu, bsv16_fsv16_max_16x16x2x2_input_4x4_pool_1x1_stride_1x const int x_input = 2; const int y_input = 2; - const int pool_size = 4; - const int stride_size = 1; - const int x_in_pad = 1; - const int y_in_pad = 1; + const size_t pool_size = 4; + const uint64_t stride_size = 1; + const size_t x_in_pad = 1; + const size_t y_in_pad = 1; const tensor input_tensor(batches, features, x_input, y_input); @@ -2964,8 +2977,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_max_16x16x2x2_input_4x4_pool_1x1_stride_1x golden_topology.add(input_layout("input", input_prim->get_layout())); golden_topology.add(reorder("reorder_input", "input", input_prim->get_layout())); golden_topology.add( - pooling("golden_pooling", "reorder_input", pooling_mode::max, {1, 1, pool_size, pool_size}, - {1, 1, stride_size, stride_size}, tensor{{0, 0, x_in_pad, y_in_pad}, 0})); + pooling("golden_pooling", "reorder_input", pooling_mode::max, {pool_size, pool_size}, + {stride_size, stride_size}, {y_in_pad, x_in_pad})); network golden_network(engine, golden_topology); golden_network.set_input_data("input", input_prim); @@ -2984,8 +2997,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_max_16x16x2x2_input_4x4_pool_1x1_stride_1x tested_topology.add(reorder("reorder_input", "input", layout(data_types::f32, format::bs_fs_yx_bsv16_fsv16, input_tensor))); tested_topology.add( - pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::max, {1, 1, pool_size, pool_size}, - {1, 1, stride_size, stride_size}, tensor{{0, 0, x_in_pad, y_in_pad}, 0})); + pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::max, {pool_size, pool_size}, + {stride_size, stride_size}, {y_in_pad, x_in_pad})); tested_topology.add(reorder("reorder_pooling", "bsv16_fsv16_pooling", layout(data_types::f32, format::bfyx, input_tensor))); build_options op; @@ -3026,10 +3039,10 @@ TEST(pooling_forward_gpu, bsv16_fsv16_avg_16x16x20x20_input_5x5_pool_3x3_stride) const int x_input = 20; const int y_input = 20; - const int pool_size = 5; - const int stride_size = 3; - const int x_in_pad = 0; - const int y_in_pad = 0; + const size_t pool_size = 5; + const uint64_t stride_size = 3; + const size_t x_in_pad = 0; + const size_t y_in_pad = 0; const tensor input_tensor(batches, features, x_input, y_input); @@ -3046,8 +3059,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_avg_16x16x20x20_input_5x5_pool_3x3_stride) topology golden_topology; golden_topology.add(input_layout("input", input_prim->get_layout())); golden_topology.add(reorder("reorder_input", "input", input_prim->get_layout())); - golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::average, {1, 1, pool_size, pool_size}, - {1, 1, stride_size, stride_size}, {0, 0, -x_in_pad, -y_in_pad})); + golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::average, {pool_size, pool_size}, + {stride_size, stride_size}, {y_in_pad, x_in_pad})); network golden_network(engine, golden_topology); golden_network.set_input_data("input", input_prim); @@ -3067,8 +3080,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_avg_16x16x20x20_input_5x5_pool_3x3_stride) tested_topology.add(input_layout("input", input_prim->get_layout())); tested_topology.add(reorder("reorder_input", "input", layout(data_types::f32, format::bs_fs_yx_bsv16_fsv16, input_tensor))); - tested_topology.add(pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::average, {1, 1, pool_size, pool_size}, - {1, 1, stride_size, stride_size}, {0, 0, -x_in_pad, -y_in_pad})); + tested_topology.add(pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::average, {pool_size, pool_size}, + {stride_size, stride_size}, {y_in_pad, x_in_pad})); tested_topology.add(reorder("reorder_pooling", "bsv16_fsv16_pooling", layout(data_types::f32, format::bfyx, input_tensor))); @@ -3131,8 +3144,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_avg_16x16x20x20_input_5x5_pool_3x1_stride) topology golden_topology; golden_topology.add(input_layout("input", input_prim->get_layout())); golden_topology.add(reorder("reorder_input", "input", input_prim->get_layout())); - golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::average, {1, 1, pool_size, pool_size}, - {1, 1, stride_size_x, stride_size_y}, {0, 0, -x_in_pad, -y_in_pad})); + golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::average, {pool_size, pool_size}, + {stride_size_y, stride_size_x}, {y_in_pad, x_in_pad})); network golden_network(engine, golden_topology); golden_network.set_input_data("input", input_prim); @@ -3151,8 +3164,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_avg_16x16x20x20_input_5x5_pool_3x1_stride) topology tested_topology; tested_topology.add(input_layout("input", input_prim->get_layout())); tested_topology.add(reorder("reorder_input", "input", layout(data_types::f32, format::bs_fs_yx_bsv16_fsv16, input_tensor))); - tested_topology.add(pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::average, {1, 1, pool_size, pool_size}, - {1, 1, stride_size_x, stride_size_y}, {0, 0, -x_in_pad, -y_in_pad})); + tested_topology.add(pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::average, {pool_size, pool_size}, + {stride_size_y, stride_size_x}, {y_in_pad, x_in_pad})); tested_topology.add(reorder("reorder_pooling", "bsv16_fsv16_pooling", layout(data_types::f32, format::bfyx, input_tensor))); build_options op; @@ -3214,8 +3227,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_max_16x16x20x20_input_5x5_pool_3x1_stride) topology golden_topology; golden_topology.add(input_layout("input", input_prim->get_layout())); golden_topology.add(reorder("reorder_input", "input", input_prim->get_layout())); - golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::max, {1, 1, pool_size, pool_size}, - {1, 1, stride_size_x, stride_size_y}, {0, 0, -x_in_pad, -y_in_pad})); + golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::max, {pool_size, pool_size}, + {stride_size_y, stride_size_x}, {y_in_pad, x_in_pad})); network golden_network(engine, golden_topology); golden_network.set_input_data("input", input_prim); @@ -3236,8 +3249,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_max_16x16x20x20_input_5x5_pool_3x1_stride) tested_topology.add(reorder("reorder_input", "input", layout(data_types::f32, format::bs_fs_yx_bsv16_fsv16, input_tensor))); tested_topology.add( - pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::max, {1, 1, pool_size, pool_size}, - {1, 1, stride_size_x, stride_size_y}, {0, 0, -x_in_pad, -y_in_pad})); + pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::max, {pool_size, pool_size}, + {stride_size_y, stride_size_x}, {y_in_pad, x_in_pad})); tested_topology.add(reorder("reorder_pooling", "bsv16_fsv16_pooling", layout(data_types::f32, format::bfyx, input_tensor))); build_options op; @@ -3299,8 +3312,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_max_32x32x20x20_input_5x5_pool_3x1_stride) topology golden_topology; golden_topology.add(input_layout("input", input_prim->get_layout())); golden_topology.add(reorder("reorder_input", "input", input_prim->get_layout())); - golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::max, {1, 1, pool_size, pool_size}, - {1, 1, stride_size_x, stride_size_y}, {0, 0, -x_in_pad, -y_in_pad})); + golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::max, {pool_size, pool_size}, + {stride_size_y, stride_size_x}, {y_in_pad, x_in_pad})); network golden_network(engine, golden_topology); golden_network.set_input_data("input", input_prim); @@ -3321,8 +3334,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_max_32x32x20x20_input_5x5_pool_3x1_stride) tested_topology.add(reorder("reorder_input", "input", layout(data_types::f32, format::bs_fs_yx_bsv16_fsv16, input_tensor))); tested_topology.add( - pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::max, {1, 1, pool_size, pool_size}, - {1, 1, stride_size_x, stride_size_y}, {0, 0, -x_in_pad, -y_in_pad})); + pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::max, {pool_size, pool_size}, + {stride_size_y, stride_size_x}, {y_in_pad, x_in_pad})); tested_topology.add(reorder("reorder_pooling", "bsv16_fsv16_pooling", layout(data_types::f32, format::bfyx, input_tensor))); build_options op; @@ -3388,8 +3401,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_max_32x16x20x20_input_5x5_pool_3x1_stride) topology golden_topology; golden_topology.add(input_layout("input", input_prim->get_layout())); golden_topology.add(reorder("reorder_input", "input", input_prim->get_layout())); - golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::max, {1, 1, pool_size, pool_size}, - {1, 1, stride_size_x, stride_size_y}, {0, 0, -x_in_pad, -y_in_pad})); + golden_topology.add(pooling("golden_pooling", "reorder_input", pooling_mode::max, {pool_size, pool_size}, + {stride_size_y, stride_size_x}, {y_in_pad, x_in_pad})); network golden_network(engine, golden_topology); golden_network.set_input_data("input", input_prim); @@ -3410,8 +3423,8 @@ TEST(pooling_forward_gpu, bsv16_fsv16_max_32x16x20x20_input_5x5_pool_3x1_stride) tested_topology.add(reorder("reorder_input", "input", layout(data_types::f32, format::bs_fs_yx_bsv16_fsv16, input_tensor))); tested_topology.add( - pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::max, {1, 1, pool_size, pool_size}, - {1, 1, stride_size_x, stride_size_y}, {0, 0, -x_in_pad, -y_in_pad})); + pooling("bsv16_fsv16_pooling", "reorder_input", pooling_mode::max, {pool_size, pool_size}, + {stride_size_y, stride_size_x}, {y_in_pad, x_in_pad})); tested_topology.add(reorder("reorder_pooling", "bsv16_fsv16_pooling", layout(data_types::f32, format::bfyx, input_tensor))); build_options op; @@ -3454,18 +3467,17 @@ public: all_layer_params.clear(); } - static tensor generate_pad(int x, int y, const tensor& window_size) - { - return tensor(0, 0, std::min(x, window_size.spatial[0] - 1), std::min(y, window_size.spatial[1] - 1)); + static ov::Shape generate_pad(size_t x, size_t y, const ov::Shape& window_size) { + return {std::min(y, window_size[0] - 1), std::min(x, window_size[1] - 1)}; } static std::vector> generate_specific_test_params() { std::vector pooling_modes = { pooling_mode::max, pooling_mode::average, pooling_mode::average_no_padding }; - std::vector sizes = { tensor(1, 1, 2, 2 ), tensor(1, 1, 3, 3), tensor(1, 1, 7, 4) }; + std::vector sizes = { {2, 2}, {3, 3}, {4, 7} }; - std::vector strides = { tensor(1, 1, 1, 1), tensor(1, 1, 2, 2), tensor(1, 1, 4, 3) }; + std::vector strides = { {1, 1}, {2, 2}, {3, 4} }; for (auto pooling_mode : pooling_modes) { @@ -3490,7 +3502,7 @@ public: } // This case tests the pooling_gpu_bfyx_average_opt kernel. - all_layer_params.emplace_back(new pooling("pooling", "input0", pooling_mode::average, tensor(1, 1, 3, 3), tensor(1, 1, 1, 1), generate_pad(1, 1, tensor(1, 1, 3, 3)))); + all_layer_params.emplace_back(new pooling("pooling", "input0", pooling_mode::average, {3, 3}, {1, 1}, generate_pad(1, 1, {3, 3}))); return all_layer_params; } @@ -3526,8 +3538,8 @@ public: { int k = (generic_params->data_type == data_types::f32) ? 8 : 4; auto input = inputs[0]; - auto input_size = inputs[0]->get_layout().size; - VVVVF input_rnd = generate_random_4d(input_size.batch[0], input_size.feature[0], input_size.spatial[1], input_size.spatial[0], -10, 10, k); + auto l = inputs[0]->get_layout(); + VVVVF input_rnd = generate_random_4d(l.batch(), l.feature(), l.spatial(1), l.spatial(0), -10, 10, k); VF input_rnd_vec = flatten_4d(input->get_layout().format, input_rnd); set_values(input, input_rnd_vec); } @@ -3536,22 +3548,22 @@ public: { auto pooling = std::static_pointer_cast(layer_params); - int batch = generic_params->input_layouts[0].size.batch[0]; - int feature = generic_params->input_layouts[0].size.feature[0]; - int height = generic_params->input_layouts[0].size.spatial[1]; - int width = generic_params->input_layouts[0].size.spatial[0]; + int batch = generic_params->input_layouts[0].batch(); + int feature = generic_params->input_layouts[0].feature(); + int height = generic_params->input_layouts[0].spatial(1); + int width = generic_params->input_layouts[0].spatial(0); - int pad_height = pooling->pad.spatial[1]; - int pad_width = pooling->pad.spatial[0]; + auto pad_height = pooling->pad[0]; + auto pad_width = pooling->pad[1]; - int kernel_height = pooling->size.spatial[1]; - int kernel_width = pooling->size.spatial[0]; + auto kernel_height = pooling->size[0]; + auto kernel_width = pooling->size[1]; - int stride_height = pooling->stride.spatial[1]; - int stride_width = pooling->stride.spatial[0]; + auto stride_height = pooling->stride[0]; + auto stride_width = pooling->stride[1]; - int pooled_height = (int)(ceil((float)std::max(height + 2 * pad_height - kernel_height, 0) / stride_height)) + 1; - int pooled_width = (int)(ceil((float)std::max(width + 2 * pad_width - kernel_width, 0) / stride_width)) + 1; + int pooled_height = (int)(ceil((float)std::max(height + 2 * pad_height - kernel_height, 0) / stride_height)) + 1; + int pooled_width = (int)(ceil((float)std::max(width + 2 * pad_width - kernel_width, 0) / stride_width)) + 1; // Make sure that the last pooling starts strictly inside the image. while ((pooled_height - 1) * stride_height >= height - pad_height) @@ -3570,21 +3582,21 @@ public: memory::ptr generate_reference_typed(const std::vector& inputs) { auto pooling = std::static_pointer_cast(layer_params); - int batch = inputs[0]->get_layout().size.batch[0]; - int feature = inputs[0]->get_layout().size.feature[0]; - int height = inputs[0]->get_layout().size.spatial[1]; - int width = inputs[0]->get_layout().size.spatial[0]; + int batch = inputs[0]->get_layout().batch(); + int feature = inputs[0]->get_layout().feature(); + int height = inputs[0]->get_layout().spatial(1); + int width = inputs[0]->get_layout().spatial(0); cldnn::pooling_mode pooling_mode = pooling->mode; - int pad_width = pooling->pad.spatial[0]; - int pad_height = pooling->pad.spatial[1]; + int pad_width = pooling->pad[1]; + int pad_height = pooling->pad[0]; - int kernel_width = pooling->size.spatial[0]; - int kernel_height = pooling->size.spatial[1]; + int kernel_width = pooling->size[1]; + int kernel_height = pooling->size[0]; - int stride_width = pooling->stride.spatial[0]; - int stride_height = pooling->stride.spatial[1]; + int stride_width = pooling->stride[1]; + int stride_height = pooling->stride[0]; auto output_tensor = get_expected_output_tensor(); @@ -3650,8 +3662,8 @@ public: case cldnn::pooling_mode::average: case cldnn::pooling_mode::average_no_padding: { - auto dynamic_mode = (((output_tensor.spatial[0] - 1) * stride_width) + pooling->size.spatial[0]) > -2 * pad_width + width || - (((output_tensor.spatial[1] - 1) * stride_height) + pooling->size.spatial[1]) > -2 * pad_width + height; + auto dynamic_mode = (((output_tensor.spatial[0] - 1) * stride_width) + pooling->size[1]) > -2 * pad_width + width || + (((output_tensor.spatial[1] - 1) * stride_height) + pooling->size[0]) > -2 * pad_width + height; auto divider = [=](int actual_x, int actual_y) { auto x = kernel_width; @@ -3789,7 +3801,7 @@ TEST(pooling_forward_gpu_onednn, basic_max_pooling_int8) { input, // 2. reorder primitive with id "reorder_input" reorder("reorder_input", input, byte_layout), - pooling("pool1", "reorder_input", pooling_mode::max, { 1, 1, 3, 3 }, {1, 1, 1, 1}), + pooling("pool1", "reorder_input", pooling_mode::max, { 3, 3 }, {1, 1, 1, 1}), reorder("reorder2", "pool1", out_layout) ); diff --git a/src/plugins/intel_gpu/tests/test_cases/removing_output_node_test.cpp b/src/plugins/intel_gpu/tests/test_cases/removing_output_node_test.cpp index adbc1dfd742..af334c853a2 100644 --- a/src/plugins/intel_gpu/tests/test_cases/removing_output_node_test.cpp +++ b/src/plugins/intel_gpu/tests/test_cases/removing_output_node_test.cpp @@ -122,7 +122,7 @@ TEST(removing_output_node, output_node_optimization) { topology topology; topology.add(input_layout("input", input->get_layout())); topology.add(data("weights", weights)); - topology.add(convolution("conv", "input", { "weights" }, { 1,1,1,2 })); + topology.add(convolution("conv", "input", { "weights" }, { 2, 1 })); topology.add(activation("relu", "conv", activation_func::relu)); network network(engine, topology); @@ -137,10 +137,10 @@ TEST(removing_output_node, output_node_optimization) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::yxfb); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); diff --git a/src/plugins/intel_gpu/tests/test_cases/reorder_gpu_test.cpp b/src/plugins/intel_gpu/tests/test_cases/reorder_gpu_test.cpp index da18d2709b4..f89f77e1b9d 100644 --- a/src/plugins/intel_gpu/tests/test_cases/reorder_gpu_test.cpp +++ b/src/plugins/intel_gpu/tests/test_cases/reorder_gpu_test.cpp @@ -1150,12 +1150,12 @@ TEST(reorder_gpu_f32, basic_bfyx_to_bfzyx) auto output = outputs.begin()->second.get_memory(); EXPECT_TRUE(output->get_layout().format == format::bfzyx); - auto sizes = output->get_layout().size; - EXPECT_TRUE(sizes.batch[0] == 2); - EXPECT_TRUE(sizes.feature[0] == 2); - EXPECT_TRUE(sizes.spatial[0] == 2); - EXPECT_TRUE(sizes.spatial[1] == 2); - EXPECT_TRUE(sizes.spatial[2] == 1); + auto l = output->get_layout(); + EXPECT_TRUE(l.batch() == 2); + EXPECT_TRUE(l.feature() == 2); + EXPECT_TRUE(l.spatial(0) == 2); + EXPECT_TRUE(l.spatial(1) == 2); + EXPECT_TRUE(l.spatial(2) == 1); float answers[16] = { 1.f, 0.f, @@ -1214,12 +1214,12 @@ TEST(reorder_gpu_f32, basic_yxfb_to_bfzyx) auto output = outputs.begin()->second.get_memory(); EXPECT_TRUE(output->get_layout().format == format::bfzyx); - auto sizes = output->get_layout().size; - EXPECT_TRUE(sizes.batch[0] == 2); - EXPECT_TRUE(sizes.feature[0] == 2); - EXPECT_TRUE(sizes.spatial[0] == 2); - EXPECT_TRUE(sizes.spatial[1] == 2); - EXPECT_TRUE(sizes.spatial[2] == 1); + auto l = output->get_layout(); + EXPECT_TRUE(l.batch() == 2); + EXPECT_TRUE(l.feature() == 2); + EXPECT_TRUE(l.spatial(0) == 2); + EXPECT_TRUE(l.spatial(1) == 2); + EXPECT_TRUE(l.spatial(2) == 1); float answers[16] = { 1.0f, 2.0f, @@ -1290,12 +1290,12 @@ TEST(reorder_gpu_f32, basic_bfzyx_to_bfyx) auto output = outputs.begin()->second.get_memory(); EXPECT_TRUE(output->get_layout().format == format::bfyx); - auto sizes = output->get_layout().size; - EXPECT_TRUE(sizes.batch[0] == 2); - EXPECT_TRUE(sizes.feature[0] == 2); - EXPECT_TRUE(sizes.spatial[0] == 2); - EXPECT_TRUE(sizes.spatial[1] == 4); - EXPECT_TRUE(sizes.spatial[2] == 1); + auto l = output->get_layout(); + EXPECT_TRUE(l.batch() == 2); + EXPECT_TRUE(l.feature() == 2); + EXPECT_TRUE(l.spatial(0) == 2); + EXPECT_TRUE(l.spatial(1) == 4); + EXPECT_TRUE(l.spatial(2) == 1); float answers[32] = { 1.f, 0.f, @@ -1832,13 +1832,12 @@ TEST(reorder_gpu_f32, bfwzyx_bfyx_chain) auto output = outputs.begin()->second.get_memory(); EXPECT_TRUE(output->get_layout().format == format::bfwzyx); - auto sizes = output->get_layout().size; - EXPECT_EQ(sizes.batch[0], 1); - EXPECT_EQ(sizes.feature[0], 4); - EXPECT_EQ(sizes.spatial[0], 2); - EXPECT_EQ(sizes.spatial[1], 2); - EXPECT_EQ(sizes.spatial[2], 1); - EXPECT_EQ(sizes.spatial[2], 1); + auto l = output->get_layout(); + EXPECT_EQ(l.batch(), 1); + EXPECT_EQ(l.feature(), 4); + EXPECT_EQ(l.spatial(0), 2); + EXPECT_EQ(l.spatial(1), 2); + EXPECT_EQ(l.spatial(2), 1); cldnn::mem_lock output_ptr(output, get_test_stream()); ASSERT_EQ(output_ptr.size(), expected.size()); @@ -2069,7 +2068,7 @@ TEST(reorder_gpu_f32, b_fs_yx_fsv16_to_bfyx_opt_not_allowed) input_layout("input", input->get_layout()), data("weights", weights), reorder(reorder_name, "input", format::bfyx, data_types::f32), - convolution("convolution", reorder_name, {"weights"}, { 1, 1, 1, 1 }, { 0, 0, -1, -1 }, { 1, 1, 1, 1 })); + convolution("convolution", reorder_name, {"weights"}, { 1, 1 }, { 1, 1 }, { 1, 1 })); build_options bo; bo.set_option(build_option::optimize_data(true)); @@ -2404,8 +2403,8 @@ struct reorder_test_param { tensor in_shape; tensor out_shape; tensor kernel; - tensor stride; - tensor pad; + ov::Strides stride; + ov::CoordinateDiff pad; data_types data_type; format input_format; data_types weights_type; @@ -2478,7 +2477,7 @@ public: layout get_input_layout(T& p) { auto pad = p.pad; - std::vector pad_ = { 0, 0, pad.spatial[0], pad.spatial[1] }; + std::vector pad_ = { 0, 0, static_cast(pad[1]), static_cast(pad[0]) }; return layout{ p.data_type, p.input_format, p.in_shape, padding{pad_} }; } @@ -2527,7 +2526,7 @@ TEST_P(testing_removal_reorder, only_remove_reorder_shallow_depth_input) { data("bias", get_mem(get_bias_layout(p))), data("weights_sec", get_mem(get_weights_layout(p))), reorder("reorder_fp32", "input", format::bfyx, data_types::f32), - convolution("conv_prim", "reorder_fp32", { "weights" }, { "bias" }, 1, p.stride, p.pad, tensor{1}, p.in_shape, data_types::u8, false), + convolution("conv_prim", "reorder_fp32", { "weights" }, { "bias" }, 1, p.stride, p.pad, {1, 1}, p.in_shape, data_types::u8, false), reorder("reorder_conv", "conv_prim", reorder_layout), convolution("conv_output", "reorder_conv", { "weights_sec" }, 1, p.stride, p.pad), reorder("reorder_bfyx", "conv_output", format::b_fs_yx_fsv32, data_types::f32), @@ -2604,7 +2603,7 @@ TEST_P(testing_removal_reorder, removal_padded_reorder) { INSTANTIATE_TEST_SUITE_P(reorder_gpu_testing, testing_removal_reorder, ::testing::ValuesIn(std::vector{ - reorder_test_param{{1, 32, 4, 4}, {1, 32, 8, 8}, {1, 1, 1, 1}, tensor{1}, tensor{0}, + reorder_test_param{{1, 32, 4, 4}, {1, 32, 8, 8}, {1, 1, 1, 1}, {1, 1}, {0, 0}, data_types::f16, format::bfyx, data_types::f16, format::goiyx, data_types::f16, format::b_fs_yx_fsv16}, })); diff --git a/src/plugins/intel_gpu/tests/test_cases/streams_test.cpp b/src/plugins/intel_gpu/tests/test_cases/streams_test.cpp index 9195a345c9d..6b4830005a9 100644 --- a/src/plugins/intel_gpu/tests/test_cases/streams_test.cpp +++ b/src/plugins/intel_gpu/tests/test_cases/streams_test.cpp @@ -40,10 +40,10 @@ TEST(gpu_streams, can_create_networks_for_stream) { auto output_layout = output_memory->get_layout(); cldnn::mem_lock output_ptr(output_memory, get_test_stream()); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::yxfb); EXPECT_EQ(y_size, 4); EXPECT_EQ(x_size, 5); @@ -69,7 +69,7 @@ TEST(gpu_streams, check_networks_can_use_the_same_weights) { topology topology( input_layout("input", input0_layout), data("weights", weights), - convolution("conv", "input", { "weights" }, { 1,1,1,2 })); + convolution("conv", "input", { "weights" }, { 2, 1 })); set_values(weights, { 1.0f, 2.0f, 1.0f, 2.0f, 1.0f, 2.0f }); auto prog = program::build_program(engine, topology, build_options()); @@ -102,10 +102,10 @@ TEST(gpu_streams, check_networks_can_use_the_same_weights) { ASSERT_EQ(wmem0, wmem1); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::yxfb); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); @@ -133,7 +133,7 @@ TEST(gpu_streams, check_networks_use_unique_mutable_data_per_stream) { topology topology( input_layout("input", input0_layout), mutable_data("weights", weights), - convolution("conv", "input", { "weights" }, { 1,1,1,2 })); + convolution("conv", "input", { "weights" }, { 2, 1 })); set_values(weights, { 1.0f, 2.0f, 1.0f, 2.0f, 1.0f, 2.0f }); auto prog = program::build_program(engine, topology, build_options()); @@ -170,10 +170,10 @@ TEST(gpu_streams, check_networks_use_unique_mutable_data_per_stream) { // check that initial memory is reused by the primary stream ASSERT_EQ(wmem0, weights); - int y_size = output_layout.size.spatial[1]; - int x_size = output_layout.size.spatial[0]; - int f_size = output_layout.size.feature[0]; - int b_size = output_layout.size.batch[0]; + int y_size = output_layout.spatial(1); + int x_size = output_layout.spatial(0); + int f_size = output_layout.feature(); + int b_size = output_layout.batch(); EXPECT_EQ(output_layout.format, format::bfyx); EXPECT_EQ(y_size, 2); EXPECT_EQ(x_size, 3); diff --git a/src/plugins/intel_gpu/tests/test_cases/topology_test.cpp b/src/plugins/intel_gpu/tests/test_cases/topology_test.cpp index 90c8c921a3d..41f499ca891 100644 --- a/src/plugins/intel_gpu/tests/test_cases/topology_test.cpp +++ b/src/plugins/intel_gpu/tests/test_cases/topology_test.cpp @@ -140,11 +140,11 @@ protected: // todo: randomize params cldnn::primitive_id weights_id = id + "_weights"; cldnn::layout weights_layout(output_layout.data_type, - cldnn::format::yxfb,{ output_layout.size.feature[0], output_layout.size.feature[0], 1, 1 }); + cldnn::format::yxfb,{ output_layout.feature(), output_layout.feature(), 1, 1 }); AddRandomMemory(topology, weights_id, weights_layout); cldnn::primitive_id bias_id = id + "_bias"; cldnn::layout bias_layout(output_layout.data_type, - cldnn::format::bfyx,{ 1, 1, output_layout.size.feature[0], 1 }); + cldnn::format::bfyx,{ 1, 1, output_layout.feature(), 1 }); AddRandomMemory(topology, bias_id, bias_layout); cldnn::primitive_id input_id = topology_generator::CreateLayerId(); @@ -187,10 +187,8 @@ protected: // todo: randomize params cldnn::primitive_id input_id = topology_generator::CreateLayerId(); cldnn::pooling_mode mode = cldnn::pooling_mode::max; - cldnn::tensor stride = { 1, 1, 1, 1 }; - cldnn::tensor size = { 1, 1, 3, 3 }; input_layouts.push_back({ input_id, output_layout }); - topology.add(cldnn::pooling(id, input_id, mode, stride, size)); + topology.add(cldnn::pooling(id, input_id, mode, {3, 3}, {1, 1})); return true; } }; @@ -206,14 +204,14 @@ protected: // for now using just one set of params // todo: randomize params - cldnn::layout input_layout(output_layout.data_type, cldnn::format::bfyx,{ output_layout.size.batch[0] , output_layout.size.feature[0], 100, 100 } ); + cldnn::layout input_layout(output_layout.data_type, cldnn::format::bfyx,{ output_layout.batch() , output_layout.feature(), 100, 100 } ); cldnn::primitive_id weights_id = id + "_weights"; cldnn::layout weights_layout(output_layout.data_type, - cldnn::format::bfyx,{ output_layout.size.feature[0], input_layout.size.feature[0], input_layout.size.spatial[0], input_layout.size.spatial[1] }); + cldnn::format::bfyx,{ output_layout.feature(), input_layout.feature(), input_layout.spatial(0), input_layout.spatial(1) }); AddRandomMemory(topology, weights_id, weights_layout); cldnn::primitive_id bias_id = id + "_bias"; cldnn::layout bias_layout(output_layout.data_type, - cldnn::format::bfyx,{ 1, 1, output_layout.size.feature[0], 1 }); + cldnn::format::bfyx,{ 1, 1, output_layout.feature(), 1 }); AddRandomMemory(topology, bias_id, bias_layout); cldnn::primitive_id input_id = topology_generator::CreateLayerId(); @@ -254,7 +252,7 @@ protected: // for now using just one set of params // todo: randomize params if (output_layout.format != cldnn::format::bfyx// should be "output_layout.size.format.dimension() < 4" but requires too many case handling since tensor is immutable - || output_layout.size.feature[0] < 2) + || output_layout.feature() < 2) { return false; } @@ -264,20 +262,20 @@ protected: output_layout.data_type, cldnn::format::bfyx, { - output_layout.size.batch[0], - output_layout.size.feature[0] - 1, - output_layout.size.spatial[0], - output_layout.size.spatial[1] + output_layout.batch(), + output_layout.feature() - 1, + output_layout.spatial(0), + output_layout.spatial(1) } ); cldnn::layout input_layout2( output_layout.data_type, cldnn::format::bfyx, { - output_layout.size.batch[0], + output_layout.batch(), 1, - output_layout.size.spatial[0], - output_layout.size.spatial[1] + output_layout.spatial(0), + output_layout.spatial(1) } ); input_layouts.push_back({ input_id1, input_layout1 }); diff --git a/src/plugins/intel_gpu/tests/test_utils/test_utils.h b/src/plugins/intel_gpu/tests/test_utils/test_utils.h index 4160d419d73..ddf2001cfcc 100644 --- a/src/plugins/intel_gpu/tests/test_utils/test_utils.h +++ b/src/plugins/intel_gpu/tests/test_utils/test_utils.h @@ -525,9 +525,9 @@ inline void PrintTupleTo(const std::tuple, std::sha str << "Norm region: " << norm_region << " Epsilon: " << normalize->epsilon << " Scale input id: " << normalize->scale_input; } else if (primitive->type == cldnn::convolution::type_id()) { auto convolution = std::static_pointer_cast(primitive); - str << "Stride x: " << convolution->stride.spatial[0] << " Stride y: " << convolution->stride.spatial[1] - << " Dilation x: " << convolution->dilation.spatial[0] << " Dilation y: " << convolution->dilation.spatial[1] - << " Pad x: " << convolution->pad.spatial[0] << " Pad y: " << convolution->pad.spatial[1]; + str << "Stride x: " << convolution->stride[1] << " Stride y: " << convolution->stride[0] + << " Dilation x: " << convolution->dilation[1] << " Dilation y: " << convolution->dilation[0] + << " Pad x: " << convolution->pad[1] << " Pad y: " << convolution->pad[0]; } else if (primitive->type == cldnn::activation::type_id()) { auto activation = std::static_pointer_cast(primitive); str << "Negative slope: " << activation->additional_params.a << " Negative slope input id: " << activation->additional_params_input; @@ -535,9 +535,9 @@ inline void PrintTupleTo(const std::tuple, std::sha auto pooling = std::static_pointer_cast(primitive); std::string pooling_mode = (pooling->mode == cldnn::pooling_mode::max) ? "max" : "average"; str << "Pooling mode: " << pooling_mode - << " Pad x: " << pooling->pad.spatial[0] << " Pad y: " << pooling->pad.spatial[1] - << " Stride x: " << pooling->stride.spatial[0] << " Stride y: " << pooling->stride.spatial[1] - << " Size x: " << pooling->size.spatial[0] << " Size y: " << pooling->size.spatial[1]; + << " Pad x: " << pooling->pad[1] << " Pad y: " << pooling->pad[0] + << " Stride x: " << pooling->stride[1] << " Stride y: " << pooling->stride[0] + << " Size x: " << pooling->size[1] << " Size y: " << pooling->size[0]; } else { throw std::runtime_error("Not implemented yet for this primitive."); }