[GPU] Use int64_t type for axis in concat (#9790)
This commit is contained in:
parent
d0b4cae2f8
commit
4c4581940a
@ -39,16 +39,6 @@ namespace cldnn {
|
|||||||
/// @li outputIdx : index of destination feature
|
/// @li outputIdx : index of destination feature
|
||||||
struct concatenation : public primitive_base<concatenation> {
|
struct concatenation : public primitive_base<concatenation> {
|
||||||
CLDNN_DECLARE_PRIMITIVE(concatenation)
|
CLDNN_DECLARE_PRIMITIVE(concatenation)
|
||||||
|
|
||||||
enum concatenation_axis {
|
|
||||||
along_b,
|
|
||||||
along_f,
|
|
||||||
along_x,
|
|
||||||
along_y,
|
|
||||||
along_z,
|
|
||||||
along_w
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @li Constructs concatenation primitive.
|
/// @li Constructs concatenation primitive.
|
||||||
/// @param id This primitive id.
|
/// @param id This primitive id.
|
||||||
/// @param input Vector of input primitives ids.
|
/// @param input Vector of input primitives ids.
|
||||||
@ -56,7 +46,7 @@ struct concatenation : public primitive_base<concatenation> {
|
|||||||
concatenation(
|
concatenation(
|
||||||
const primitive_id& id,
|
const primitive_id& id,
|
||||||
const std::vector<primitive_id>& input,
|
const std::vector<primitive_id>& input,
|
||||||
const concatenation_axis axis,
|
const int64_t axis,
|
||||||
const primitive_id& ext_prim_id = "",
|
const primitive_id& ext_prim_id = "",
|
||||||
const padding& output_padding = padding())
|
const padding& output_padding = padding())
|
||||||
: primitive_base(id, {input}, ext_prim_id, output_padding), axis(axis) {}
|
: primitive_base(id, {input}, ext_prim_id, output_padding), axis(axis) {}
|
||||||
@ -69,14 +59,14 @@ struct concatenation : public primitive_base<concatenation> {
|
|||||||
concatenation(
|
concatenation(
|
||||||
const primitive_id& id,
|
const primitive_id& id,
|
||||||
const std::vector<primitive_id>& input,
|
const std::vector<primitive_id>& input,
|
||||||
const concatenation_axis axis,
|
const int64_t axis,
|
||||||
const data_types output_dt,
|
const data_types output_dt,
|
||||||
const primitive_id& ext_prim_id = "",
|
const primitive_id& ext_prim_id = "",
|
||||||
const padding& output_padding = padding())
|
const padding& output_padding = padding())
|
||||||
: primitive_base(id, {input}, ext_prim_id, output_padding, optional_data_type{output_dt}), axis(axis) {}
|
: primitive_base(id, {input}, ext_prim_id, output_padding, optional_data_type{output_dt}), axis(axis) {}
|
||||||
|
|
||||||
/// @brief Dimension along which concatenation should take place
|
/// @brief Dimension along which concatenation should take place
|
||||||
concatenation_axis axis;
|
int64_t axis;
|
||||||
};
|
};
|
||||||
/// @}
|
/// @}
|
||||||
/// @}
|
/// @}
|
||||||
|
@ -22,7 +22,7 @@ layout concatenation_inst::calc_output_layout(concatenation_node const& node) {
|
|||||||
|
|
||||||
auto input_layout = node.input(0).get_output_layout();
|
auto input_layout = node.input(0).get_output_layout();
|
||||||
auto output_format = input_layout.format;
|
auto output_format = input_layout.format;
|
||||||
auto result_sizes = input_layout.size.sizes();
|
auto result_sizes = input_layout.get_dims();
|
||||||
|
|
||||||
auto output_dt = desc->output_data_type ? *desc->output_data_type : input_layout.data_type;
|
auto output_dt = desc->output_data_type ? *desc->output_data_type : input_layout.data_type;
|
||||||
|
|
||||||
@ -31,14 +31,16 @@ layout concatenation_inst::calc_output_layout(concatenation_node const& node) {
|
|||||||
// calculate sum of features from all inputs
|
// calculate sum of features from all inputs
|
||||||
result_sizes[axis_index] = 0;
|
result_sizes[axis_index] = 0;
|
||||||
for (size_t i = 0; i < desc->input.size(); ++i) {
|
for (size_t i = 0; i < desc->input.size(); ++i) {
|
||||||
auto input_sizes = node.input(i).get_output_layout().size.sizes();
|
auto input_sizes = node.input(i).get_output_layout().get_dims();
|
||||||
if (node.input(i).get_output_layout().format == format::b_fs_yx_fsv16)
|
if (node.input(i).get_output_layout().format == format::b_fs_yx_fsv16)
|
||||||
output_format = format::b_fs_yx_fsv16;
|
output_format = format::b_fs_yx_fsv16;
|
||||||
|
|
||||||
result_sizes[axis_index] += input_sizes[axis_index];
|
result_sizes[axis_index] += input_sizes[axis_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
return layout {output_dt, output_format, (tensor) result_sizes};
|
auto def_fmt = format::get_default_format(input_layout.get_rank());
|
||||||
|
|
||||||
|
return layout {output_dt, output_format, tensor(def_fmt, result_sizes)};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string concatenation_inst::to_string(concatenation_node const& node) {
|
std::string concatenation_inst::to_string(concatenation_node const& node) {
|
||||||
@ -58,7 +60,6 @@ std::string concatenation_inst::to_string(concatenation_node const& node) {
|
|||||||
concat_info.add("concat axis", desc->axis);
|
concat_info.add("concat axis", desc->axis);
|
||||||
concat_info.add("inputs count", node.inputs_count());
|
concat_info.add("inputs count", node.inputs_count());
|
||||||
concat_info.add("inputs", ss_inputs.str());
|
concat_info.add("inputs", ss_inputs.str());
|
||||||
concat_info.dump(primitive_description);
|
|
||||||
|
|
||||||
node_info->add("concat info", concat_info);
|
node_info->add("concat info", concat_info);
|
||||||
node_info->dump(primitive_description);
|
node_info->dump(primitive_description);
|
||||||
@ -72,39 +73,39 @@ concatenation_inst::typed_primitive_inst(network& network, concatenation_node co
|
|||||||
auto output_layout = node.get_output_layout();
|
auto output_layout = node.get_output_layout();
|
||||||
|
|
||||||
tensor::value_type concat_count = 0;
|
tensor::value_type concat_count = 0;
|
||||||
auto input_size = input_layout.size;
|
auto input_size = input_layout.get_dims();
|
||||||
auto output_size = output_layout.size;
|
auto output_size = output_layout.get_dims();
|
||||||
for (const auto& i : node.get_dependencies()) {
|
for (const auto& i : node.get_dependencies()) {
|
||||||
auto input_i_layout = i->get_output_layout();
|
auto input_i_layout = i->get_output_layout();
|
||||||
auto input_mem_size = input_i_layout.size;
|
auto input_mem_size = input_i_layout.get_dims();
|
||||||
for (int dim = concatenation::along_b; dim <= concatenation::along_w; ++dim) {
|
for (int64_t dim = 0; dim < output_layout.get_rank(); ++dim) {
|
||||||
if (dim == node.get_primitive()->axis) {
|
if (dim == node.get_primitive()->axis) {
|
||||||
concat_count += input_mem_size.raw[dim];
|
concat_count += input_mem_size[dim];
|
||||||
} else {
|
} else {
|
||||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||||
"Input size dim: " + std::to_string(dim),
|
"Input size dim: " + std::to_string(dim),
|
||||||
input_size.raw[dim],
|
input_size[dim],
|
||||||
"input memory dim: " + std::to_string(dim),
|
"input memory dim: " + std::to_string(dim),
|
||||||
input_mem_size.raw[dim],
|
input_mem_size[dim],
|
||||||
"Every input must have the same size");
|
"Every input must have the same size");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int dim = concatenation::along_b; dim <= concatenation::along_w; ++dim) {
|
for (int64_t dim = 0; dim < output_layout.get_rank(); ++dim) {
|
||||||
if (dim == node.get_primitive()->axis) {
|
if (dim == node.get_primitive()->axis) {
|
||||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||||
"Concat count",
|
"Concat count",
|
||||||
concat_count,
|
concat_count,
|
||||||
"output size dim:" + std::to_string(dim),
|
"output size dim:" + std::to_string(dim),
|
||||||
output_size.raw[dim],
|
output_size[dim],
|
||||||
"Output size in concatenated dimension mismatch sum of inputs!");
|
"Output size in concatenated dimension mismatch sum of inputs!");
|
||||||
} else {
|
} else {
|
||||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||||
"Input size dim: " + std::to_string(dim),
|
"Input size dim: " + std::to_string(dim),
|
||||||
input_size.raw[dim],
|
input_size[dim],
|
||||||
"output size dim:" + std::to_string(dim),
|
"output size dim:" + std::to_string(dim),
|
||||||
output_size.raw[dim],
|
output_size[dim],
|
||||||
"Output size in non-concatenated dimension mistmatch input");
|
"Output size in non-concatenated dimension mistmatch input");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include "pass_manager.h"
|
#include "pass_manager.h"
|
||||||
#include "program_node.h"
|
#include "program_node.h"
|
||||||
#include "mutable_data_inst.h"
|
#include "mutable_data_inst.h"
|
||||||
#include "concatenation_inst.h"
|
|
||||||
#include "tensor_type.h"
|
#include "tensor_type.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -126,7 +126,7 @@ void concat_input_order::run(program& p) {
|
|||||||
auto& concat_node = node->as<concatenation>();
|
auto& concat_node = node->as<concatenation>();
|
||||||
auto prim = concat_node.get_primitive();
|
auto prim = concat_node.get_primitive();
|
||||||
|
|
||||||
bool along_f = prim->axis == concatenation::along_f;
|
bool along_f = prim->axis == 1;
|
||||||
size_t inputs_count = prim->input_size();
|
size_t inputs_count = prim->input_size();
|
||||||
bool no_fusing = !concat_node.has_fused_primitives() && concat_node.get_dependencies().size() == inputs_count;
|
bool no_fusing = !concat_node.has_fused_primitives() && concat_node.get_dependencies().size() == inputs_count;
|
||||||
|
|
||||||
|
@ -298,8 +298,7 @@ void graph_initializations::handle_lstm_node(program& p, lstm_node& node) {
|
|||||||
output_ids_offsets.push_back(e.second.first);
|
output_ids_offsets.push_back(e.second.first);
|
||||||
}
|
}
|
||||||
primitive_id concatenation_id = node.id() + ":concat";
|
primitive_id concatenation_id = node.id() + ":concat";
|
||||||
auto concatenation_primitive =
|
auto concatenation_primitive = std::make_shared<concatenation>(concatenation_id, output_ids_offsets, 1);
|
||||||
std::make_shared<concatenation>(concatenation_id, output_ids_offsets, concatenation::along_f);
|
|
||||||
auto& concatenation_node = p.get_or_create(concatenation_primitive);
|
auto& concatenation_node = p.get_or_create(concatenation_primitive);
|
||||||
for (auto& e : output_map) {
|
for (auto& e : output_map) {
|
||||||
p.add_connection(*e.second.second, concatenation_node);
|
p.add_connection(*e.second.second, concatenation_node);
|
||||||
|
@ -125,6 +125,7 @@ bool concat_in_place_optimization::match(concatenation_node& node) {
|
|||||||
auto output_format = node.get_output_layout().format;
|
auto output_format = node.get_output_layout().format;
|
||||||
auto output_datatype = node.get_output_layout().data_type;
|
auto output_datatype = node.get_output_layout().data_type;
|
||||||
auto concat_axis = node.get_primitive()->axis;
|
auto concat_axis = node.get_primitive()->axis;
|
||||||
|
auto def_fmt = format::get_default_format(node.get_output_layout().get_rank());
|
||||||
|
|
||||||
size_t idx = 0;
|
size_t idx = 0;
|
||||||
for (auto& input : node.get_dependencies()) {
|
for (auto& input : node.get_dependencies()) {
|
||||||
@ -145,22 +146,22 @@ bool concat_in_place_optimization::match(concatenation_node& node) {
|
|||||||
// It however would make normal optimizations possible in others, so this is a trade-off to be investigated.
|
// It however would make normal optimizations possible in others, so this is a trade-off to be investigated.
|
||||||
if (idx != node.get_dependencies().size() - 1) {
|
if (idx != node.get_dependencies().size() - 1) {
|
||||||
if ((l.format == format::b_fs_yx_fsv16 || l.format == format::b_fs_zyx_fsv16) &&
|
if ((l.format == format::b_fs_yx_fsv16 || l.format == format::b_fs_zyx_fsv16) &&
|
||||||
(l.size.feature[0] % 16 != 0 || node.get_primitive()->axis != concatenation::along_f))
|
(l.size.feature[0] % 16 != 0 || node.get_primitive()->axis != 1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ((l.format == format::b_fs_yx_fsv32 || l.format == format::b_fs_zyx_fsv32) &&
|
if ((l.format == format::b_fs_yx_fsv32 || l.format == format::b_fs_zyx_fsv32) &&
|
||||||
(l.size.feature[0] % 32 != 0 || node.get_primitive()->axis != concatenation::along_f))
|
(l.size.feature[0] % 32 != 0 || node.get_primitive()->axis != 1))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (l.format == format::b_fs_yx_fsv4 && (l.size.feature[0] != 4 || node.get_primitive()->axis != concatenation::along_f))
|
if (l.format == format::b_fs_yx_fsv4 && (l.size.feature[0] != 4 || node.get_primitive()->axis != 1))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lower_padd_in_axis = node.get_output_layout().data_padding.lower_size().raw[concat_axis];
|
auto lower_padd_in_axis = node.get_output_layout().data_padding.lower_size().sizes(def_fmt)[concat_axis];
|
||||||
lower_padd_in_axis = std::max(lower_padd_in_axis,
|
lower_padd_in_axis = std::max(lower_padd_in_axis,
|
||||||
node.get_dependency(0).get_output_layout().data_padding.lower_size().raw[concat_axis]);
|
node.get_dependency(0).get_output_layout().data_padding.lower_size().sizes(def_fmt)[concat_axis]);
|
||||||
|
|
||||||
// check if concatenation in place can be applied for inputs set
|
// check if concatenation in place can be applied for inputs set
|
||||||
idx = 0;
|
idx = 0;
|
||||||
@ -208,13 +209,13 @@ bool concat_in_place_optimization::match(concatenation_node& node) {
|
|||||||
// Check that there isn't already some padding between inputs in concat axis.
|
// Check that there isn't already some padding between inputs in concat axis.
|
||||||
// If node has already been optimized we skip this check - this is just cascade adjustment.
|
// If node has already been optimized we skip this check - this is just cascade adjustment.
|
||||||
if (!node.can_be_optimized()) {
|
if (!node.can_be_optimized()) {
|
||||||
if (idx != node.get_dependencies().size() && input_padd.upper_size().raw[concat_axis] != 0)
|
if (idx != node.get_dependencies().size() && input_padd.upper_size().sizes(def_fmt)[concat_axis] != 0)
|
||||||
return false;
|
return false;
|
||||||
if (idx != 0 && input_padd.lower_size().raw[concat_axis] != 0)
|
if (idx != 0 && input_padd.lower_size().sizes(def_fmt)[concat_axis] != 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
lower_padd_in_axis += input->get_output_layout().size.raw[concat_axis];
|
lower_padd_in_axis += input->get_output_layout().size.sizes(def_fmt)[concat_axis];
|
||||||
idx += 1;
|
idx += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,31 +223,43 @@ bool concat_in_place_optimization::match(concatenation_node& node) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void concat_in_place_optimization::optimize_cascade(concatenation_node& node, std::list<concatenation_node*>& need_reoptimization) {
|
void concat_in_place_optimization::optimize_cascade(concatenation_node& node, std::list<concatenation_node*>& need_reoptimization) {
|
||||||
|
auto out_layout = node.get_output_layout();
|
||||||
|
auto out_rank = out_layout.get_rank();
|
||||||
|
auto def_fmt = format::get_default_format(out_rank);
|
||||||
auto concat_axis = node.get_primitive()->axis;
|
auto concat_axis = node.get_primitive()->axis;
|
||||||
|
// We need to transform axis from bf[w][z]yx order to bfxy[z][w] due to tensor.sizes() usages here
|
||||||
|
// should be removed once pad representation is changed
|
||||||
|
auto concat_axis_legacy = concat_axis;
|
||||||
|
if (concat_axis_legacy >= 2) {
|
||||||
|
auto spatial_axis = concat_axis_legacy - 2;
|
||||||
|
// Default and minimum number of dimensions is 4
|
||||||
|
auto spatial_size = std::max<size_t>(out_rank, 4) - 2;
|
||||||
|
concat_axis_legacy = spatial_size - spatial_axis - 1 + 2;
|
||||||
|
}
|
||||||
|
|
||||||
// Select output padding by propagating all required input paddings.
|
// Select output padding by propagating all required input paddings.
|
||||||
auto padd = node.get_output_layout().data_padding;
|
auto padd = out_layout.data_padding;
|
||||||
for (auto input : node.get_dependencies()) {
|
for (auto input : node.get_dependencies()) {
|
||||||
auto inputPadding = input->get_output_layout().data_padding;
|
auto inputPadding = input->get_output_layout().data_padding;
|
||||||
padd = padding::max(padd, inputPadding);
|
padd = padding::max(padd, inputPadding);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto lower_padd = padd.lower_size();
|
auto lower_padd = padd.lower_size().sizes();
|
||||||
auto upper_padd = padd.upper_size();
|
auto upper_padd = padd.upper_size().sizes();
|
||||||
|
|
||||||
// For cascade adjustment override padding in concat axis to output padding.
|
// For cascade adjustment override padding in concat axis to output padding.
|
||||||
// In other case match(...) already checked that only first/last input have lower/upper padding.
|
// In other case match(...) already checked that only first/last input have lower/upper padding.
|
||||||
if (node.can_be_optimized()) {
|
if (node.can_be_optimized()) {
|
||||||
lower_padd.raw[concat_axis] = node.get_output_layout().data_padding.lower_size().raw[concat_axis];
|
lower_padd[concat_axis_legacy] = out_layout.data_padding.lower_size().sizes()[concat_axis_legacy];
|
||||||
upper_padd.raw[concat_axis] = node.get_output_layout().data_padding.upper_size().raw[concat_axis];
|
upper_padd[concat_axis_legacy] = out_layout.data_padding.upper_size().sizes()[concat_axis_legacy];
|
||||||
}
|
}
|
||||||
node.set_output_padding(padding(lower_padd.sizes(), upper_padd.sizes()));
|
node.set_output_padding(padding(lower_padd, upper_padd));
|
||||||
|
|
||||||
upper_padd.raw[concat_axis] += node.get_output_layout().size.raw[concat_axis];
|
upper_padd[concat_axis_legacy] += out_layout.get_dims()[concat_axis];
|
||||||
|
|
||||||
// apply concatenation in place optimization
|
// apply concatenation in place optimization
|
||||||
for (auto input : node.get_dependencies()) {
|
for (auto input : node.get_dependencies()) {
|
||||||
auto input_length = input->get_output_layout().size.raw[concat_axis];
|
auto input_length = input->get_output_layout().get_dims()[concat_axis];
|
||||||
|
|
||||||
if (input->is_type<concatenation>() && input->can_be_optimized())
|
if (input->is_type<concatenation>() && input->can_be_optimized())
|
||||||
need_reoptimization.push_back(&input->as<concatenation>());
|
need_reoptimization.push_back(&input->as<concatenation>());
|
||||||
@ -255,16 +268,16 @@ void concat_in_place_optimization::optimize_cascade(concatenation_node& node, st
|
|||||||
//
|
//
|
||||||
// |--- lower padd ---| |---------- upper padd -----------|
|
// |--- lower padd ---| |---------- upper padd -----------|
|
||||||
// |-- output padd ---| ----- input1 ------|----- input2 -----|-- out padd --|
|
// |-- output padd ---| ----- input1 ------|----- input2 -----|-- out padd --|
|
||||||
upper_padd.raw[concat_axis] -= input_length;
|
upper_padd[concat_axis_legacy] -= input_length;
|
||||||
|
|
||||||
// set new padding for input
|
// set new padding for input
|
||||||
input->set_output_padding(padding(lower_padd.sizes(), upper_padd.sizes()));
|
input->set_output_padding(padding(lower_padd, upper_padd));
|
||||||
|
|
||||||
// move lower padd further
|
// move lower padd further
|
||||||
//
|
//
|
||||||
// |-------------- lower padd -------------|---------- upper padd -----------|
|
// |-------------- lower padd -------------|---------- upper padd -----------|
|
||||||
// |-- output padd ---| ----- input1 ------|----- input2 -----|-- out padd --|
|
// |-- output padd ---| ----- input1 ------|----- input2 -----|-- out padd --|
|
||||||
lower_padd.raw[concat_axis] += input_length;
|
lower_padd[concat_axis_legacy] += input_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
node.can_be_optimized(true);
|
node.can_be_optimized(true);
|
||||||
|
@ -16,24 +16,33 @@ namespace cldnn {
|
|||||||
namespace ocl {
|
namespace ocl {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
kernel_selector::concat_axis convert_axis(concatenation::concatenation_axis axis) {
|
kernel_selector::concat_axis convert_axis(int64_t axis, size_t rank) {
|
||||||
switch (axis) {
|
unsigned cldnn_axis = axis >= 0 ? axis : axis + static_cast<int64_t>(rank);
|
||||||
case concatenation::along_x:
|
if (cldnn_axis >= rank)
|
||||||
return kernel_selector::concat_axis::X;
|
IE_THROW() << "Concatenation axis exceeds number of dimensions";
|
||||||
case concatenation::along_y:
|
|
||||||
return kernel_selector::concat_axis::Y;
|
// Difference in dimension ordering between IE and GPU plugin,
|
||||||
case concatenation::along_z:
|
// reverse spatial dimensions after batch and feature.
|
||||||
return kernel_selector::concat_axis::Z;
|
if (cldnn_axis >= 2) {
|
||||||
case concatenation::along_w:
|
auto spatial_axis = cldnn_axis - 2;
|
||||||
return kernel_selector::concat_axis::W;
|
// Default and minimum number of dimensions is 4
|
||||||
case concatenation::along_f:
|
auto spatial_size = std::max<size_t>(rank, 4) - 2;
|
||||||
return kernel_selector::concat_axis::FEATURE;
|
cldnn_axis = spatial_size - spatial_axis - 1 + 2;
|
||||||
case concatenation::along_b:
|
|
||||||
return kernel_selector::concat_axis::BATCH;
|
|
||||||
default:
|
|
||||||
return kernel_selector::concat_axis::X;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (cldnn_axis) {
|
||||||
|
case 0: return kernel_selector::concat_axis::BATCH;
|
||||||
|
case 1: return kernel_selector::concat_axis::FEATURE;
|
||||||
|
case 2: return kernel_selector::concat_axis::X;
|
||||||
|
case 3: return kernel_selector::concat_axis::Y;
|
||||||
|
case 4: return kernel_selector::concat_axis::Z;
|
||||||
|
case 5: return kernel_selector::concat_axis::W;
|
||||||
|
default: IE_THROW() << "Unsupported concatenation axis: " << axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return kernel_selector::concat_axis::FEATURE; // shouldn't get here
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
struct concatenation_impl : typed_primitive_impl_ocl<concatenation> {
|
struct concatenation_impl : typed_primitive_impl_ocl<concatenation> {
|
||||||
@ -76,7 +85,7 @@ public:
|
|||||||
concat_params.inputs[i] = convert_data_tensor(input_layout);
|
concat_params.inputs[i] = convert_data_tensor(input_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
concat_params.axis = convert_axis(axis);
|
concat_params.axis = convert_axis(axis, arg.get_output_layout().get_rank());
|
||||||
concat_optional_params.kernelPerInput = true;
|
concat_optional_params.kernelPerInput = true;
|
||||||
|
|
||||||
auto& kernel_selector = kernel_selector::concatenation_kernel_selector::Instance();
|
auto& kernel_selector = kernel_selector::concatenation_kernel_selector::Instance();
|
||||||
|
@ -54,18 +54,9 @@ protected:
|
|||||||
input_mds.push_back(onednn::layout_to_memory_desc(input->get_output_layout()));
|
input_mds.push_back(onednn::layout_to_memory_desc(input->get_output_layout()));
|
||||||
}
|
}
|
||||||
auto output_md = onednn::layout_to_memory_desc(arg.get_output_layout());
|
auto output_md = onednn::layout_to_memory_desc(arg.get_output_layout());
|
||||||
int axis = 0;
|
|
||||||
switch (prim->axis) {
|
|
||||||
case concatenation::concatenation_axis::along_b: axis = 0; break;
|
|
||||||
case concatenation::concatenation_axis::along_f: axis = 1; break;
|
|
||||||
case concatenation::concatenation_axis::along_y: axis = 2; break;
|
|
||||||
case concatenation::concatenation_axis::along_x: axis = 3; break;
|
|
||||||
default: throw std::runtime_error("unsupported concat axis");
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_shared<dnnl::concat::primitive_desc>(
|
return std::make_shared<dnnl::concat::primitive_desc>(
|
||||||
output_md,
|
output_md,
|
||||||
axis,
|
prim->axis,
|
||||||
input_mds,
|
input_mds,
|
||||||
engine.get_onednn_engine());
|
engine.get_onednn_engine());
|
||||||
}
|
}
|
||||||
|
@ -13,40 +13,17 @@ namespace ov {
|
|||||||
namespace runtime {
|
namespace runtime {
|
||||||
namespace intel_gpu {
|
namespace intel_gpu {
|
||||||
|
|
||||||
static cldnn::concatenation::concatenation_axis GetConcatAxis(int32_t axis, size_t rank) {
|
|
||||||
unsigned cldnn_axis = axis >= 0 ? axis : axis + static_cast<int32_t>(rank);
|
|
||||||
if (cldnn_axis >= rank)
|
|
||||||
IE_THROW() << "Concatenation axis exceeds number of dimensions";
|
|
||||||
|
|
||||||
// Difference in dimension ordering between IE and GPU plugin,
|
|
||||||
// reverse spatial dimensions after batch and feature.
|
|
||||||
if (cldnn_axis >= 2) {
|
|
||||||
auto spatial_axis = cldnn_axis - 2;
|
|
||||||
// Default and minimum number of dimensions is 4
|
|
||||||
auto spatial_size = std::max<size_t>(rank, 4) - 2;
|
|
||||||
cldnn_axis = spatial_size - spatial_axis - 1 + 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (cldnn_axis) {
|
|
||||||
case 0: return cldnn::concatenation::concatenation_axis::along_b;
|
|
||||||
case 1: return cldnn::concatenation::concatenation_axis::along_f;
|
|
||||||
case 2: return cldnn::concatenation::concatenation_axis::along_x;
|
|
||||||
case 3: return cldnn::concatenation::concatenation_axis::along_y;
|
|
||||||
case 4: return cldnn::concatenation::concatenation_axis::along_z;
|
|
||||||
case 5: return cldnn::concatenation::concatenation_axis::along_w;
|
|
||||||
default: IE_THROW() << "Unsupported concatenation axis: " << axis;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cldnn::concatenation::concatenation_axis::along_f; // shouldn't get here
|
|
||||||
}
|
|
||||||
|
|
||||||
static void CreateConcatOp(Program& p, const std::shared_ptr<ngraph::op::v0::Concat>& op) {
|
static void CreateConcatOp(Program& p, const std::shared_ptr<ngraph::op::v0::Concat>& op) {
|
||||||
auto inputPrimitives = p.GetInputPrimitiveIDs(op);
|
auto inputPrimitives = p.GetInputPrimitiveIDs(op);
|
||||||
std::string layerName = layer_type_name_ID(op);
|
std::string layerName = layer_type_name_ID(op);
|
||||||
|
int64_t axis = op->get_axis();
|
||||||
|
if (axis < 0)
|
||||||
|
axis = axis + static_cast<int64_t>(op->get_input_partial_shape(0).rank().get_length());
|
||||||
|
|
||||||
auto concatPrim = cldnn::concatenation(
|
auto concatPrim = cldnn::concatenation(
|
||||||
layerName,
|
layerName,
|
||||||
inputPrimitives,
|
inputPrimitives,
|
||||||
GetConcatAxis(op->get_axis(), op->get_input_shape(0).size()),
|
axis,
|
||||||
DataTypeFromPrecision(op->get_output_element_type(0)),
|
DataTypeFromPrecision(op->get_output_element_type(0)),
|
||||||
op->get_friendly_name());
|
op->get_friendly_name());
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ static void CreateCommonConvertColorOp(Program& p, const std::shared_ptr<ngraph:
|
|||||||
out_layout,
|
out_layout,
|
||||||
op->get_friendly_name()));
|
op->get_friendly_name()));
|
||||||
}
|
}
|
||||||
p.AddPrimitive(cldnn::concatenation(layerName, convert_color_names, cldnn::concatenation::along_b, op->get_friendly_name()));
|
p.AddPrimitive(cldnn::concatenation(layerName, convert_color_names, 0, op->get_friendly_name()));
|
||||||
} else {
|
} else {
|
||||||
p.AddPrimitive(cldnn::convert_color(layerName,
|
p.AddPrimitive(cldnn::convert_color(layerName,
|
||||||
inputPrimitives,
|
inputPrimitives,
|
||||||
|
@ -293,7 +293,7 @@ static void CreateParameterOp(Program& p, const std::shared_ptr<ngraph::op::v0::
|
|||||||
|
|
||||||
if (inputDims[0] > 1) {
|
if (inputDims[0] > 1) {
|
||||||
auto concatPrimID = "concat:" + inputName + Program::m_preProcessTag;
|
auto concatPrimID = "concat:" + inputName + Program::m_preProcessTag;
|
||||||
p.AddPrimitive(cldnn::concatenation(concatPrimID, reorders, cldnn::concatenation::along_b, op->get_friendly_name()));
|
p.AddPrimitive(cldnn::concatenation(concatPrimID, reorders, 0, op->get_friendly_name()));
|
||||||
p.primitiveIDs[inputName] = concatPrimID;
|
p.primitiveIDs[inputName] = concatPrimID;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -140,7 +140,7 @@ static void CreateLSTMCellOp(Program& p, const std::shared_ptr<ngraph::op::v4::L
|
|||||||
op->get_friendly_name()));
|
op->get_friendly_name()));
|
||||||
p.AddPrimitive(cldnn::concatenation(input_concatID,
|
p.AddPrimitive(cldnn::concatenation(input_concatID,
|
||||||
{ permuteID, hiddenInStr },
|
{ permuteID, hiddenInStr },
|
||||||
cldnn::concatenation::concatenation_axis::along_x,
|
3,
|
||||||
op->get_friendly_name()));
|
op->get_friendly_name()));
|
||||||
|
|
||||||
p.AddInnerPrimitiveToProfiler(hiddenInResh, op->get_friendly_name(), op);
|
p.AddInnerPrimitiveToProfiler(hiddenInResh, op->get_friendly_name(), op);
|
||||||
@ -159,7 +159,7 @@ static void CreateLSTMCellOp(Program& p, const std::shared_ptr<ngraph::op::v4::L
|
|||||||
std::string crop_id = layerName + "_crop";
|
std::string crop_id = layerName + "_crop";
|
||||||
|
|
||||||
cldnn::primitive_id WRconcatID = layerName + "_WRconcat";
|
cldnn::primitive_id WRconcatID = layerName + "_WRconcat";
|
||||||
p.AddPrimitive(cldnn::concatenation(WRconcatID, { weightID, recurrentID }, cldnn::concatenation::concatenation_axis::along_f, op->get_friendly_name()));
|
p.AddPrimitive(cldnn::concatenation(WRconcatID, { weightID, recurrentID }, 1, op->get_friendly_name()));
|
||||||
p.AddInnerPrimitiveToProfiler(WRconcatID, op->get_friendly_name(), op);
|
p.AddInnerPrimitiveToProfiler(WRconcatID, op->get_friendly_name(), op);
|
||||||
|
|
||||||
p.AddPrimitive(cldnn::fully_connected(lstm_fc_id, input_concatID, WRconcatID, hasBias ? biasID : "", op->get_friendly_name()));
|
p.AddPrimitive(cldnn::fully_connected(lstm_fc_id, input_concatID, WRconcatID, hasBias ? biasID : "", op->get_friendly_name()));
|
||||||
@ -273,7 +273,7 @@ static void CreateLSTMSequenceOp(Program& p, const std::shared_ptr<ngraph::op::v
|
|||||||
cldnn::primitive_id inputCropID = layerName + "_inputCrop";
|
cldnn::primitive_id inputCropID = layerName + "_inputCrop";
|
||||||
|
|
||||||
cldnn::primitive_id WRconcatID = layerName + "_WRconcat";
|
cldnn::primitive_id WRconcatID = layerName + "_WRconcat";
|
||||||
p.AddPrimitive(cldnn::concatenation(WRconcatID, { weightID, recurrentID }, cldnn::concatenation::concatenation_axis::along_y, op->get_friendly_name()));
|
p.AddPrimitive(cldnn::concatenation(WRconcatID, { weightID, recurrentID }, 2, op->get_friendly_name()));
|
||||||
p.AddInnerPrimitiveToProfiler(WRconcatID, op->get_friendly_name(), op);
|
p.AddInnerPrimitiveToProfiler(WRconcatID, op->get_friendly_name(), op);
|
||||||
|
|
||||||
std::vector<size_t> WRreshapeSize = { 4 * size_t(lstm_hidden_size), size_t(lstm_input_size + lstm_hidden_size) };
|
std::vector<size_t> WRreshapeSize = { 4 * size_t(lstm_hidden_size), size_t(lstm_input_size + lstm_hidden_size) };
|
||||||
@ -300,7 +300,7 @@ static void CreateLSTMSequenceOp(Program& p, const std::shared_ptr<ngraph::op::v
|
|||||||
p.AddPrimitive(cldnn::crop(inputCrop_id, permuteID, crop_tensor, offset_tensor, op->get_friendly_name()));
|
p.AddPrimitive(cldnn::crop(inputCrop_id, permuteID, crop_tensor, offset_tensor, op->get_friendly_name()));
|
||||||
p.AddInnerPrimitiveToProfiler(inputCrop_id, op->get_friendly_name(), op);
|
p.AddInnerPrimitiveToProfiler(inputCrop_id, op->get_friendly_name(), op);
|
||||||
|
|
||||||
p.AddPrimitive(cldnn::concatenation(concatID, { inputCrop_id, hiddenStr }, cldnn::concatenation::concatenation_axis::along_x, op->get_friendly_name()));
|
p.AddPrimitive(cldnn::concatenation(concatID, { inputCrop_id, hiddenStr }, 3, op->get_friendly_name()));
|
||||||
p.AddInnerPrimitiveToProfiler(concatID, op->get_friendly_name(), op);
|
p.AddInnerPrimitiveToProfiler(concatID, op->get_friendly_name(), op);
|
||||||
p.AddPrimitive(cldnn::fully_connected(lstm_fc_id, concatID, WRreshapeID, biasID, op->get_friendly_name()));
|
p.AddPrimitive(cldnn::fully_connected(lstm_fc_id, concatID, WRreshapeID, biasID, op->get_friendly_name()));
|
||||||
p.AddInnerPrimitiveToProfiler(lstm_fc_id, op->get_friendly_name(), op);
|
p.AddInnerPrimitiveToProfiler(lstm_fc_id, op->get_friendly_name(), op);
|
||||||
@ -345,7 +345,7 @@ static void CreateLSTMSequenceOp(Program& p, const std::shared_ptr<ngraph::op::v
|
|||||||
// concatenated hidden state (output 1)
|
// concatenated hidden state (output 1)
|
||||||
cldnn::primitive_id outputConcatID = layerName + ".0";
|
cldnn::primitive_id outputConcatID = layerName + ".0";
|
||||||
cldnn::primitive_id concatStr = layerName + ":hiddenConcat";
|
cldnn::primitive_id concatStr = layerName + ":hiddenConcat";
|
||||||
p.AddPrimitive(cldnn::concatenation(concatStr, output_ids_offsets, cldnn::concatenation::along_f, op->get_friendly_name()));
|
p.AddPrimitive(cldnn::concatenation(concatStr, output_ids_offsets, 1, op->get_friendly_name()));
|
||||||
|
|
||||||
p.primitiveIDs[outputConcatID] = concatStr;
|
p.primitiveIDs[outputConcatID] = concatStr;
|
||||||
p.primitiveIDs[layerName] = concatStr;
|
p.primitiveIDs[layerName] = concatStr;
|
||||||
|
@ -102,7 +102,7 @@ TEST_P(concat_onednn_activation, along_f) {
|
|||||||
input_layout("input1", get_input_layout(p)),
|
input_layout("input1", get_input_layout(p)),
|
||||||
concatenation("concat",
|
concatenation("concat",
|
||||||
{ "input0", "input1" },
|
{ "input0", "input1" },
|
||||||
concatenation::concatenation_axis::along_f,
|
1,
|
||||||
data_types::f16,
|
data_types::f16,
|
||||||
"",
|
"",
|
||||||
padding{ { 0, 0, 0, 0 }, 0 }),
|
padding{ { 0, 0, 0, 0 }, 0 }),
|
||||||
@ -125,7 +125,7 @@ TEST_P(concat_onednn_eltwise, along_f) {
|
|||||||
data("scale_data", get_mem(data_layout, 1.0f / tensor{ 1, 1, 4, 4 }.count())),
|
data("scale_data", get_mem(data_layout, 1.0f / tensor{ 1, 1, 4, 4 }.count())),
|
||||||
concatenation("concat",
|
concatenation("concat",
|
||||||
{ "input0", "input1" },
|
{ "input0", "input1" },
|
||||||
concatenation::concatenation_axis::along_f,
|
1,
|
||||||
data_types::f16,
|
data_types::f16,
|
||||||
"",
|
"",
|
||||||
padding{ { 0, 0, 0, 0 }, 0 }),
|
padding{ { 0, 0, 0, 0 }, 0 }),
|
||||||
|
@ -822,7 +822,7 @@ TEST_P(conv_fp32_eltwise_fusing_extend_ops, pattern01_simple_sub) {
|
|||||||
eltwise("eltwise2_sub", "conv_prim", "eltwise_data2", eltwise_mode::sub),
|
eltwise("eltwise2_sub", "conv_prim", "eltwise_data2", eltwise_mode::sub),
|
||||||
eltwise("eltwise3_prod", "eltwise1_sum", "eltwise2_sub", eltwise_mode::prod),
|
eltwise("eltwise3_prod", "eltwise1_sum", "eltwise2_sub", eltwise_mode::prod),
|
||||||
eltwise("eltwise4_sum", "eltwise3_prod", "eltwise_data4", eltwise_mode::sum),
|
eltwise("eltwise4_sum", "eltwise3_prod", "eltwise_data4", eltwise_mode::sum),
|
||||||
concatenation("concat", { "eltwise4_sum", "eltwise4_sum" }, cldnn::concatenation::along_f),
|
concatenation("concat", { "eltwise4_sum", "eltwise4_sum" }, 1),
|
||||||
reorder("reorder_bfyx", "concat", p.default_format, data_types::f32)
|
reorder("reorder_bfyx", "concat", p.default_format, data_types::f32)
|
||||||
);
|
);
|
||||||
implementation_desc conv_impl = { format::b_fs_yx_fsv16, "" };
|
implementation_desc conv_impl = { format::b_fs_yx_fsv16, "" };
|
||||||
@ -850,7 +850,7 @@ TEST_P(conv_fp32_eltwise_fusing_extend_ops, pattern02_sub_scale) {
|
|||||||
eltwise("eltwise2_sub", "conv_prim", "eltwise1_sum", eltwise_mode::sub),
|
eltwise("eltwise2_sub", "conv_prim", "eltwise1_sum", eltwise_mode::sub),
|
||||||
eltwise("eltwise3_prod", "eltwise2_sub", "eltwise_data2", eltwise_mode::prod),
|
eltwise("eltwise3_prod", "eltwise2_sub", "eltwise_data2", eltwise_mode::prod),
|
||||||
scale("scale", "eltwise3_prod", "scale_data"),
|
scale("scale", "eltwise3_prod", "scale_data"),
|
||||||
concatenation("concat", { "scale", "scale" }, cldnn::concatenation::along_f),
|
concatenation("concat", { "scale", "scale" }, 1),
|
||||||
reorder("reorder_bfyx", "concat", p.default_format, data_types::f32)
|
reorder("reorder_bfyx", "concat", p.default_format, data_types::f32)
|
||||||
);
|
);
|
||||||
implementation_desc conv_impl = { format::b_fs_yx_fsv16, "" };
|
implementation_desc conv_impl = { format::b_fs_yx_fsv16, "" };
|
||||||
@ -879,7 +879,7 @@ TEST_P(conv_fp32_eltwise_fusing_extend_ops, pattern03_sub_div) {
|
|||||||
eltwise("eltwise2_div", "eltwise1_sum", "eltwise_data2", eltwise_mode::div),
|
eltwise("eltwise2_div", "eltwise1_sum", "eltwise_data2", eltwise_mode::div),
|
||||||
eltwise("eltwise3_prod", "eltwise2_div", "eltwise_data3", eltwise_mode::prod),
|
eltwise("eltwise3_prod", "eltwise2_div", "eltwise_data3", eltwise_mode::prod),
|
||||||
eltwise("eltwise4_sum", "eltwise3_prod", "eltwise_data4", eltwise_mode::sum),
|
eltwise("eltwise4_sum", "eltwise3_prod", "eltwise_data4", eltwise_mode::sum),
|
||||||
concatenation("concat", { "eltwise4_sum", "eltwise4_sum" }, cldnn::concatenation::along_f),
|
concatenation("concat", { "eltwise4_sum", "eltwise4_sum" }, 1),
|
||||||
reorder("reorder_bfyx", "concat", p.default_format, data_types::f32)
|
reorder("reorder_bfyx", "concat", p.default_format, data_types::f32)
|
||||||
);
|
);
|
||||||
implementation_desc conv_impl = { format::b_fs_yx_fsv16, "" };
|
implementation_desc conv_impl = { format::b_fs_yx_fsv16, "" };
|
||||||
@ -917,7 +917,7 @@ TEST_P(conv_fp32_eltwise_fusing_2conv, basic) {
|
|||||||
eltwise("eltwise1", "conv_prim0", "conv_prim", eltwise_mode::sum),
|
eltwise("eltwise1", "conv_prim0", "conv_prim", eltwise_mode::sum),
|
||||||
eltwise("eltwise2", "conv_prim0", "conv_prim", eltwise_mode::sum),
|
eltwise("eltwise2", "conv_prim0", "conv_prim", eltwise_mode::sum),
|
||||||
eltwise("eltwise3", "eltwise1", "eltwise2", eltwise_mode::prod),
|
eltwise("eltwise3", "eltwise1", "eltwise2", eltwise_mode::prod),
|
||||||
concatenation("concat", { "eltwise3", "eltwise3" }, cldnn::concatenation::along_f),
|
concatenation("concat", { "eltwise3", "eltwise3" }, 1),
|
||||||
reorder("reorder_bfyx", "concat", p.default_format, data_types::f32)
|
reorder("reorder_bfyx", "concat", p.default_format, data_types::f32)
|
||||||
);
|
);
|
||||||
implementation_desc conv_impl = { format::b_fs_yx_fsv16, "" };
|
implementation_desc conv_impl = { format::b_fs_yx_fsv16, "" };
|
||||||
@ -1023,7 +1023,7 @@ TEST_P(conv_fp32_multi_eltwise_concat, basic) {
|
|||||||
eltwise("eltwise2", "conv_prim", "eltwise_data2", eltwise_mode::sum),
|
eltwise("eltwise2", "conv_prim", "eltwise_data2", eltwise_mode::sum),
|
||||||
concatenation("concat",
|
concatenation("concat",
|
||||||
{ "eltwise1", "eltwise2" },
|
{ "eltwise1", "eltwise2" },
|
||||||
concatenation::concatenation_axis::along_f,
|
1,
|
||||||
data_types::i8,
|
data_types::i8,
|
||||||
"",
|
"",
|
||||||
padding{ { 0, 0, 0, 0 }, 0 }),
|
padding{ { 0, 0, 0, 0 }, 0 }),
|
||||||
|
@ -208,7 +208,7 @@ TEST_P(resample_quantize_concat, along_f) {
|
|||||||
data("out_lo_2", get_mem(get_single_element_layout(p), -127)),
|
data("out_lo_2", get_mem(get_single_element_layout(p), -127)),
|
||||||
data("out_hi_2", get_mem(get_single_element_layout(p), 127)),
|
data("out_hi_2", get_mem(get_single_element_layout(p), 127)),
|
||||||
quantize("quant2", "resample2", "in_lo_2", "in_hi_2", "out_lo_2", "out_hi_2", 255, data_types::i8),
|
quantize("quant2", "resample2", "in_lo_2", "in_hi_2", "out_lo_2", "out_hi_2", 255, data_types::i8),
|
||||||
concatenation("concat", { "quant1", "quant2" }, cldnn::concatenation::along_f),
|
concatenation("concat", { "quant1", "quant2" }, 1),
|
||||||
reorder("reorder_bfyx", "concat", cldnn::format::bfyx, p.default_type)
|
reorder("reorder_bfyx", "concat", cldnn::format::bfyx, p.default_type)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ TEST_P(resample_scale_concat, along_f) {
|
|||||||
data("scale2_scale", get_mem(get_per_channel_layout(p), -10, 10)),
|
data("scale2_scale", get_mem(get_per_channel_layout(p), -10, 10)),
|
||||||
data("scale2_shift", get_mem(get_per_channel_layout(p), -10, 10)),
|
data("scale2_shift", get_mem(get_per_channel_layout(p), -10, 10)),
|
||||||
scale("scale2", "resample2", "scale2_scale", "scale2_shift"),
|
scale("scale2", "resample2", "scale2_scale", "scale2_shift"),
|
||||||
concatenation("concat", { "scale1", "scale2" }, cldnn::concatenation::along_f),
|
concatenation("concat", { "scale1", "scale2" }, 1),
|
||||||
reorder("reorder_bfyx", "concat", cldnn::format::bfyx, p.default_type)
|
reorder("reorder_bfyx", "concat", cldnn::format::bfyx, p.default_type)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ TEST(basic, test1) {
|
|||||||
topology.add(reshape("reshape1", "weights1", tensor(spatial(1, 2))));
|
topology.add(reshape("reshape1", "weights1", tensor(spatial(1, 2))));
|
||||||
topology.add(reorder("reorder2", "input", layout(data_types::f32, format::byxf, tensor(4))));
|
topology.add(reorder("reorder2", "input", layout(data_types::f32, format::byxf, tensor(4))));
|
||||||
topology.add(reorder("reorder1", "reshape1", layout(data_types::f32, format::byxf, tensor(4))));
|
topology.add(reorder("reorder1", "reshape1", layout(data_types::f32, format::byxf, tensor(4))));
|
||||||
topology.add(concatenation("concat", { "reorder1", "weights2" }, concatenation::along_x));
|
topology.add(concatenation("concat", { "reorder1", "weights2" }, 3));
|
||||||
topology.add(convolution("conv2", { "reorder2" }, { "concat" }));
|
topology.add(convolution("conv2", { "reorder2" }, { "concat" }));
|
||||||
|
|
||||||
program::ptr prog = program::build_program(engine, topology, build_opt, false);
|
program::ptr prog = program::build_program(engine, topology, build_opt, false);
|
||||||
|
@ -44,7 +44,7 @@ TEST(add_reorders_gpu, two_convolutions_and_concatenation) {
|
|||||||
topology.add(cldnn::reorder("reorder", "input", cldnn::layout(data_types::f32, format::byxf, tensor(4))));
|
topology.add(cldnn::reorder("reorder", "input", cldnn::layout(data_types::f32, format::byxf, tensor(4))));
|
||||||
topology.add(cldnn::convolution("conv2", { "reorder" }, { "weights2" }));
|
topology.add(cldnn::convolution("conv2", { "reorder" }, { "weights2" }));
|
||||||
|
|
||||||
topology.add(cldnn::concatenation("concat", { "conv1", "conv2" }, cldnn::concatenation::along_f));
|
topology.add(cldnn::concatenation("concat", { "conv1", "conv2" }, 1));
|
||||||
|
|
||||||
network network(engine, topology, build_opt);
|
network network(engine, topology, build_opt);
|
||||||
network.set_input_data("input", input);
|
network.set_input_data("input", input);
|
||||||
|
@ -35,13 +35,13 @@ TEST(DISABLED_oooq_test, simple)
|
|||||||
tpl.add(reorder("r4", "r2", input_mem->get_layout(), std::vector<float>{ 4 }));
|
tpl.add(reorder("r4", "r2", input_mem->get_layout(), std::vector<float>{ 4 }));
|
||||||
tpl.add(reorder("r5", "r4", input_mem->get_layout(), std::vector<float>{ 5 }));
|
tpl.add(reorder("r5", "r4", input_mem->get_layout(), std::vector<float>{ 5 }));
|
||||||
|
|
||||||
tpl.add(concatenation("c6", { "r3", "r5" }, concatenation::along_x));
|
tpl.add(concatenation("c6", { "r3", "r5" }, 3));
|
||||||
layout concat_lay = input_mem->get_layout();
|
layout concat_lay = input_mem->get_layout();
|
||||||
concat_lay.size.spatial[0] *= 2;
|
concat_lay.size.spatial[0] *= 2;
|
||||||
|
|
||||||
tpl.add(reorder("r7", "c6", concat_lay, std::vector<float>{ 7 }));
|
tpl.add(reorder("r7", "c6", concat_lay, std::vector<float>{ 7 }));
|
||||||
tpl.add(reorder("r8", "c6", concat_lay, std::vector<float>{ 8 }));
|
tpl.add(reorder("r8", "c6", concat_lay, std::vector<float>{ 8 }));
|
||||||
tpl.add(concatenation("c9", { "r7", "r8" }, concatenation::along_y));
|
tpl.add(concatenation("c9", { "r7", "r8" }, 2));
|
||||||
concat_lay.size.spatial[1] *= 2;
|
concat_lay.size.spatial[1] *= 2;
|
||||||
|
|
||||||
build_options options;
|
build_options options;
|
||||||
|
@ -61,7 +61,7 @@ TEST(concat_gpu, mixed_input_types) {
|
|||||||
input_layout("input4", input4->get_layout()),
|
input_layout("input4", input4->get_layout()),
|
||||||
concatenation("concat",
|
concatenation("concat",
|
||||||
{ "input0", "input1", "input2", "input3", "input4" },
|
{ "input0", "input1", "input2", "input3", "input4" },
|
||||||
concatenation::concatenation_axis::along_f,
|
1,
|
||||||
data_types::f32,
|
data_types::f32,
|
||||||
"",
|
"",
|
||||||
padding{ { 0,0,0,0 }, 0 })
|
padding{ { 0,0,0,0 }, 0 })
|
||||||
@ -135,7 +135,7 @@ TEST(concat_gpu, mixed_input_types_5d) {
|
|||||||
input_layout("input3", input3->get_layout()),
|
input_layout("input3", input3->get_layout()),
|
||||||
concatenation("concat",
|
concatenation("concat",
|
||||||
{ "input0", "input1", "input2", "input3" },
|
{ "input0", "input1", "input2", "input3" },
|
||||||
concatenation::concatenation_axis::along_f,
|
1,
|
||||||
data_types::f32,
|
data_types::f32,
|
||||||
"",
|
"",
|
||||||
padding{ { 0,0,0,0 }, 0 })
|
padding{ { 0,0,0,0 }, 0 })
|
||||||
@ -210,7 +210,7 @@ TEST(concat_gpu, i8_optimization_with_pool) {
|
|||||||
pooling("pool1", "input1", 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}),
|
||||||
concatenation("concat",
|
concatenation("concat",
|
||||||
{"pool0", "pool1"},
|
{"pool0", "pool1"},
|
||||||
concatenation::concatenation_axis::along_f,
|
1,
|
||||||
data_types::i8,
|
data_types::i8,
|
||||||
"",
|
"",
|
||||||
padding{{0, 0, 0, 0}, 0}),
|
padding{{0, 0, 0, 0}, 0}),
|
||||||
@ -311,7 +311,7 @@ TEST(concat_gpu, i8_optimization_with_conv) {
|
|||||||
input_layout("input2", input2->get_layout()),
|
input_layout("input2", input2->get_layout()),
|
||||||
concatenation("concat",
|
concatenation("concat",
|
||||||
{"input0", "input1", "input2"},
|
{"input0", "input1", "input2"},
|
||||||
concatenation::concatenation_axis::along_f,
|
1,
|
||||||
data_types::i8,
|
data_types::i8,
|
||||||
"",
|
"",
|
||||||
padding{{0, 0, 0, 0}, 0}),
|
padding{{0, 0, 0, 0}, 0}),
|
||||||
@ -413,7 +413,7 @@ TEST(concat_gpu, i8_optimization_with_pool_conv) {
|
|||||||
pooling("pool1", "input1", 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}),
|
||||||
concatenation("concat",
|
concatenation("concat",
|
||||||
{"pool0", "pool1"},
|
{"pool0", "pool1"},
|
||||||
concatenation::concatenation_axis::along_f,
|
1,
|
||||||
data_types::i8,
|
data_types::i8,
|
||||||
"",
|
"",
|
||||||
padding{{0, 0, 0, 0}, 0}),
|
padding{{0, 0, 0, 0}, 0}),
|
||||||
@ -572,7 +572,7 @@ public:
|
|||||||
input_ids.push_back("input" + std::to_string(i));
|
input_ids.push_back("input" + std::to_string(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
topology.add(concatenation("concat", input_ids, concatenation::concatenation_axis::along_f));
|
topology.add(concatenation("concat", input_ids, 1));
|
||||||
|
|
||||||
build_options options;
|
build_options options;
|
||||||
options.set_option(build_option::optimize_data(true));
|
options.set_option(build_option::optimize_data(true));
|
||||||
@ -696,7 +696,7 @@ public:
|
|||||||
input_ids.push_back("input" + std::to_string(i));
|
input_ids.push_back("input" + std::to_string(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
topology.add(concatenation("concat", input_ids, concatenation::concatenation_axis::along_f));
|
topology.add(concatenation("concat", input_ids, 1));
|
||||||
// Add identity convolution
|
// Add identity convolution
|
||||||
auto weights_lay = cldnn::layout(data_type, cldnn::format::bfyx, tensor(batch(output_f), feature(output_f)));
|
auto weights_lay = cldnn::layout(data_type, cldnn::format::bfyx, tensor(batch(output_f), feature(output_f)));
|
||||||
auto weights_mem = engine.allocate_memory(weights_lay);
|
auto weights_mem = engine.allocate_memory(weights_lay);
|
||||||
@ -836,7 +836,7 @@ public:
|
|||||||
pooling_ids.push_back("pool" + std::to_string(i));
|
pooling_ids.push_back("pool" + std::to_string(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
topology.add(concatenation("concat", pooling_ids, concatenation::concatenation_axis::along_f));
|
topology.add(concatenation("concat", pooling_ids, 1));
|
||||||
auto weights_lay = cldnn::layout(data_type, cldnn::format::bfyx, tensor(batch(output_f), feature(output_f)));
|
auto weights_lay = cldnn::layout(data_type, cldnn::format::bfyx, tensor(batch(output_f), feature(output_f)));
|
||||||
auto weights_mem = engine.allocate_memory(weights_lay);
|
auto weights_mem = engine.allocate_memory(weights_lay);
|
||||||
weights_mem->fill(get_test_stream());
|
weights_mem->fill(get_test_stream());
|
||||||
@ -962,7 +962,7 @@ TEST(concat_gpu_onednn, basic_input_types) {
|
|||||||
input_layout("input4", input4->get_layout()),
|
input_layout("input4", input4->get_layout()),
|
||||||
concatenation("concat",
|
concatenation("concat",
|
||||||
{ "input0", "input1", "input2", "input3", "input4" },
|
{ "input0", "input1", "input2", "input3", "input4" },
|
||||||
concatenation::concatenation_axis::along_f,
|
1,
|
||||||
data_types::f32,
|
data_types::f32,
|
||||||
"",
|
"",
|
||||||
padding{ { 0,0,0,0 }, 0 })
|
padding{ { 0,0,0,0 }, 0 })
|
||||||
@ -1055,7 +1055,7 @@ public:
|
|||||||
pooling_ids.push_back("pool" + std::to_string(i));
|
pooling_ids.push_back("pool" + std::to_string(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
topology.add(concatenation("concat", pooling_ids, concatenation::concatenation_axis::along_f));
|
topology.add(concatenation("concat", pooling_ids, 1));
|
||||||
auto weights_lay = cldnn::layout(data_type, cldnn::format::bfyx, tensor(batch(output_f), feature(output_f)));
|
auto weights_lay = cldnn::layout(data_type, cldnn::format::bfyx, tensor(batch(output_f), feature(output_f)));
|
||||||
auto weights_mem = engine.allocate_memory(weights_lay);
|
auto weights_mem = engine.allocate_memory(weights_lay);
|
||||||
weights_mem->fill(get_test_stream());
|
weights_mem->fill(get_test_stream());
|
||||||
|
@ -118,7 +118,7 @@ TEST(DISABLED_condition_gpu, basic_range_equal_comp) {
|
|||||||
input_layout("compare", compare->get_layout())
|
input_layout("compare", compare->get_layout())
|
||||||
);
|
);
|
||||||
topology.add(
|
topology.add(
|
||||||
concatenation("concat", { "input0", "input1" }, concatenation::along_x)
|
concatenation("concat", { "input0", "input1" }, 3)
|
||||||
);
|
);
|
||||||
topology.add(
|
topology.add(
|
||||||
condition("condi", "concat", branch_true, branch_false, "compare", cond_functions::EQUAL)
|
condition("condi", "concat", branch_true, branch_false, "compare", cond_functions::EQUAL)
|
||||||
|
@ -5280,7 +5280,7 @@ TEST_P(convolution_gpu_fs_byx_fsv32_crop, fs_byx_fsv32_crop)
|
|||||||
|
|
||||||
|
|
||||||
topology.add(reorder("reorder", "conv_fsv", { data_types::f16, format::bfyx, input_size }));
|
topology.add(reorder("reorder", "conv_fsv", { data_types::f16, format::bfyx, input_size }));
|
||||||
topology.add(concatenation("concat", { "left_crop", "reorder" }, concatenation::concatenation_axis::along_f));
|
topology.add(concatenation("concat", { "left_crop", "reorder" }, 1));
|
||||||
|
|
||||||
auto ref_result = VVVVF<FLOAT16>(batch_num);
|
auto ref_result = VVVVF<FLOAT16>(batch_num);
|
||||||
// concatenate half ref input and ref conv output, by features
|
// concatenate half ref input and ref conv output, by features
|
||||||
|
@ -65,7 +65,7 @@ TEST(depth_concatenate_f32_gpu, test01) {
|
|||||||
topology topology;
|
topology topology;
|
||||||
topology.add(input_layout("input1", input1->get_layout()));
|
topology.add(input_layout("input1", input1->get_layout()));
|
||||||
topology.add(input_layout("input2", input2->get_layout()));
|
topology.add(input_layout("input2", input2->get_layout()));
|
||||||
topology.add(concatenation("depth1", {"input1", "input2"}, concatenation::along_f));
|
topology.add(concatenation("depth1", {"input1", "input2"}, 1));
|
||||||
|
|
||||||
network network(engine, topology);
|
network network(engine, topology);
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ void concat_basic_with_reorder() {
|
|||||||
topology.add(input_layout("input2", input2->get_layout()));
|
topology.add(input_layout("input2", input2->get_layout()));
|
||||||
topology.add(reorder("to_int1", "input1", {DType, format::yxfb, {2, 2, 1, 1}}));
|
topology.add(reorder("to_int1", "input1", {DType, format::yxfb, {2, 2, 1, 1}}));
|
||||||
topology.add(reorder("to_int2", "input2", {DType, format::yxfb, {2, 3, 1, 1}}));
|
topology.add(reorder("to_int2", "input2", {DType, format::yxfb, {2, 3, 1, 1}}));
|
||||||
topology.add(concatenation("depth1", {"to_int1", "to_int2"}, concatenation::along_f));
|
topology.add(concatenation("depth1", {"to_int1", "to_int2"}, 1));
|
||||||
topology.add(reorder("to_float", "depth1", {data_types::f32, format::yxfb, {2, 5, 1, 1}}));
|
topology.add(reorder("to_float", "depth1", {data_types::f32, format::yxfb, {2, 5, 1, 1}}));
|
||||||
|
|
||||||
network network(engine, topology);
|
network network(engine, topology);
|
||||||
@ -203,7 +203,7 @@ TEST(depth_concatenate_f32_gpu, test02) {
|
|||||||
topology.add(input_layout("input1", input1->get_layout()));
|
topology.add(input_layout("input1", input1->get_layout()));
|
||||||
topology.add(input_layout("input2", input2->get_layout()));
|
topology.add(input_layout("input2", input2->get_layout()));
|
||||||
topology.add(input_layout("input3", input3->get_layout()));
|
topology.add(input_layout("input3", input3->get_layout()));
|
||||||
topology.add(concatenation("depth1", {"input1", "input2", "input3"}, concatenation::along_f));
|
topology.add(concatenation("depth1", {"input1", "input2", "input3"}, 1));
|
||||||
|
|
||||||
network network(engine, topology);
|
network network(engine, topology);
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ TEST(concatenate_f32_gpu, test_concatenation_of_pool_and_unpool) {
|
|||||||
{1, 1, 1, 1} /*stride*/
|
{1, 1, 1, 1} /*stride*/
|
||||||
));
|
));
|
||||||
topology.add(resample("unpool1", "input1", tensor(1, 1, 2, 2), 0, resample_type::nearest));
|
topology.add(resample("unpool1", "input1", tensor(1, 1, 2, 2), 0, resample_type::nearest));
|
||||||
topology.add(concatenation("concat1", {"pool1", "unpool1"}, cldnn::concatenation::along_x));
|
topology.add(concatenation("concat1", {"pool1", "unpool1"}, 3));
|
||||||
topology.add(data("weights", weights));
|
topology.add(data("weights", weights));
|
||||||
topology.add(convolution("conv", "concat1", {"weights"}));
|
topology.add(convolution("conv", "concat1", {"weights"}));
|
||||||
|
|
||||||
@ -283,11 +283,11 @@ TEST(depth_concatenate_f32_gpu, test03_cascade_concat_opt) {
|
|||||||
topology.add(input_layout("input1", input1->get_layout()));
|
topology.add(input_layout("input1", input1->get_layout()));
|
||||||
topology.add(activation("relu1", "input1", activation_func::relu));
|
topology.add(activation("relu1", "input1", activation_func::relu));
|
||||||
topology.add(activation("relu2", "relu1", activation_func::sqrt));
|
topology.add(activation("relu2", "relu1", activation_func::sqrt));
|
||||||
topology.add(concatenation("depth1", {"relu2", "relu1"}, concatenation::along_f));
|
topology.add(concatenation("depth1", {"relu2", "relu1"}, 1));
|
||||||
topology.add(activation("relu3", "depth1", activation_func::sqrt));
|
topology.add(activation("relu3", "depth1", activation_func::sqrt));
|
||||||
topology.add(concatenation("depth2", {"relu3", "depth1"}, concatenation::along_f));
|
topology.add(concatenation("depth2", {"relu3", "depth1"}, 1));
|
||||||
topology.add(activation("relu4", "depth2", activation_func::sqrt));
|
topology.add(activation("relu4", "depth2", activation_func::sqrt));
|
||||||
topology.add(concatenation("depth3", {"relu4", "depth2"}, concatenation::along_f));
|
topology.add(concatenation("depth3", {"relu4", "depth2"}, 1));
|
||||||
topology.add(activation("relu5", "depth3", activation_func::relu));
|
topology.add(activation("relu5", "depth3", activation_func::relu));
|
||||||
|
|
||||||
cldnn::build_options options;
|
cldnn::build_options options;
|
||||||
@ -339,7 +339,7 @@ TEST(depth_concatenate_f32_gpu, test04_fused_relu) {
|
|||||||
topology topology;
|
topology topology;
|
||||||
topology.add(input_layout("input1", input1->get_layout()));
|
topology.add(input_layout("input1", input1->get_layout()));
|
||||||
topology.add(input_layout("input2", input2->get_layout()));
|
topology.add(input_layout("input2", input2->get_layout()));
|
||||||
topology.add(concatenation("depth1", {"input1", "input2"}, concatenation::along_f));
|
topology.add(concatenation("depth1", {"input1", "input2"}, 1));
|
||||||
topology.add(activation("relu1", "depth1", activation_func::relu));
|
topology.add(activation("relu1", "depth1", activation_func::relu));
|
||||||
|
|
||||||
cldnn::build_options options;
|
cldnn::build_options options;
|
||||||
@ -393,7 +393,7 @@ TEST(depth_concatenate_f32_gpu, test05_different_formats) {
|
|||||||
topology.add(input_layout("input2", input2->get_layout()));
|
topology.add(input_layout("input2", input2->get_layout()));
|
||||||
topology.add(reshape("reshape1", "input1", {1, 3, 2, 2}));
|
topology.add(reshape("reshape1", "input1", {1, 3, 2, 2}));
|
||||||
topology.add(reshape("reshape2", "input2", {1, 3, 2, 2}));
|
topology.add(reshape("reshape2", "input2", {1, 3, 2, 2}));
|
||||||
topology.add(concatenation("depth1", {"reshape1", "reshape2"}, concatenation::along_f));
|
topology.add(concatenation("depth1", {"reshape1", "reshape2"}, 1));
|
||||||
topology.add(reorder("output", "depth1", format::bfyx, data_types::f32));
|
topology.add(reorder("output", "depth1", format::bfyx, data_types::f32));
|
||||||
|
|
||||||
cldnn::build_options options;
|
cldnn::build_options options;
|
||||||
@ -451,8 +451,8 @@ TEST(depth_concatenate_f32_gpu, test06_padded_input) {
|
|||||||
topology.add(activation("actv2", "input2", activation_func::linear, { 0.5f, 0.0f }));
|
topology.add(activation("actv2", "input2", activation_func::linear, { 0.5f, 0.0f }));
|
||||||
topology.add(data("weights", weights));
|
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" }, tensor(1), tensor(batch(0), feature(0), spatial(1, 1, 0, 0))));
|
||||||
topology.add(concatenation("depth1", { "actv1", "actv2" }, concatenation::along_f));
|
topology.add(concatenation("depth1", { "actv1", "actv2" }, 1));
|
||||||
topology.add(concatenation("depth2", { "depth1", "conv" }, concatenation::along_f));
|
topology.add(concatenation("depth2", { "depth1", "conv" }, 1));
|
||||||
topology.add(reorder("output", "depth2", format::bfyx, data_types::f32));
|
topology.add(reorder("output", "depth2", format::bfyx, data_types::f32));
|
||||||
|
|
||||||
cldnn::build_options options;
|
cldnn::build_options options;
|
||||||
@ -526,7 +526,7 @@ TEST(depth_concatenate_f32_gpu, test07_padded_output) {
|
|||||||
topology.add(input_layout("input2", input2->get_layout()));
|
topology.add(input_layout("input2", input2->get_layout()));
|
||||||
topology.add(activation("actv1", "input1", activation_func::linear, { 0.75f, 0.0f }));
|
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(activation("actv2", "input2", activation_func::linear, { 0.5f, 0.0f }));
|
||||||
topology.add(concatenation("depth1", { "actv1", "actv2" }, concatenation::along_f));
|
topology.add(concatenation("depth1", { "actv1", "actv2" }, 1));
|
||||||
topology.add(data("weights", weights));
|
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" }, tensor(1), tensor(batch(0), feature(0), spatial(1, 1, 0, 0))));
|
||||||
topology.add(reorder("output", "conv", format::bfyx, data_types::f32));
|
topology.add(reorder("output", "conv", format::bfyx, data_types::f32));
|
||||||
@ -589,7 +589,7 @@ TEST(depth_concatenate_f32_gpu, test07_concat_is_output) {
|
|||||||
topology.add(input_layout("input2", input2->get_layout()));
|
topology.add(input_layout("input2", input2->get_layout()));
|
||||||
topology.add(activation("actv1", "input1", activation_func::linear, { 0.75f, 0.0f }));
|
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(activation("actv2", "input2", activation_func::linear, { 0.5f, 0.0f }));
|
||||||
topology.add(concatenation("depth1", { "actv1", "actv2" }, concatenation::along_f));
|
topology.add(concatenation("depth1", { "actv1", "actv2" }, 1));
|
||||||
|
|
||||||
cldnn::build_options options;
|
cldnn::build_options options;
|
||||||
options.set_option(cldnn::build_option::optimize_data(true));
|
options.set_option(cldnn::build_option::optimize_data(true));
|
||||||
@ -650,12 +650,12 @@ TEST(depth_concatenate_f32_gpu, concat_with_different_format_inputs) {
|
|||||||
topology topology;
|
topology topology;
|
||||||
topology.add(input_layout("input1", input1->get_layout()));
|
topology.add(input_layout("input1", input1->get_layout()));
|
||||||
topology.add(input_layout("input2", input2->get_layout()));
|
topology.add(input_layout("input2", input2->get_layout()));
|
||||||
topology.add(concatenation("depth1", { "input1" }, concatenation::along_f));
|
topology.add(concatenation("depth1", { "input1" }, 1));
|
||||||
topology.add(concatenation("depth2", { "input2" }, concatenation::along_f));
|
topology.add(concatenation("depth2", { "input2" }, 1));
|
||||||
// In the step below there will be run of buffer fusing optimization for concatenation with
|
// In the step below there will be run of buffer fusing optimization for concatenation with
|
||||||
// Input1 YXFB, Input2 BFYX and Output YXFB
|
// Input1 YXFB, Input2 BFYX and Output YXFB
|
||||||
topology.add(concatenation("depth3", { "depth1", "depth2" }, concatenation::along_f));
|
topology.add(concatenation("depth3", { "depth1", "depth2" }, 1));
|
||||||
topology.add(concatenation("depth4", { "depth3" }, concatenation::along_f));
|
topology.add(concatenation("depth4", { "depth3" }, 1));
|
||||||
|
|
||||||
build_opt.set_option(build_option::optimize_data(true));
|
build_opt.set_option(build_option::optimize_data(true));
|
||||||
network network(engine, topology, build_opt);
|
network network(engine, topology, build_opt);
|
||||||
@ -720,8 +720,8 @@ TEST(depth_concatenate_f32_gpu, concat_with_reshape_input) {
|
|||||||
topology topology;
|
topology topology;
|
||||||
topology.add(input_layout("input1", input1->get_layout()));
|
topology.add(input_layout("input1", input1->get_layout()));
|
||||||
topology.add(reshape("reshape", "input1", tensor(2, 1, 4, 2)));
|
topology.add(reshape("reshape", "input1", tensor(2, 1, 4, 2)));
|
||||||
topology.add(concatenation("depth1", { "reshape" }, concatenation::along_f));
|
topology.add(concatenation("depth1", { "reshape" }, 1));
|
||||||
topology.add(concatenation("depth2", { "depth1" }, concatenation::along_f));
|
topology.add(concatenation("depth2", { "depth1" }, 1));
|
||||||
|
|
||||||
build_opt.set_option(build_option::optimize_data(true));
|
build_opt.set_option(build_option::optimize_data(true));
|
||||||
network network(engine, topology, build_opt);
|
network network(engine, topology, build_opt);
|
||||||
@ -750,9 +750,9 @@ TEST(depth_concatenate_i32_gpu, optimize_data01) {
|
|||||||
topology topology;
|
topology topology;
|
||||||
topology.add(
|
topology.add(
|
||||||
input_layout("input", input->get_layout()));
|
input_layout("input", input->get_layout()));
|
||||||
topology.add(cldnn::concatenation("int1", {"input"}, cldnn::concatenation::along_f));
|
topology.add(cldnn::concatenation("int1", {"input"}, 1));
|
||||||
topology.add(cldnn::concatenation("result1", {"int1"}, cldnn::concatenation::along_f));
|
topology.add(cldnn::concatenation("result1", {"int1"}, 1));
|
||||||
topology.add(cldnn::concatenation("result2", {"int1"}, cldnn::concatenation::along_f));
|
topology.add(cldnn::concatenation("result2", {"int1"}, 1));
|
||||||
|
|
||||||
std::vector<int> input_data = {4};
|
std::vector<int> input_data = {4};
|
||||||
std::vector<int> out_data = {4};
|
std::vector<int> out_data = {4};
|
||||||
@ -787,14 +787,14 @@ TEST(depth_concatenate_i32_gpu, optimize_data02) {
|
|||||||
topology.add(
|
topology.add(
|
||||||
input_layout("input4", input4->get_layout()));
|
input_layout("input4", input4->get_layout()));
|
||||||
|
|
||||||
topology.add(cldnn::concatenation("concat1", {"input1", "input2"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat1", {"input1", "input2"}, 3));
|
||||||
topology.add(cldnn::concatenation("concat2", {"input3", "input4"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat2", {"input3", "input4"}, 3));
|
||||||
topology.add(cldnn::concatenation("concat3", {"input2", "input4"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat3", {"input2", "input4"}, 3));
|
||||||
|
|
||||||
topology.add(cldnn::concatenation("concat4", {"concat1", "concat2"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat4", {"concat1", "concat2"}, 3));
|
||||||
topology.add(cldnn::concatenation("concat5", {"concat2", "concat3"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat5", {"concat2", "concat3"}, 3));
|
||||||
|
|
||||||
topology.add(cldnn::concatenation("concat6", {"concat4", "concat5"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat6", {"concat4", "concat5"}, 3));
|
||||||
|
|
||||||
std::vector<int> input_data1 =
|
std::vector<int> input_data1 =
|
||||||
{1, 2,
|
{1, 2,
|
||||||
@ -845,12 +845,12 @@ TEST(depth_concatenate_i32_gpu, optimize_data03) {
|
|||||||
topology.add(
|
topology.add(
|
||||||
input_layout("input1", input1->get_layout()));
|
input_layout("input1", input1->get_layout()));
|
||||||
|
|
||||||
topology.add(cldnn::concatenation("concat1", {"input1"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat1", {"input1"}, 3));
|
||||||
|
|
||||||
topology.add(cldnn::concatenation("concat2", {"concat1"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat2", {"concat1"}, 3));
|
||||||
topology.add(cldnn::concatenation("concat3", {"concat1"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat3", {"concat1"}, 3));
|
||||||
|
|
||||||
topology.add(cldnn::concatenation("concat4", {"concat3"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat4", {"concat3"}, 3));
|
||||||
|
|
||||||
std::vector<int> input_data1 =
|
std::vector<int> input_data1 =
|
||||||
{1, 2,
|
{1, 2,
|
||||||
@ -885,12 +885,12 @@ TEST(depth_concatenate_i32_gpu, optimize_data04) {
|
|||||||
topology.add(
|
topology.add(
|
||||||
input_layout("input1", input1->get_layout()));
|
input_layout("input1", input1->get_layout()));
|
||||||
|
|
||||||
topology.add(cldnn::concatenation("concat1", {"input1"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat1", {"input1"}, 3));
|
||||||
|
|
||||||
topology.add(cldnn::concatenation("concat2", {"concat1"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat2", {"concat1"}, 3));
|
||||||
topology.add(cldnn::concatenation("concat3", {"concat1"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat3", {"concat1"}, 3));
|
||||||
|
|
||||||
topology.add(cldnn::concatenation("concat4", {"concat2", "concat3"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat4", {"concat2", "concat3"}, 3));
|
||||||
|
|
||||||
std::vector<int> input_data1 =
|
std::vector<int> input_data1 =
|
||||||
{1, 2,
|
{1, 2,
|
||||||
@ -925,13 +925,13 @@ TEST(depth_concatenate_i32_gpu, optimize_data05) {
|
|||||||
topology.add(
|
topology.add(
|
||||||
input_layout("input1", input1->get_layout()));
|
input_layout("input1", input1->get_layout()));
|
||||||
|
|
||||||
topology.add(cldnn::concatenation("concat1", {"input1"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat1", {"input1"}, 3));
|
||||||
|
|
||||||
topology.add(cldnn::concatenation("concat2", {"concat1"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat2", {"concat1"}, 3));
|
||||||
topology.add(cldnn::concatenation("concat3", {"concat1"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat3", {"concat1"}, 3));
|
||||||
|
|
||||||
topology.add(cldnn::concatenation("concat4", {"concat2", "concat3"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat4", {"concat2", "concat3"}, 3));
|
||||||
topology.add(cldnn::concatenation("concat5", {"concat1", "concat4"}, cldnn::concatenation::along_x));
|
topology.add(cldnn::concatenation("concat5", {"concat1", "concat4"}, 3));
|
||||||
|
|
||||||
std::vector<int> input_data1 =
|
std::vector<int> input_data1 =
|
||||||
{1, 2,
|
{1, 2,
|
||||||
@ -971,7 +971,7 @@ TEST(depth_concatenate_f32_gpu, basic_bfwzyx_along_w) {
|
|||||||
|
|
||||||
topology topology;
|
topology topology;
|
||||||
topology.add(input_layout("input1", input1->get_layout()));
|
topology.add(input_layout("input1", input1->get_layout()));
|
||||||
topology.add(concatenation("concat", {"input1", "input1"}, concatenation::along_w));
|
topology.add(concatenation("concat", {"input1", "input1"}, 2));
|
||||||
|
|
||||||
auto input_data = generate_random_1d<float>(input1->count(), -1, 1);
|
auto input_data = generate_random_1d<float>(input1->count(), -1, 1);
|
||||||
|
|
||||||
@ -1032,7 +1032,7 @@ static network::ptr setup_depth_concatatenate_network(const std::vector<data_typ
|
|||||||
topology.add(input_layout(input_names[i], input->get_layout()));
|
topology.add(input_layout(input_names[i], input->get_layout()));
|
||||||
}
|
}
|
||||||
//TODO: ask Uzi if something tests cases where there's missing input_names (nodes not present in the topology, etc.)
|
//TODO: ask Uzi if something tests cases where there's missing input_names (nodes not present in the topology, etc.)
|
||||||
topology.add(concatenation("depth_concat_node", input_names, concatenation::along_f));
|
topology.add(concatenation("depth_concat_node", input_names, 1));
|
||||||
|
|
||||||
return network::build_network(engine, topology);
|
return network::build_network(engine, topology);
|
||||||
}
|
}
|
||||||
@ -1086,13 +1086,13 @@ public:
|
|||||||
|
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 1:
|
case 1:
|
||||||
all_layer_params.emplace_back(new concatenation("depth_concatenate", {"input0"}, concatenation::along_f));
|
all_layer_params.emplace_back(new concatenation("depth_concatenate", {"input0"}, 1));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
all_layer_params.emplace_back(new concatenation("depth_concatenate", {"input0", "input1"}, concatenation::along_f));
|
all_layer_params.emplace_back(new concatenation("depth_concatenate", {"input0", "input1"}, 1));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
all_layer_params.emplace_back(new concatenation("depth_concatenate", {"input0", "input1", "input2"}, concatenation::along_f));
|
all_layer_params.emplace_back(new concatenation("depth_concatenate", {"input0", "input1", "input2"}, 1));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
|
@ -390,7 +390,7 @@ void generate_lstm_topology(topology& t, memory::ptr input, memory::ptr hidden,
|
|||||||
}
|
}
|
||||||
output_ids_offsets.push_back(hiddenStr);
|
output_ids_offsets.push_back(hiddenStr);
|
||||||
}
|
}
|
||||||
t.add(concatenation("concatenation", output_ids_offsets, concatenation::along_f));
|
t.add(concatenation("concatenation", output_ids_offsets, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@ -1056,7 +1056,7 @@ void lstm_gpu_users_test() {
|
|||||||
{ activation_func::logistic, activation_func::hyperbolic_tan, activation_func::hyperbolic_tan }, {},
|
{ activation_func::logistic, activation_func::hyperbolic_tan, activation_func::hyperbolic_tan }, {},
|
||||||
lstm_output_selection::hidden, default_offset_type));
|
lstm_output_selection::hidden, default_offset_type));
|
||||||
std::vector<primitive_id> output_ids_offsets {"lstm", "hidden"};
|
std::vector<primitive_id> output_ids_offsets {"lstm", "hidden"};
|
||||||
topology.add(concatenation("concatenation", output_ids_offsets, concatenation::along_f));
|
topology.add(concatenation("concatenation", output_ids_offsets, 1));
|
||||||
|
|
||||||
network network(engine, topology);
|
network network(engine, topology);
|
||||||
std::map<primitive_id, network_output> outputs;
|
std::map<primitive_id, network_output> outputs;
|
||||||
|
@ -178,10 +178,10 @@ TEST(memory_pool, oooq) {
|
|||||||
topology.add(activation("relu1", "input", activation_func::relu));
|
topology.add(activation("relu1", "input", activation_func::relu));
|
||||||
topology.add(activation("relu2", "input", activation_func::relu));
|
topology.add(activation("relu2", "input", activation_func::relu));
|
||||||
topology.add(activation("relu3", "input", activation_func::relu));
|
topology.add(activation("relu3", "input", activation_func::relu));
|
||||||
topology.add(concatenation("concat1", { "relu1", "relu2" },concatenation::along_f));
|
topology.add(concatenation("concat1", { "relu1", "relu2" }, 1));
|
||||||
topology.add(activation("relu4", "concat1", activation_func::relu));
|
topology.add(activation("relu4", "concat1", activation_func::relu));
|
||||||
topology.add(activation("relu5", "relu3", activation_func::relu));
|
topology.add(activation("relu5", "relu3", activation_func::relu));
|
||||||
topology.add(concatenation("concat2", { "relu4", "relu5" }, concatenation::along_f));
|
topology.add(concatenation("concat2", { "relu4", "relu5" }, 1));
|
||||||
topology.add(activation("relu6", "concat2", activation_func::relu));
|
topology.add(activation("relu6", "concat2", activation_func::relu));
|
||||||
|
|
||||||
build_options bo;
|
build_options bo;
|
||||||
@ -223,10 +223,10 @@ TEST(memory_pool, DISABLED_shared_mem_pool_same_topology_twice) {
|
|||||||
topology.add(activation("relu1", "input", activation_func::relu));
|
topology.add(activation("relu1", "input", activation_func::relu));
|
||||||
topology.add(activation("relu2", "input", activation_func::sqrt));
|
topology.add(activation("relu2", "input", activation_func::sqrt));
|
||||||
topology.add(activation("relu3", "input", activation_func::square));
|
topology.add(activation("relu3", "input", activation_func::square));
|
||||||
topology.add(concatenation("concat1", { "relu1", "relu2" }, concatenation::along_f));
|
topology.add(concatenation("concat1", { "relu1", "relu2" }, 1));
|
||||||
topology.add(activation("relu4", "concat1", activation_func::relu));
|
topology.add(activation("relu4", "concat1", activation_func::relu));
|
||||||
topology.add(activation("relu5", "relu3", activation_func::relu));
|
topology.add(activation("relu5", "relu3", activation_func::relu));
|
||||||
topology.add(concatenation("concat2", { "relu4", "relu5" }, concatenation::along_f));
|
topology.add(concatenation("concat2", { "relu4", "relu5" }, 1));
|
||||||
topology.add(activation("relu6", "concat2", activation_func::linear, { 1.0f, 0.5f }));
|
topology.add(activation("relu6", "concat2", activation_func::linear, { 1.0f, 0.5f }));
|
||||||
|
|
||||||
build_options bo;
|
build_options bo;
|
||||||
@ -430,12 +430,12 @@ TEST(memory_pool, shared_dep_two_output) {
|
|||||||
auto result_1_0 = cldnn::concatenation(
|
auto result_1_0 = cldnn::concatenation(
|
||||||
"result_1_0",
|
"result_1_0",
|
||||||
{ constant_0_0 },
|
{ constant_0_0 },
|
||||||
cldnn::concatenation::along_b
|
0
|
||||||
);
|
);
|
||||||
auto result_2_0 = cldnn::concatenation(
|
auto result_2_0 = cldnn::concatenation(
|
||||||
"result_2_0",
|
"result_2_0",
|
||||||
{ constant_0_0 },
|
{ constant_0_0 },
|
||||||
cldnn::concatenation::along_b
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
//build and execute network
|
//build and execute network
|
||||||
@ -469,7 +469,7 @@ TEST(memory_pool, non_opt_intermidate_opt_after) {
|
|||||||
auto reshape_tensor = cldnn::tensor(8, 1, 1, 1);
|
auto reshape_tensor = cldnn::tensor(8, 1, 1, 1);
|
||||||
auto input = cldnn::input_layout("input1", input_layout1);
|
auto input = cldnn::input_layout("input1", input_layout1);
|
||||||
auto input2 = cldnn::input_layout("input2", input_layout2);
|
auto input2 = cldnn::input_layout("input2", input_layout2);
|
||||||
auto concat = cldnn::concatenation("concat", { "input1", "input2" }, cldnn::concatenation::along_b);
|
auto concat = cldnn::concatenation("concat", { "input1", "input2" }, 0);
|
||||||
auto reshape = cldnn::reshape("reshape", "concat", reshape_tensor);
|
auto reshape = cldnn::reshape("reshape", "concat", reshape_tensor);
|
||||||
auto crop1 = cldnn::crop("crop1", "reshape", { 1, 1, 1, 1 }, { 0, 0, 0, 0 });
|
auto crop1 = cldnn::crop("crop1", "reshape", { 1, 1, 1, 1 }, { 0, 0, 0, 0 });
|
||||||
auto crop2 = cldnn::crop("crop2", "reshape", { 1, 1, 1, 1 }, { 1, 0, 0, 0 });
|
auto crop2 = cldnn::crop("crop2", "reshape", { 1, 1, 1, 1 }, { 1, 0, 0, 0 });
|
||||||
|
@ -35,7 +35,7 @@ TEST(propagate_constants, copy_dependecies_from_nodes) {
|
|||||||
topology.add(reshape("reshape1", "weights1", tensor(spatial(1, 2))));
|
topology.add(reshape("reshape1", "weights1", tensor(spatial(1, 2))));
|
||||||
topology.add(reorder("reorder2", "input", layout(data_types::f32, format::byxf, tensor(4))));
|
topology.add(reorder("reorder2", "input", layout(data_types::f32, format::byxf, tensor(4))));
|
||||||
topology.add(reorder("reorder1", "reshape1", layout(data_types::f32, format::byxf, tensor(4))));
|
topology.add(reorder("reorder1", "reshape1", layout(data_types::f32, format::byxf, tensor(4))));
|
||||||
topology.add(concatenation("concat", { "reorder1", "weights2" }, concatenation::along_x));
|
topology.add(concatenation("concat", { "reorder1", "weights2" }, 3));
|
||||||
topology.add(convolution("conv2", { "reorder2" }, { "concat" }));
|
topology.add(convolution("conv2", { "reorder2" }, { "concat" }));
|
||||||
network network(engine, topology, build_opt);
|
network network(engine, topology, build_opt);
|
||||||
network.set_input_data("input", input);
|
network.set_input_data("input", input);
|
||||||
|
@ -311,8 +311,7 @@ TEST(set_output_memory_gpu, basic_opt) {
|
|||||||
topology.add(activation("clamp2", "input2", activation_func::clamp, params2));
|
topology.add(activation("clamp2", "input2", activation_func::clamp, params2));
|
||||||
topology.add(reshape("reshape1", "clamp1", ishape));
|
topology.add(reshape("reshape1", "clamp1", ishape));
|
||||||
topology.add(reshape("reshape2", "clamp2", ishape));
|
topology.add(reshape("reshape2", "clamp2", ishape));
|
||||||
topology.add(concatenation("concat", { "reshape1", "reshape2" },
|
topology.add(concatenation("concat", { "reshape1", "reshape2" }, 0, data_types::f32));
|
||||||
concatenation::concatenation_axis::along_b, data_types::f32));
|
|
||||||
topology.add(reshape("reshape3", "concat", oshape));
|
topology.add(reshape("reshape3", "concat", oshape));
|
||||||
topology.add(reorder("reorder", "reshape3", ol));
|
topology.add(reorder("reorder", "reshape3", ol));
|
||||||
topology.add(reorder("reorder2", "reorder", ol));
|
topology.add(reorder("reorder2", "reorder", ol));
|
||||||
|
@ -36,7 +36,7 @@ TEST(spatial_concatenate_f32_gpu, test01) {
|
|||||||
topology tpl;
|
topology tpl;
|
||||||
tpl.add(input_layout("in1", input1->get_layout()));
|
tpl.add(input_layout("in1", input1->get_layout()));
|
||||||
tpl.add(input_layout("in2", input2->get_layout()));
|
tpl.add(input_layout("in2", input2->get_layout()));
|
||||||
tpl.add(concatenation("conc", { "in1", "in2" }, concatenation::along_x));
|
tpl.add(concatenation("conc", { "in1", "in2" }, 3));
|
||||||
|
|
||||||
network net(engine, tpl);
|
network net(engine, tpl);
|
||||||
net.set_input_data("in1", input1);
|
net.set_input_data("in1", input1);
|
||||||
@ -91,7 +91,7 @@ TEST(spatial_concatenate_f32_gpu, test02) {
|
|||||||
topology tpl;
|
topology tpl;
|
||||||
tpl.add(input_layout("in1", input1->get_layout()));
|
tpl.add(input_layout("in1", input1->get_layout()));
|
||||||
tpl.add(input_layout("in2", input2->get_layout()));
|
tpl.add(input_layout("in2", input2->get_layout()));
|
||||||
tpl.add(concatenation("conc", { "in1", "in2" }, concatenation::along_y));
|
tpl.add(concatenation("conc", { "in1", "in2" }, 2));
|
||||||
|
|
||||||
network net(engine, tpl);
|
network net(engine, tpl);
|
||||||
net.set_input_data("in1", input1);
|
net.set_input_data("in1", input1);
|
||||||
@ -148,7 +148,7 @@ TEST(spatial_concatenate_f32_gpu, test03) {
|
|||||||
topology tpl;
|
topology tpl;
|
||||||
tpl.add(input_layout("in1", input1->get_layout()));
|
tpl.add(input_layout("in1", input1->get_layout()));
|
||||||
tpl.add(input_layout("in2", input2->get_layout()));
|
tpl.add(input_layout("in2", input2->get_layout()));
|
||||||
tpl.add(concatenation("conc", { "in1", "in2" }, concatenation::along_y, "", padding({ 0, 0, 1, 1 }, 0.0f)));
|
tpl.add(concatenation("conc", { "in1", "in2" }, 2, "", padding({ 0, 0, 1, 1 }, 0.0f)));
|
||||||
|
|
||||||
network net(engine, tpl);
|
network net(engine, tpl);
|
||||||
net.set_input_data("in1", input1);
|
net.set_input_data("in1", input1);
|
||||||
@ -203,7 +203,7 @@ TEST(spatial_concatenate_f32_gpu, test04) {
|
|||||||
topology tpl;
|
topology tpl;
|
||||||
tpl.add(input_layout("in1", input1->get_layout()));
|
tpl.add(input_layout("in1", input1->get_layout()));
|
||||||
tpl.add(input_layout("in2", input2->get_layout()));
|
tpl.add(input_layout("in2", input2->get_layout()));
|
||||||
tpl.add(concatenation("conc", { "in1", "in2" }, concatenation::along_x, "", padding({ 0, 0, 2, 0 }, { 0, 0, 0, 0 })));
|
tpl.add(concatenation("conc", { "in1", "in2" }, 3, "", padding({ 0, 0, 2, 0 }, { 0, 0, 0, 0 })));
|
||||||
|
|
||||||
network net(engine, tpl);
|
network net(engine, tpl);
|
||||||
net.set_input_data("in1", input1);
|
net.set_input_data("in1", input1);
|
||||||
@ -263,7 +263,7 @@ TEST(spatial_concatenate_f32_gpu, inputs_3) {
|
|||||||
tpl.add(input_layout("in1", input1->get_layout()));
|
tpl.add(input_layout("in1", input1->get_layout()));
|
||||||
tpl.add(input_layout("in2", input2->get_layout()));
|
tpl.add(input_layout("in2", input2->get_layout()));
|
||||||
tpl.add(input_layout("in3", input3->get_layout()));
|
tpl.add(input_layout("in3", input3->get_layout()));
|
||||||
tpl.add(concatenation("conc", { "in1", "in2", "in3" }, concatenation::along_x));
|
tpl.add(concatenation("conc", { "in1", "in2", "in3" }, 3));
|
||||||
|
|
||||||
network net(engine, tpl);
|
network net(engine, tpl);
|
||||||
net.set_input_data("in1", input1);
|
net.set_input_data("in1", input1);
|
||||||
@ -351,7 +351,7 @@ TEST(spatial_concatenate_f32_gpu, inputs_3_uneven_axis_b) {
|
|||||||
tpl.add(input_layout("in1", input1->get_layout()));
|
tpl.add(input_layout("in1", input1->get_layout()));
|
||||||
tpl.add(input_layout("in2", input2->get_layout()));
|
tpl.add(input_layout("in2", input2->get_layout()));
|
||||||
tpl.add(input_layout("in3", input3->get_layout()));
|
tpl.add(input_layout("in3", input3->get_layout()));
|
||||||
tpl.add(concatenation("conc", { "in1", "in2", "in3" }, concatenation::along_b));
|
tpl.add(concatenation("conc", { "in1", "in2", "in3" }, 0));
|
||||||
|
|
||||||
network net(engine, tpl);
|
network net(engine, tpl);
|
||||||
net.set_input_data("in1", input1);
|
net.set_input_data("in1", input1);
|
||||||
@ -411,7 +411,7 @@ TEST(spatial_concatenate_f32_gpu, inputs3d_axis_x) {
|
|||||||
topology tpl;
|
topology tpl;
|
||||||
tpl.add(input_layout("in1", input1->get_layout()));
|
tpl.add(input_layout("in1", input1->get_layout()));
|
||||||
tpl.add(input_layout("in2", input2->get_layout()));
|
tpl.add(input_layout("in2", input2->get_layout()));
|
||||||
tpl.add(concatenation("conc", { "in1", "in2" }, concatenation::along_x));
|
tpl.add(concatenation("conc", { "in1", "in2" }, 4));
|
||||||
|
|
||||||
network net(engine, tpl);
|
network net(engine, tpl);
|
||||||
net.set_input_data("in1", input1);
|
net.set_input_data("in1", input1);
|
||||||
@ -475,7 +475,7 @@ TEST(spatial_concatenate_f32_gpu, inputs3d_axis_y) {
|
|||||||
topology tpl;
|
topology tpl;
|
||||||
tpl.add(input_layout("in1", input1->get_layout()));
|
tpl.add(input_layout("in1", input1->get_layout()));
|
||||||
tpl.add(input_layout("in2", input2->get_layout()));
|
tpl.add(input_layout("in2", input2->get_layout()));
|
||||||
tpl.add(concatenation("conc", { "in1", "in2" }, concatenation::along_y));
|
tpl.add(concatenation("conc", { "in1", "in2" }, 3));
|
||||||
|
|
||||||
network net(engine, tpl);
|
network net(engine, tpl);
|
||||||
net.set_input_data("in1", input1);
|
net.set_input_data("in1", input1);
|
||||||
@ -539,7 +539,7 @@ TEST(spatial_concatenate_f32_gpu, inputs3d_axis_z) {
|
|||||||
topology tpl;
|
topology tpl;
|
||||||
tpl.add(input_layout("in1", input1->get_layout()));
|
tpl.add(input_layout("in1", input1->get_layout()));
|
||||||
tpl.add(input_layout("in2", input2->get_layout()));
|
tpl.add(input_layout("in2", input2->get_layout()));
|
||||||
tpl.add(concatenation("conc", { "in1", "in2" }, concatenation::along_z));
|
tpl.add(concatenation("conc", { "in1", "in2" }, 2));
|
||||||
|
|
||||||
network net(engine, tpl);
|
network net(engine, tpl);
|
||||||
net.set_input_data("in1", input1);
|
net.set_input_data("in1", input1);
|
||||||
@ -614,7 +614,7 @@ TEST(spatial_concatenate_f32_gpu, inputs3d_axis_b) {
|
|||||||
topology tpl;
|
topology tpl;
|
||||||
tpl.add(input_layout("in1", input1->get_layout()));
|
tpl.add(input_layout("in1", input1->get_layout()));
|
||||||
tpl.add(input_layout("in2", input2->get_layout()));
|
tpl.add(input_layout("in2", input2->get_layout()));
|
||||||
tpl.add(concatenation("conc", { "in1", "in2" }, concatenation::along_b));
|
tpl.add(concatenation("conc", { "in1", "in2" }, 0));
|
||||||
|
|
||||||
network net(engine, tpl);
|
network net(engine, tpl);
|
||||||
net.set_input_data("in1", input1);
|
net.set_input_data("in1", input1);
|
||||||
@ -744,7 +744,7 @@ TEST(spatial_concatenate_f32_gpu, inputs3d_3_uneven_axis_b) {
|
|||||||
tpl.add(input_layout("in1", input1->get_layout()));
|
tpl.add(input_layout("in1", input1->get_layout()));
|
||||||
tpl.add(input_layout("in2", input2->get_layout()));
|
tpl.add(input_layout("in2", input2->get_layout()));
|
||||||
tpl.add(input_layout("in3", input3->get_layout()));
|
tpl.add(input_layout("in3", input3->get_layout()));
|
||||||
tpl.add(concatenation("conc", { "in1", "in2", "in3" }, concatenation::along_b));
|
tpl.add(concatenation("conc", { "in1", "in2", "in3" }, 0));
|
||||||
|
|
||||||
network net(engine, tpl);
|
network net(engine, tpl);
|
||||||
net.set_input_data("in1", input1);
|
net.set_input_data("in1", input1);
|
||||||
|
@ -221,7 +221,7 @@ TEST(split_gpu_f32, basic_split_concat_optimization) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
topology.add(split("split", "input", offsets));
|
topology.add(split("split", "input", offsets));
|
||||||
topology.add(concatenation("concat", ids, concatenation::along_f));
|
topology.add(concatenation("concat", ids, 1));
|
||||||
topology.add(reorder("output", "concat", format::bfyx, data_types::f32));
|
topology.add(reorder("output", "concat", format::bfyx, data_types::f32));
|
||||||
|
|
||||||
build_options opts;
|
build_options opts;
|
||||||
@ -261,7 +261,7 @@ TEST(split_gpu_i64, basic_split_concat_optimization) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
topology.add(split("split", "input", offsets));
|
topology.add(split("split", "input", offsets));
|
||||||
topology.add(concatenation("concat", ids, concatenation::along_f));
|
topology.add(concatenation("concat", ids, 1));
|
||||||
topology.add(reorder("output", "concat", format::bfyx, data_types::i64));
|
topology.add(reorder("output", "concat", format::bfyx, data_types::i64));
|
||||||
|
|
||||||
build_options opts;
|
build_options opts;
|
||||||
|
@ -283,7 +283,7 @@ protected:
|
|||||||
input_layouts.push_back({ input_id1, input_layout1 });
|
input_layouts.push_back({ input_id1, input_layout1 });
|
||||||
input_layouts.push_back({ input_id2, input_layout2 });
|
input_layouts.push_back({ input_id2, input_layout2 });
|
||||||
|
|
||||||
topology.add(cldnn::concatenation(id, { input_id1,input_id2 }, cldnn::concatenation::along_f));
|
topology.add(cldnn::concatenation(id, { input_id1,input_id2 }, 1));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user