[GPU] Gather params update (#11369)
This commit is contained in:
parent
3c724a1dee
commit
1cb254307e
@ -6,6 +6,8 @@
|
||||
#pragma once
|
||||
#include "primitive.hpp"
|
||||
|
||||
#include "openvino/core/shape.hpp"
|
||||
|
||||
namespace cldnn {
|
||||
/// @addtogroup cpp_api C++ API
|
||||
/// @{
|
||||
@ -19,15 +21,6 @@ namespace cldnn {
|
||||
struct gather : public primitive_base<gather> {
|
||||
CLDNN_DECLARE_PRIMITIVE(gather)
|
||||
|
||||
enum gather_axis {
|
||||
along_b,
|
||||
along_f,
|
||||
along_x,
|
||||
along_y,
|
||||
along_z,
|
||||
along_w
|
||||
};
|
||||
|
||||
/// @brief Constructs gather primitive.
|
||||
/// @param id This primitive id.
|
||||
/// @param dict Input dictionary primitive id.
|
||||
@ -39,23 +32,22 @@ struct gather : public primitive_base<gather> {
|
||||
gather(const primitive_id& id,
|
||||
const primitive_id& dict,
|
||||
const primitive_id& idx,
|
||||
const gather_axis axis,
|
||||
const format& output_format,
|
||||
const tensor& output_shape,
|
||||
const int64_t axis,
|
||||
const ov::Shape& output_shape,
|
||||
const int64_t batch_dim = 0,
|
||||
const bool support_neg_ind = false,
|
||||
const primitive_id& ext_prim_id = "",
|
||||
const padding& output_padding = padding()
|
||||
)
|
||||
: primitive_base(id, {dict, idx}, ext_prim_id, output_padding), axis(axis), output_format(output_format),
|
||||
output_shape(output_shape), batch_dim(batch_dim), support_neg_ind(support_neg_ind) {}
|
||||
const padding& output_padding = padding())
|
||||
: primitive_base(id, {dict, idx}, ext_prim_id, output_padding)
|
||||
, axis(axis)
|
||||
, output_shape(output_shape)
|
||||
, batch_dim(batch_dim)
|
||||
, support_neg_ind(support_neg_ind) {}
|
||||
|
||||
/// @brief Gathering axis
|
||||
gather_axis axis;
|
||||
/// @brief Gather output format
|
||||
format output_format;
|
||||
int64_t axis;
|
||||
/// @brief Gather output shape
|
||||
tensor output_shape;
|
||||
ov::Shape output_shape;
|
||||
/// @brief Gathering batch_dim
|
||||
int64_t batch_dim;
|
||||
/// @brief Support negative indexes
|
||||
|
@ -19,15 +19,19 @@ layout gather_inst::calc_output_layout(gather_node const& node) {
|
||||
auto desc = node.get_primitive();
|
||||
|
||||
auto input_layout = node.input(0).get_output_layout();
|
||||
auto output_format = desc->output_format;
|
||||
auto output_shape = desc->output_shape;
|
||||
std::vector<tensor::value_type> dims_converted(desc->output_shape.begin(), desc->output_shape.end());
|
||||
// extend shape to 4d
|
||||
for (size_t i = dims_converted.size(); i < 4; i++) {
|
||||
dims_converted.push_back(1);
|
||||
}
|
||||
auto output_format = format::get_default_format(dims_converted.size());
|
||||
|
||||
auto output_type = input_layout.data_type;
|
||||
if (node.has_fused_primitives()) {
|
||||
output_type = node.get_fused_output_layout().data_type;
|
||||
}
|
||||
|
||||
return layout{output_type, output_format, output_shape};
|
||||
return layout{output_type, output_format, tensor(output_format, dims_converted)};
|
||||
}
|
||||
|
||||
std::string gather_inst::to_string(gather_node const& node) {
|
||||
@ -41,7 +45,7 @@ std::string gather_inst::to_string(gather_node const& node) {
|
||||
gather_info.add("input id", input.id());
|
||||
gather_info.add("axis", desc->axis);
|
||||
gather_info.add("batch_dim", desc->batch_dim);
|
||||
gather_info.add("output shape", desc->output_shape.to_string());
|
||||
gather_info.add("output shape", cldnn::to_string(desc->output_shape));
|
||||
|
||||
node_info->add("gather info", gather_info);
|
||||
node_info->dump(primitive_description);
|
||||
|
@ -14,22 +14,48 @@ using namespace cldnn;
|
||||
|
||||
namespace cldnn {
|
||||
namespace ocl {
|
||||
kernel_selector::gather_axis convert_axis(gather::gather_axis axis) {
|
||||
switch (axis) {
|
||||
case gather::along_x:
|
||||
return kernel_selector::gather_axis::X;
|
||||
case gather::along_y:
|
||||
return kernel_selector::gather_axis::Y;
|
||||
case gather::along_z:
|
||||
return kernel_selector::gather_axis::Z;
|
||||
case gather::along_w:
|
||||
return kernel_selector::gather_axis::W;
|
||||
case gather::along_f:
|
||||
return kernel_selector::gather_axis::FEATURE;
|
||||
case gather::along_b:
|
||||
return kernel_selector::gather_axis::BATCH;
|
||||
default:
|
||||
return kernel_selector::gather_axis::X;
|
||||
static kernel_selector::gather_axis convert_axis(int64_t axis, size_t rank) {
|
||||
if (axis == 0) {
|
||||
return kernel_selector::gather_axis::BATCH;
|
||||
} else if (axis == 1) {
|
||||
return kernel_selector::gather_axis::FEATURE;
|
||||
}
|
||||
|
||||
if (rank <= 4) {
|
||||
switch (axis) {
|
||||
case 2: return kernel_selector::gather_axis::Y;
|
||||
case 3: return kernel_selector::gather_axis::X;
|
||||
case -1: return kernel_selector::gather_axis::Y;
|
||||
case -2: return kernel_selector::gather_axis::FEATURE;
|
||||
case -3: return kernel_selector::gather_axis::BATCH;
|
||||
default: IE_THROW() << "Unsupported gather axis: " << axis;
|
||||
}
|
||||
} else if (rank == 5) {
|
||||
switch (axis) {
|
||||
case 2: return kernel_selector::gather_axis::Z;
|
||||
case 3: return kernel_selector::gather_axis::Y;
|
||||
case 4: return kernel_selector::gather_axis::X;
|
||||
case -1: return kernel_selector::gather_axis::Y;
|
||||
case -2: return kernel_selector::gather_axis::Z;
|
||||
case -3: return kernel_selector::gather_axis::FEATURE;
|
||||
case -4: return kernel_selector::gather_axis::BATCH;
|
||||
default: IE_THROW() << "Unsupported gather axis: " << axis;
|
||||
}
|
||||
} else if (rank == 6) {
|
||||
switch (axis) {
|
||||
case 2: return kernel_selector::gather_axis::W;
|
||||
case 3: return kernel_selector::gather_axis::Z;
|
||||
case 4: return kernel_selector::gather_axis::Y;
|
||||
case 5: return kernel_selector::gather_axis::X;
|
||||
case -1: return kernel_selector::gather_axis::Y;
|
||||
case -2: return kernel_selector::gather_axis::Z;
|
||||
case -3: return kernel_selector::gather_axis::W;
|
||||
case -4: return kernel_selector::gather_axis::FEATURE;
|
||||
case -5: return kernel_selector::gather_axis::BATCH;
|
||||
default: IE_THROW() << "Unsupported gather axis: " << axis;
|
||||
}
|
||||
} else {
|
||||
IE_THROW() << "Unsupported gather axis: " << axis;
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,7 +73,8 @@ public:
|
||||
auto gather_optional_params =
|
||||
get_default_optional_params<kernel_selector::gather_optional_params>(arg.get_program());
|
||||
|
||||
gather_params.axis = convert_axis(arg.get_primitive()->axis);
|
||||
auto input_layout = arg.get_dependency(0).get_output_layout();
|
||||
gather_params.axis = convert_axis(arg.get_primitive()->axis, input_layout.get_rank());
|
||||
gather_params.batch_dim = size_t(arg.get_primitive()->batch_dim);
|
||||
gather_params.support_neg_ind = arg.get_primitive()->support_neg_ind;
|
||||
|
||||
|
@ -14,57 +14,12 @@ namespace ov {
|
||||
namespace runtime {
|
||||
namespace intel_gpu {
|
||||
|
||||
static cldnn::gather::gather_axis GetGatherAxis(int32_t axis, cldnn::format inputFormat) {
|
||||
if (axis == 0) {
|
||||
return cldnn::gather::gather_axis::along_b;
|
||||
} else if (axis == 1) {
|
||||
return cldnn::gather::gather_axis::along_f;
|
||||
}
|
||||
|
||||
if (inputFormat == cldnn::format::bfyx) {
|
||||
switch (axis) {
|
||||
case 2: return cldnn::gather::gather_axis::along_y;
|
||||
case 3: return cldnn::gather::gather_axis::along_x;
|
||||
case -1: return cldnn::gather::gather_axis::along_y;
|
||||
case -2: return cldnn::gather::gather_axis::along_f;
|
||||
case -3: return cldnn::gather::gather_axis::along_b;
|
||||
default: IE_THROW() << "Unsupported gather axis: " << axis;
|
||||
}
|
||||
} else if (inputFormat == cldnn::format::bfzyx) {
|
||||
switch (axis) {
|
||||
case 2: return cldnn::gather::gather_axis::along_z;
|
||||
case 3: return cldnn::gather::gather_axis::along_y;
|
||||
case 4: return cldnn::gather::gather_axis::along_x;
|
||||
case -1: return cldnn::gather::gather_axis::along_y;
|
||||
case -2: return cldnn::gather::gather_axis::along_z;
|
||||
case -3: return cldnn::gather::gather_axis::along_f;
|
||||
case -4: return cldnn::gather::gather_axis::along_b;
|
||||
default: IE_THROW() << "Unsupported gather axis: " << axis;
|
||||
}
|
||||
} else if (inputFormat == cldnn::format::bfwzyx) {
|
||||
switch (axis) {
|
||||
case 2: return cldnn::gather::gather_axis::along_w;
|
||||
case 3: return cldnn::gather::gather_axis::along_z;
|
||||
case 4: return cldnn::gather::gather_axis::along_y;
|
||||
case 5: return cldnn::gather::gather_axis::along_x;
|
||||
case -1: return cldnn::gather::gather_axis::along_y;
|
||||
case -2: return cldnn::gather::gather_axis::along_z;
|
||||
case -3: return cldnn::gather::gather_axis::along_w;
|
||||
case -4: return cldnn::gather::gather_axis::along_f;
|
||||
case -5: return cldnn::gather::gather_axis::along_b;
|
||||
default: IE_THROW() << "Unsupported gather axis: " << axis;
|
||||
}
|
||||
} else {
|
||||
IE_THROW() << "Unsupported gather axis: " << axis;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void CreateGatherOpBase(Program& p, const std::shared_ptr<T>& op, const int64_t batch_dim = 0, bool support_neg_ind = false) {
|
||||
auto inputPrimitives = p.GetInputPrimitiveIDs(op);
|
||||
std::string layerName = layer_type_name_ID(op);
|
||||
|
||||
int32_t axis = static_cast<int32_t>(op->get_axis());
|
||||
int64_t axis = op->get_axis();
|
||||
|
||||
std::vector<cldnn::primitive_id> reorderedInputs;
|
||||
reorderedInputs.resize(inputPrimitives.size());
|
||||
@ -91,13 +46,11 @@ void CreateGatherOpBase(Program& p, const std::shared_ptr<T>& op, const int64_t
|
||||
}
|
||||
}
|
||||
|
||||
auto outLayout = DefaultFormatForDims(op->get_output_shape(0).size());
|
||||
auto gatherPrim = cldnn::gather(layerName,
|
||||
reorderedInputs[0],
|
||||
reorderedInputs[1],
|
||||
GetGatherAxis(axis, DefaultFormatForDims(op->get_input_shape(0).size())),
|
||||
outLayout,
|
||||
tensor_from_dims(op->get_output_shape(0)),
|
||||
axis,
|
||||
op->get_output_shape(0),
|
||||
batch_dim,
|
||||
support_neg_ind,
|
||||
op->get_friendly_name());
|
||||
|
@ -20,9 +20,8 @@ namespace {
|
||||
struct gather_test_params {
|
||||
tensor dictionary_shape;
|
||||
tensor indices_shape;
|
||||
tensor out_shape;
|
||||
format out_format;
|
||||
cldnn::gather::gather_axis axis;
|
||||
ov::Shape out_shape;
|
||||
int64_t axis;
|
||||
data_types data_type;
|
||||
format input_format;
|
||||
data_types default_type;
|
||||
@ -52,26 +51,12 @@ public:
|
||||
}
|
||||
|
||||
size_t get_axis_dim(gather_test_params& p) {
|
||||
switch (p.axis) {
|
||||
case cldnn::gather::gather_axis::along_x:
|
||||
return p.dictionary_shape.spatial[0];
|
||||
case cldnn::gather::gather_axis::along_y:
|
||||
return p.dictionary_shape.spatial[1];
|
||||
case cldnn::gather::gather_axis::along_z:
|
||||
return p.dictionary_shape.spatial[2];
|
||||
case cldnn::gather::gather_axis::along_w:
|
||||
return p.dictionary_shape.spatial[3];
|
||||
case cldnn::gather::gather_axis::along_f:
|
||||
return p.dictionary_shape.feature[0];
|
||||
case cldnn::gather::gather_axis::along_b:
|
||||
return p.dictionary_shape.batch[0];
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
auto in_layout = get_input_layout(p);
|
||||
return in_layout.get_dims()[p.axis];
|
||||
}
|
||||
|
||||
layout get_per_channel_layout(gather_test_params& p) {
|
||||
return layout{ p.default_type, p.default_format, tensor{ 1, p.out_shape.feature[0], 1, 1 } };
|
||||
return layout{ p.default_type, p.default_format, tensor{ 1, static_cast<tensor::value_type>(p.out_shape[1]), 1, 1 } };
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
@ -80,29 +65,29 @@ public:
|
||||
/* ------------------------------------------ Gather cases --------------------------------------------- */
|
||||
/* ----------------------------------------------------------------------------------------------------- */
|
||||
|
||||
#define CASE_GATHER_FP32_1 { 2, 3, 1, 4 }, { 4, 1, 1, 1 }, { 4, 3, 1, 4 }, format::bfyx, cldnn::gather::gather_axis::along_b, data_types::f32, format::bfyx, data_types::f32, format::bfyx
|
||||
#define CASE_GATHER_FP32_2 { 3, 2, 1, 2 }, { 2, 3, 1, 1 }, { 2, 3, 2, 2 }, format::bfyx, cldnn::gather::gather_axis::along_b, data_types::f32, format::bfyx, data_types::f32, format::bfyx
|
||||
#define CASE_GATHER_FP32_3 { 3, 1, 1, 2 }, { 2, 1, 1, 1 }, { 3, 2, 1, 2 }, format::bfyx, cldnn::gather::gather_axis::along_f, data_types::f32, format::bfyx, data_types::f32, format::bfyx
|
||||
#define CASE_GATHER_FP32_4 { 5, 3, 2, 2 }, { 3, 1, 1, 1 }, { 5, 2, 2, 3 }, format::bfyx, cldnn::gather::gather_axis::along_y, data_types::f32, format::bfyx, data_types::f32, format::bfyx
|
||||
#define CASE_GATHER_FP32_5 { 2, 3, 1, 2 }, { 1, 3, 1, 1 }, { 2, 3, 3, 1 }, format::bfyx, cldnn::gather::gather_axis::along_y, data_types::f32, format::bfyx, data_types::f32, format::bfyx
|
||||
#define CASE_GATHER_FP32_1 { 2, 3, 1, 4 }, { 4, 1, 1, 1 }, { 4, 3, 4, 1 }, 0, data_types::f32, format::bfyx, data_types::f32, format::bfyx
|
||||
#define CASE_GATHER_FP32_2 { 3, 2, 1, 2 }, { 2, 3, 1, 1 }, { 2, 3, 2, 2 }, 0, data_types::f32, format::bfyx, data_types::f32, format::bfyx
|
||||
#define CASE_GATHER_FP32_3 { 3, 1, 1, 2 }, { 2, 1, 1, 1 }, { 3, 2, 2, 1 }, 1, data_types::f32, format::bfyx, data_types::f32, format::bfyx
|
||||
#define CASE_GATHER_FP32_4 { 5, 3, 2, 2 }, { 3, 1, 1, 1 }, { 5, 2, 3, 2 }, 2, data_types::f32, format::bfyx, data_types::f32, format::bfyx
|
||||
#define CASE_GATHER_FP32_5 { 2, 3, 1, 2 }, { 1, 3, 1, 1 }, { 2, 3, 1, 3 }, 2, data_types::f32, format::bfyx, data_types::f32, format::bfyx
|
||||
|
||||
#define CASE_GATHER_FP16_1 { 2, 3, 1, 4 }, { 4, 1, 1, 1 }, { 4, 3, 1, 4 }, format::bfyx, cldnn::gather::gather_axis::along_b, data_types::f16, format::bfyx, data_types::f16, format::bfyx
|
||||
#define CASE_GATHER_FP16_2 { 3, 2, 1, 2 }, { 2, 3, 1, 1 }, { 2, 3, 2, 2 }, format::bfyx, cldnn::gather::gather_axis::along_b, data_types::f16, format::bfyx, data_types::f16, format::bfyx
|
||||
#define CASE_GATHER_FP16_3 { 3, 1, 1, 2 }, { 2, 1, 1, 1 }, { 3, 2, 1, 2 }, format::bfyx, cldnn::gather::gather_axis::along_f, data_types::f16, format::bfyx, data_types::f16, format::bfyx
|
||||
#define CASE_GATHER_FP16_4 { 5, 3, 2, 2 }, { 3, 1, 1, 1 }, { 5, 2, 2, 3 }, format::bfyx, cldnn::gather::gather_axis::along_y, data_types::f16, format::bfyx, data_types::f16, format::bfyx
|
||||
#define CASE_GATHER_FP16_5 { 2, 3, 1, 2 }, { 1, 3, 1, 1 }, { 2, 3, 3, 1 }, format::bfyx, cldnn::gather::gather_axis::along_y, data_types::f16, format::bfyx, data_types::f16, format::bfyx
|
||||
#define CASE_GATHER_FP16_1 { 2, 3, 1, 4 }, { 4, 1, 1, 1 }, { 4, 3, 4, 1 }, 0, data_types::f16, format::bfyx, data_types::f16, format::bfyx
|
||||
#define CASE_GATHER_FP16_2 { 3, 2, 1, 2 }, { 2, 3, 1, 1 }, { 2, 3, 2, 2 }, 0, data_types::f16, format::bfyx, data_types::f16, format::bfyx
|
||||
#define CASE_GATHER_FP16_3 { 3, 1, 1, 2 }, { 2, 1, 1, 1 }, { 3, 2, 2, 1 }, 1, data_types::f16, format::bfyx, data_types::f16, format::bfyx
|
||||
#define CASE_GATHER_FP16_4 { 5, 3, 2, 2 }, { 3, 1, 1, 1 }, { 5, 2, 3, 2 }, 2, data_types::f16, format::bfyx, data_types::f16, format::bfyx
|
||||
#define CASE_GATHER_FP16_5 { 2, 3, 1, 2 }, { 1, 3, 1, 1 }, { 2, 3, 1, 3 }, 2, data_types::f16, format::bfyx, data_types::f16, format::bfyx
|
||||
|
||||
#define CASE_GATHER_5D_FP32_1 { 2, 3, 1, 4, 1 }, { 4, 1, 1, 1 }, { 4, 3, 1, 4, 1 }, format::bfzyx, cldnn::gather::gather_axis::along_b, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP32_2 { 2, 3, 2, 2, 2 }, { 2, 1, 1, 1 }, { 2, 2, 2, 2, 2 }, format::bfzyx, cldnn::gather::gather_axis::along_f, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP32_3 { 5, 3, 2, 2, 2 }, { 3, 1, 1, 1 }, { 5, 3, 2, 3, 2 }, format::bfzyx, cldnn::gather::gather_axis::along_y, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP32_4 { 2, 3, 1, 4, 4 }, { 2, 1, 1, 1 }, { 2, 3, 1, 4, 2 }, format::bfzyx, cldnn::gather::gather_axis::along_z, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP32_5 { 3, 1, 5, 2, 1 }, { 2, 1, 1, 1 }, { 3, 1, 2, 2, 1 }, format::bfzyx, cldnn::gather::gather_axis::along_x, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP32_1 { 2, 3, 1, 4, 1 }, { 4, 1, 1, 1 }, { 4, 3, 1, 4, 1 }, 0, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP32_2 { 2, 3, 2, 2, 2 }, { 2, 1, 1, 1 }, { 2, 2, 2, 2, 2 }, 1, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP32_3 { 5, 3, 2, 2, 2 }, { 3, 1, 1, 1 }, { 5, 3, 2, 3, 2 }, 3, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP32_4 { 2, 3, 1, 4, 4 }, { 2, 1, 1, 1 }, { 2, 3, 2, 4, 1 }, 2, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP32_5 { 3, 1, 5, 2, 1 }, { 2, 1, 1, 1 }, { 3, 1, 1, 2, 2 }, 4, data_types::f32, format::bfzyx, data_types::f32, format::bfzyx
|
||||
|
||||
#define CASE_GATHER_5D_FP16_1 { 3, 2, 1, 2, 1 }, { 2, 1, 1, 1 }, { 2, 2, 2, 2, 1 }, format::bfzyx, cldnn::gather::gather_axis::along_b, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP16_2 { 1, 3, 1, 2, 1 }, { 2, 1, 1, 1 }, { 1, 2, 1, 2, 1 }, format::bfzyx, cldnn::gather::gather_axis::along_f, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP16_3 { 2, 3, 1, 3, 3 }, { 1, 2, 1, 1 }, { 2, 3, 1, 2, 3 }, format::bfzyx, cldnn::gather::gather_axis::along_y, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP16_4 { 3, 2, 2, 2, 2 }, { 2, 1, 1, 1 }, { 3, 2, 2, 2, 2 }, format::bfzyx, cldnn::gather::gather_axis::along_z, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP16_5 { 1, 1, 2, 1, 1 }, { 3, 1, 1, 1 }, { 1, 1, 3, 1, 1 }, format::bfzyx, cldnn::gather::gather_axis::along_x, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP16_1 { 3, 2, 1, 2, 1 }, { 2, 1, 1, 1 }, { 2, 2, 1, 2, 2 }, 0, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP16_2 { 1, 3, 1, 2, 1 }, { 2, 1, 1, 1 }, { 1, 2, 1, 2, 1 }, 1, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP16_3 { 2, 3, 1, 3, 3 }, { 1, 2, 1, 1 }, { 2, 3, 3, 2, 1 }, 3, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP16_4 { 3, 2, 2, 2, 2 }, { 2, 1, 1, 1 }, { 3, 2, 2, 2, 2 }, 2, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
|
||||
#define CASE_GATHER_5D_FP16_5 { 1, 1, 2, 1, 1 }, { 3, 1, 1, 1 }, { 1, 1, 1, 1, 3 }, 4, data_types::f16, format::bfzyx, data_types::f16, format::bfzyx
|
||||
|
||||
class gather_quantize : public GatherPrimitiveFusingTest {};
|
||||
TEST_P(gather_quantize, basic) {
|
||||
@ -114,7 +99,7 @@ TEST_P(gather_quantize, basic) {
|
||||
data("in_hi", get_mem(get_per_channel_layout(p), 1, max_random)),
|
||||
data("out_lo", get_mem(get_single_element_layout(p), -127)),
|
||||
data("out_hi", get_mem(get_single_element_layout(p), 127)),
|
||||
gather("gather_prim", "input", "gather_indices", p.axis, p.out_format, p.out_shape),
|
||||
gather("gather_prim", "input", "gather_indices", p.axis, p.out_shape),
|
||||
quantize("quantize", "gather_prim", "in_lo", "in_hi", "out_lo", "out_hi", 255, data_types::i8),
|
||||
reorder("reorder_bfyx", "quantize", p.default_format, data_types::f32)
|
||||
);
|
||||
@ -156,7 +141,7 @@ TEST_P(gather_scale_activation, basic) {
|
||||
input_layout("input", get_input_layout(p)),
|
||||
data("gather_indices", get_mem(get_indices_layout(p), 0, static_cast<int>(get_axis_dim(p) - 1))),
|
||||
data("scale_data", get_mem(get_per_channel_layout(p), -10, 10)),
|
||||
gather("gather_prim", "input", "gather_indices", p.axis, p.out_format, p.out_shape),
|
||||
gather("gather_prim", "input", "gather_indices", p.axis, p.out_shape),
|
||||
activation("activation", "gather_prim", activation_func::abs),
|
||||
scale("scale", "activation", "scale_data"),
|
||||
reorder("reorder_bfyx", "scale", p.default_format, data_types::f32)
|
||||
|
@ -46,9 +46,9 @@ TEST(gather8_gpu_fp16, d323_axisY_bdim_m1) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfzyx, { 3, 2, 2, 4, 3} }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 3, 2, 1, 3 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_y;
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfzyx, tensor{ 3, 2, 2, 4, 3} }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 3, 2, 1, 3 } }); // Indexes
|
||||
int64_t axis = 3;
|
||||
int64_t batch_dim = -1;
|
||||
bool negative_indexes = true;
|
||||
|
||||
@ -95,7 +95,7 @@ TEST(gather8_gpu_fp16, d323_axisY_bdim_m1) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfzyx, tensor(3, 2, 2, 3, 3), batch_dim, negative_indexes)
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{3, 2, 3, 3, 2}, batch_dim, negative_indexes)
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -171,9 +171,9 @@ TEST(gather7_gpu_fp16, d222_axisX_bdim_m1) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfwzyx, { 2, 2, 2, 2, 2, 2} }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 2, 2, 1, 2 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_x;
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfwzyx, tensor{ 2, 2, 2, 2, 2, 2} }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 2 } }); // Indexes
|
||||
int64_t axis = 5;
|
||||
int64_t batch_dim = -1;
|
||||
|
||||
set_values(input1, {
|
||||
@ -202,7 +202,7 @@ TEST(gather7_gpu_fp16, d222_axisX_bdim_m1) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfwzyx, tensor(2, 2, 2, 2, 2, 2), batch_dim)
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{2, 2, 2, 2, 2, 2}, batch_dim)
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -265,9 +265,9 @@ TEST(gather7_gpu_fp16, d323_axisY_bdim_m1) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfzyx, { 3, 2, 2, 4, 3} }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 3, 2, 1, 3 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_y;
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfzyx, tensor{ 3, 2, 2, 4, 3} }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 3, 2, 1, 3 } }); // Indexes
|
||||
int64_t axis = 3;
|
||||
int64_t batch_dim = -1;
|
||||
|
||||
set_values(input1, {
|
||||
@ -313,7 +313,7 @@ TEST(gather7_gpu_fp16, d323_axisY_bdim_m1) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfzyx, tensor(3, 2, 2, 3, 3), batch_dim)
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{3, 2, 3, 3, 2}, batch_dim)
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -383,9 +383,9 @@ TEST(gather7_gpu_fp16, d44_axisY_bdim1) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, { 4, 3, 1, 5 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 4, 4, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_y;
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 4, 3, 1, 5 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 4, 4, 1, 1 } }); // Indexes
|
||||
int64_t axis = 2;
|
||||
int64_t batch_dim = 1;
|
||||
|
||||
set_values(input1, {
|
||||
@ -417,7 +417,7 @@ TEST(gather7_gpu_fp16, d44_axisY_bdim1) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(4, 3, 1, 4), batch_dim)
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{4, 3, 4, 1}, batch_dim)
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -472,9 +472,9 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim_m1) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, { 3, 2, 1, 1 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 3, 2, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_f;
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Indexes
|
||||
int64_t axis = 1;
|
||||
size_t batch_dim = -1;
|
||||
|
||||
set_values(input1, {
|
||||
@ -492,7 +492,7 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim_m1) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(3, 2, 1, 1), batch_dim)
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{3, 2, 1, 1}, batch_dim)
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -535,9 +535,9 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim1) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, { 3, 2, 1, 1 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 3, 2, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_f;
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Indexes
|
||||
int64_t axis = 1;
|
||||
int64_t batch_dim = 1;
|
||||
|
||||
set_values(input1, {
|
||||
@ -555,7 +555,7 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim1) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(3, 2, 1, 1), batch_dim)
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{3, 2, 1, 1}, batch_dim)
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -597,9 +597,9 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim0) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, { 3, 2, 1, 1 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 3, 2, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_f;
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 3, 2, 1, 1 } }); // Indexes
|
||||
int64_t axis = 1;
|
||||
size_t batch_dim = 0;
|
||||
|
||||
set_values(input1, {
|
||||
@ -617,7 +617,7 @@ TEST(gather7_gpu_fp16, d32_axisF_bdim0) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(3, 3, 1, 2), batch_dim)
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{3, 3, 2, 1}, batch_dim)
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -669,7 +669,7 @@ TEST(gather_gpu_fp16, d14_axisB) {
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, { 2, 2, 1, 1 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 1, 4, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_b;
|
||||
int64_t axis = 0;
|
||||
|
||||
set_values(input1, {
|
||||
FLOAT16(1.0f), FLOAT16(2.0f),
|
||||
@ -685,7 +685,7 @@ TEST(gather_gpu_fp16, d14_axisB) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(1, 4, 1, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{1, 4, 2, 1})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -726,9 +726,9 @@ TEST(gather_gpu_fp16, d222_axisB) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, { 3, 2, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 2, 2, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_b;
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 3, 2, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Indexes
|
||||
int64_t axis = 0;
|
||||
|
||||
set_values(input1, {
|
||||
FLOAT16(1.f), FLOAT16(2.f), FLOAT16(3.f),
|
||||
@ -747,7 +747,7 @@ TEST(gather_gpu_fp16, d222_axisB) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{2, 2, 2, 2})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -788,9 +788,9 @@ TEST(gather_gpu_fp16, d22_axisY) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, { 2, 2, 1, 3 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 2, 2, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_y;
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 2, 2, 1, 3 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Indexes
|
||||
int64_t axis = 2;
|
||||
|
||||
set_values(input1, {
|
||||
FLOAT16(1.f), FLOAT16(2.f), FLOAT16(3.f),
|
||||
@ -808,7 +808,7 @@ TEST(gather_gpu_fp16, d22_axisY) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{2, 2, 2, 2})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -849,9 +849,9 @@ TEST(gather_gpu_fp16, d22_axisF) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, { 2, 3, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 2, 2, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_f;
|
||||
auto input1 = engine.allocate_memory({ data_types::f16, format::bfyx, tensor{ 2, 3, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Indexes
|
||||
int64_t axis = 1;
|
||||
|
||||
set_values(input1, {
|
||||
FLOAT16(1.f), FLOAT16(2.f), FLOAT16(3.f),
|
||||
@ -869,7 +869,7 @@ TEST(gather_gpu_fp16, d22_axisF) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{2, 2, 2, 2})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -909,9 +909,9 @@ TEST(gather_gpu_fp32, d14_axisB) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, { 2, 2, 1, 1 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 1, 4, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_b;
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 1, 4, 1, 1 } }); // Indexes
|
||||
int64_t axis = 0;
|
||||
|
||||
set_values(input1, {
|
||||
1.0f, 2.0f,
|
||||
@ -927,7 +927,7 @@ TEST(gather_gpu_fp32, d14_axisB) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(1, 4, 1, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{1, 4, 2, 1})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -968,9 +968,9 @@ TEST(gather_gpu_fp32, d222_axisB) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, { 3, 2, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 2, 2, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_b;
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 3, 2, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Indexes
|
||||
int64_t axis = 0;
|
||||
|
||||
set_values(input1, {
|
||||
1.f, 2.f, 3.f,
|
||||
@ -988,7 +988,7 @@ TEST(gather_gpu_fp32, d222_axisB) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{2, 2, 2, 2})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -1029,9 +1029,9 @@ TEST(gather_gpu_fp32, d22_axisY) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, { 2, 2, 1, 3 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 2, 2, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_y;
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 3 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Indexes
|
||||
int64_t axis = 2;
|
||||
|
||||
set_values(input1, {
|
||||
1.f, 2.f, 3.f,
|
||||
@ -1049,7 +1049,7 @@ TEST(gather_gpu_fp32, d22_axisY) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{2, 2, 2, 2})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -1090,9 +1090,9 @@ TEST(gather_gpu_fp32, d22_axisF) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, { 2, 3, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, { 2, 2, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_f;
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 3, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Indexes
|
||||
int64_t axis = 1;
|
||||
|
||||
set_values(input1, {
|
||||
1.f, 2.f, 3.f,
|
||||
@ -1110,7 +1110,7 @@ TEST(gather_gpu_fp32, d22_axisF) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{2, 2, 2, 2})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -1151,9 +1151,9 @@ TEST(gather_gpu_int32, d22_axisF) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::i32, format::bfyx, { 2, 3, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, { 2, 2, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_f;
|
||||
auto input1 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 2, 3, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Indexes
|
||||
int64_t axis = 1;
|
||||
|
||||
set_values(input1, {
|
||||
1, 2, 3,
|
||||
@ -1171,7 +1171,7 @@ TEST(gather_gpu_int32, d22_axisF) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{2, 2, 2, 2})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -1211,9 +1211,9 @@ TEST(gather_gpu_int32, d14_axisB) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::i32, format::bfyx, { 2, 2, 1, 1 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, { 1, 4, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_b;
|
||||
auto input1 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 1, 4, 1, 1 } }); // Indexes
|
||||
int64_t axis = 0;
|
||||
|
||||
set_values(input1, {
|
||||
1, 2,
|
||||
@ -1229,7 +1229,7 @@ TEST(gather_gpu_int32, d14_axisB) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(1, 4, 1, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{1, 4, 2, 1})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -1270,9 +1270,9 @@ TEST(gather_gpu_int32, d222_axisB) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::i32, format::bfyx, { 3, 2, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, { 2, 2, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_b;
|
||||
auto input1 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 3, 2, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Indexes
|
||||
int64_t axis = 0;
|
||||
|
||||
set_values(input1, {
|
||||
1, 2, 3,
|
||||
@ -1290,7 +1290,7 @@ TEST(gather_gpu_int32, d222_axisB) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{2, 2, 2, 2})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -1331,9 +1331,9 @@ TEST(gather_gpu_int32, d22_axisY) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::i32, format::bfyx, { 2, 2, 1, 3 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, { 2, 2, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_y;
|
||||
auto input1 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 2, 2, 1, 3 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Indexes
|
||||
int64_t axis = 2;
|
||||
|
||||
set_values(input1, {
|
||||
1, 2, 3,
|
||||
@ -1351,7 +1351,7 @@ TEST(gather_gpu_int32, d22_axisY) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{2, 2, 2, 2})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -1395,9 +1395,9 @@ TEST(gather_gpu_fp32, d41_axisB) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, { 2, 2, 1, 3 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, { 4, 1, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_b;
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 3 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 4, 1, 1, 1 } }); // Indexes
|
||||
int64_t axis = 0;
|
||||
|
||||
set_values(input1, {
|
||||
1.f, 2.f, 3.f,
|
||||
@ -1415,7 +1415,7 @@ TEST(gather_gpu_fp32, d41_axisB) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(4, 1, 3, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{4, 1, 2, 3})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -1461,9 +1461,9 @@ TEST(gather_gpu_fp32, d41_axisF) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, { 2, 3, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, { 4, 1, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_f;
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 3, 1, 2 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 4, 1, 1, 1 } }); // Indexes
|
||||
int64_t axis = 1;
|
||||
|
||||
set_values(input1, {
|
||||
1.f, 2.f, 3.f, 4.f, 5.f, 6.f,
|
||||
@ -1478,7 +1478,7 @@ TEST(gather_gpu_fp32, d41_axisF) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 4, 2, 1))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{2, 4, 1, 2})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -1520,9 +1520,9 @@ TEST(gather_gpu_fp32, d2_axisX) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, { 2, 2, 1, 1 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, { 2, 1, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_x;
|
||||
auto input1 = engine.allocate_memory({ data_types::f32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Dictionary
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 2, 1, 1, 1 } }); // Indexes
|
||||
int64_t axis = 3;
|
||||
|
||||
set_values(input1, {
|
||||
1.f, 2.f,
|
||||
@ -1537,7 +1537,7 @@ TEST(gather_gpu_fp32, d2_axisX) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(2, 2, 2, 1))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{2, 2, 1, 2})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -1570,9 +1570,9 @@ TEST(gather_gpu_fp32, 322_axisF) {
|
||||
|
||||
auto& engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({ data_types::i32, format::bfyx, { 3, 3, 1, 1 } }); // data
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, { 2, 2, 1, 1 } }); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_f;
|
||||
auto input1 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 3, 3, 1, 1 } }); // data
|
||||
auto input2 = engine.allocate_memory({ data_types::i32, format::bfyx, tensor{ 2, 2, 1, 1 } }); // Indexes
|
||||
int64_t axis = 1;
|
||||
|
||||
set_values(input1, {
|
||||
0, 1, 2, 10, 11, 12, 20, 21, 22
|
||||
@ -1587,7 +1587,7 @@ TEST(gather_gpu_fp32, 322_axisF) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(3, 2, 1, 2))
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{3, 2, 2, 1})
|
||||
);
|
||||
|
||||
network network(engine, topology);
|
||||
@ -1619,9 +1619,9 @@ TEST(gather_gpu_u8, 322_axisF) {
|
||||
|
||||
auto &engine = get_test_engine();
|
||||
|
||||
auto input1 = engine.allocate_memory({data_types::u8, format::bfyx, {3, 3, 1, 1}}); // data
|
||||
auto input2 = engine.allocate_memory({data_types::i32, format::bfyx, {2, 2, 1, 1}}); // Indexes
|
||||
auto axis = cldnn::gather::gather_axis::along_f;
|
||||
auto input1 = engine.allocate_memory({data_types::u8, format::bfyx, tensor{3, 3, 1, 1}}); // data
|
||||
auto input2 = engine.allocate_memory({data_types::i32, format::bfyx, tensor{2, 2, 1, 1}}); // Indexes
|
||||
int64_t axis = 1;
|
||||
|
||||
set_values<uint8_t>(input1, {0, 1, 2, 10, 11, 12, 20, 21, 22});
|
||||
|
||||
@ -1632,7 +1632,7 @@ TEST(gather_gpu_u8, 322_axisF) {
|
||||
topology.add(input_layout("InputDictionary", input1->get_layout()));
|
||||
topology.add(input_layout("InputText", input2->get_layout()));
|
||||
topology.add(
|
||||
gather("gather", "InputDictionary", "InputText", axis, format::bfyx, tensor(3, 2, 1, 2)));
|
||||
gather("gather", "InputDictionary", "InputText", axis, ov::Shape{3, 2, 2, 1}));
|
||||
|
||||
network network(engine, topology);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user