[GPU] Replaced tensor dims usages with layout methods calls (#10984)
This commit is contained in:
1 parent
01f530d443
commit
050e2e518d
92 files changed
+978
-1107
No files matched your search
@@ -61,10 +61,10 @@ struct padded_pool_comparer {
|
||||
return ll.format < rl.format;
|
||||
if (ll.data_type != rl.data_type)
|
||||
return ll.data_type < rl.data_type;
|
||||
if (ll.size.spatial[0] != rl.size.spatial[0])
|
||||
return ll.size.spatial[0] < rl.size.spatial[0];
|
||||
if (ll.size.spatial[1] != rl.size.spatial[1])
|
||||
return ll.size.spatial[1] < rl.size.spatial[1];
|
||||
if (ll.spatial(0) != rl.spatial(0))
|
||||
return ll.spatial(0) < rl.spatial(0);
|
||||
if (ll.spatial(1) != rl.spatial(1))
|
||||
return ll.spatial(1) < rl.spatial(1);
|
||||
return ll.data_padding < rl.data_padding;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -61,21 +61,21 @@ std::string activation_inst::to_string(activation_node const& node) {
|
||||
}
|
||||
|
||||
activation_inst::typed_primitive_inst(network& network, activation_node const& node) : parent(network, node) {
|
||||
auto input_arg = node.input().get_output_layout();
|
||||
auto output_arg = node.get_output_layout();
|
||||
auto input_layout = node.input().get_output_layout();
|
||||
auto output_layout = node.get_output_layout();
|
||||
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"ReLU input number",
|
||||
input_arg.size.raw.size(),
|
||||
"ReLU output number",
|
||||
output_arg.size.raw.size(),
|
||||
"Relu input/output num dismatch");
|
||||
"ReLU input rank",
|
||||
input_layout.get_rank(),
|
||||
"ReLU output rank",
|
||||
output_layout.get_rank(),
|
||||
"Relu input/output rank mismatch");
|
||||
|
||||
if (is_parameterized()) {
|
||||
/// Slope input x dimension should be equal to input feature size (one slope per channel).
|
||||
auto slope_layout = node.slope_input().get_output_layout();
|
||||
auto slope_input_size = slope_layout.size;
|
||||
auto input_feature_size = slope_layout.size.feature[0];
|
||||
auto input_feature_size = slope_layout.feature();
|
||||
|
||||
CLDNN_ERROR_LESS_THAN(node.id(),
|
||||
"Slope x size",
|
||||
|
||||
@@ -60,90 +60,90 @@ layout arg_max_min_inst::calc_output_layout(arg_max_min_node const& node) {
|
||||
if (desc->with_axis) {
|
||||
switch (desc->axis) {
|
||||
case arg_max_min::x:
|
||||
size_check(input_layout.size.spatial[0]);
|
||||
size_check(input_layout.spatial(0));
|
||||
if (format == cldnn::format::bfzyx)
|
||||
return layout{output_data_type,
|
||||
format::bfzyx,
|
||||
tensor{input_layout.size.batch[0],
|
||||
input_layout.size.feature[0],
|
||||
tensor{input_layout.batch(),
|
||||
input_layout.feature(),
|
||||
(int32_t)desc->top_k,
|
||||
input_layout.size.spatial[1],
|
||||
input_layout.size.spatial[2]}};
|
||||
input_layout.spatial(1),
|
||||
input_layout.spatial(2)}};
|
||||
else
|
||||
return layout{output_data_type,
|
||||
format,
|
||||
tensor{input_layout.size.batch[0],
|
||||
input_layout.size.feature[0],
|
||||
tensor{input_layout.batch(),
|
||||
input_layout.feature(),
|
||||
(int32_t)desc->top_k,
|
||||
input_layout.size.spatial[1]}};
|
||||
input_layout.spatial(1)}};
|
||||
case arg_max_min::y:
|
||||
size_check(input_layout.size.spatial[1]);
|
||||
size_check(input_layout.spatial(1));
|
||||
if (format == cldnn::format::bfzyx)
|
||||
return layout{output_data_type,
|
||||
format::bfzyx,
|
||||
tensor{input_layout.size.batch[0],
|
||||
input_layout.size.feature[0],
|
||||
input_layout.size.spatial[0],
|
||||
tensor{input_layout.batch(),
|
||||
input_layout.feature(),
|
||||
input_layout.spatial(0),
|
||||
(int32_t)desc->top_k,
|
||||
input_layout.size.spatial[2]}};
|
||||
input_layout.spatial(2)}};
|
||||
else
|
||||
return layout{output_data_type,
|
||||
format,
|
||||
tensor{input_layout.size.batch[0],
|
||||
input_layout.size.feature[0],
|
||||
input_layout.size.spatial[0],
|
||||
tensor{input_layout.batch(),
|
||||
input_layout.feature(),
|
||||
input_layout.spatial(0),
|
||||
(int32_t)desc->top_k}};
|
||||
case arg_max_min::feature:
|
||||
size_check(input_layout.size.feature[0]);
|
||||
size_check(input_layout.feature());
|
||||
if (format == cldnn::format::bfzyx)
|
||||
return layout{output_data_type,
|
||||
format::bfzyx,
|
||||
tensor{input_layout.size.batch[0],
|
||||
tensor{input_layout.batch(),
|
||||
(int32_t)desc->top_k,
|
||||
input_layout.size.spatial[0],
|
||||
input_layout.size.spatial[1],
|
||||
input_layout.size.spatial[2]}};
|
||||
input_layout.spatial(0),
|
||||
input_layout.spatial(1),
|
||||
input_layout.spatial(2)}};
|
||||
else
|
||||
return layout{output_data_type,
|
||||
format,
|
||||
tensor{input_layout.size.batch[0],
|
||||
tensor{input_layout.batch(),
|
||||
(int32_t)desc->top_k,
|
||||
input_layout.size.spatial[0],
|
||||
input_layout.size.spatial[1]}};
|
||||
input_layout.spatial(0),
|
||||
input_layout.spatial(1)}};
|
||||
case arg_max_min::batch:
|
||||
size_check(input_layout.size.batch[0]);
|
||||
size_check(input_layout.batch());
|
||||
if (format == cldnn::format::bfzyx)
|
||||
return layout{output_data_type,
|
||||
format::bfzyx,
|
||||
tensor{(int32_t)desc->top_k,
|
||||
input_layout.size.feature[0],
|
||||
input_layout.size.spatial[0],
|
||||
input_layout.size.spatial[1],
|
||||
input_layout.size.spatial[2]}};
|
||||
input_layout.feature(),
|
||||
input_layout.spatial(0),
|
||||
input_layout.spatial(1),
|
||||
input_layout.spatial(2)}};
|
||||
else
|
||||
return layout{output_data_type,
|
||||
format,
|
||||
tensor{(int32_t)desc->top_k,
|
||||
input_layout.size.feature[0],
|
||||
input_layout.size.spatial[0],
|
||||
input_layout.size.spatial[1]}};
|
||||
input_layout.feature(),
|
||||
input_layout.spatial(0),
|
||||
input_layout.spatial(1)}};
|
||||
case arg_max_min::z:
|
||||
size_check(input_layout.size.spatial[2]);
|
||||
size_check(input_layout.spatial(2));
|
||||
return layout{output_data_type,
|
||||
format::bfzyx,
|
||||
tensor{input_layout.size.batch[0],
|
||||
input_layout.size.feature[0],
|
||||
input_layout.size.spatial[0],
|
||||
input_layout.size.spatial[1],
|
||||
tensor{input_layout.batch(),
|
||||
input_layout.feature(),
|
||||
input_layout.spatial(0),
|
||||
input_layout.spatial(1),
|
||||
(int32_t)desc->top_k}};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
size_check(input_layout.size.feature[0] * input_layout.size.spatial[0] * input_layout.size.spatial[1]);
|
||||
size_check(input_layout.feature() * input_layout.spatial(0) * input_layout.spatial(1));
|
||||
return layout{output_data_type,
|
||||
input_layout.format,
|
||||
tensor{input_layout.size.batch[0], 1, (int32_t)desc->top_k, 1}};
|
||||
tensor{input_layout.batch(), 1, (int32_t)desc->top_k, 1}};
|
||||
}
|
||||
|
||||
std::string arg_max_min_inst::to_string(arg_max_min_node const& node) {
|
||||
|
||||
@@ -51,8 +51,8 @@ layout average_unpooling_inst::calc_output_layout(average_unpooling_node const&
|
||||
0,
|
||||
"Size Y (of pooling window) must be positive (>= 1)");
|
||||
|
||||
tensor output_size(input_layout.size.batch[0],
|
||||
input_layout.size.feature[0],
|
||||
tensor output_size(input_layout.batch(),
|
||||
input_layout.feature(),
|
||||
desc->output_size.spatial[0],
|
||||
desc->output_size.spatial[1]);
|
||||
return {input_layout.data_type, input_layout.format, output_size};
|
||||
|
||||
@@ -53,12 +53,12 @@ layout batch_to_space_inst::calc_output_layout(batch_to_space_node const& node)
|
||||
for (size_t i = 0; i < spatial_num; ++i)
|
||||
block_sizes_multiplied *= block_shape.spatial[i];
|
||||
|
||||
if (input_layout.size.batch[0] % block_sizes_multiplied != 0)
|
||||
if (input_layout.batch() % block_sizes_multiplied != 0)
|
||||
CLDNN_ERROR_MESSAGE(node.id(),
|
||||
"The batch of the input tensor must be divisible by multiplied block sizes = " +
|
||||
std::to_string(block_sizes_multiplied));
|
||||
|
||||
if (crops_begin.feature[0] + crops_end.feature[0] >= block_shape.feature[0] * input_layout.size.feature[0])
|
||||
if (crops_begin.feature[0] + crops_end.feature[0] >= block_shape.feature[0] * input_layout.feature())
|
||||
CLDNN_ERROR_MESSAGE(node.id(),
|
||||
"Output dimensions must be positive");
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ std::string binary_convolution_inst::to_string(binary_convolution_node const& no
|
||||
auto node_info = node.desc_to_json();
|
||||
|
||||
std::stringstream primitive_description;
|
||||
|
||||
json_composite conv_info;
|
||||
conv_info.add("stride", cldnn::to_string(strd));
|
||||
conv_info.add("pad", cldnn::to_string(desc->pad));
|
||||
@@ -76,10 +75,10 @@ binary_convolution_inst::typed_primitive_inst(network& network, binary_convoluti
|
||||
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Input number of dimensions",
|
||||
input_layout.size.raw.size(),
|
||||
input_layout.get_rank(),
|
||||
"output number of dimensions",
|
||||
output_layout.size.raw.size(),
|
||||
"Input/output dims mismatch");
|
||||
output_layout.get_rank(),
|
||||
"Input/output rank mismatch");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Stride number of dimensions",
|
||||
stride.size(),
|
||||
@@ -97,13 +96,12 @@ binary_convolution_inst::typed_primitive_inst(network& network, binary_convoluti
|
||||
for (decltype(split) j = 0; j < split; j++) {
|
||||
auto filter_inst = node.weights(j).get_output_layout(); // convolution filter
|
||||
|
||||
auto pad = argument.pad;
|
||||
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Weights number of dimensions",
|
||||
filter_inst.size.raw.size(),
|
||||
filter_inst.get_rank(),
|
||||
"output number of dimensions",
|
||||
output_layout.size.raw.size(),
|
||||
output_layout.get_rank(),
|
||||
"Weights/output dims mismatch");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Convolution padding mode",
|
||||
@@ -123,11 +121,11 @@ binary_convolution_inst::typed_primitive_inst(network& network, binary_convoluti
|
||||
"expected output size",
|
||||
1,
|
||||
"Only one-dimensional batch size are supported");
|
||||
CLDNN_ERROR_LESS_THAN(node.id(),
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Weights feature maps number",
|
||||
input_layout.size.feature[0],
|
||||
input_layout.feature(),
|
||||
"input feature maps number",
|
||||
filter_inst.size.feature[0],
|
||||
filter_inst.feature(),
|
||||
"Weights/ifm mismatch");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,15 +29,7 @@ layout border_inst::calc_output_layout(border_node const& node) {
|
||||
auto ret_data_t = input_layout.data_type;
|
||||
auto ret_format = input_layout.format;
|
||||
|
||||
if (ret_format == format::bfwzyx) {
|
||||
return layout{ ret_data_t, ret_format, tensor(batch(new_size.batch[0]), feature(new_size.feature[0]),
|
||||
spatial(new_size.spatial[0], new_size.spatial[1], new_size.spatial[2], new_size.spatial[3])) };
|
||||
} else if (ret_format == format::bfzyx) {
|
||||
return layout{ ret_data_t, ret_format, tensor(batch(new_size.batch[0]), feature(new_size.feature[0]),
|
||||
spatial(new_size.spatial[0], new_size.spatial[1], new_size.spatial[2])) };
|
||||
}
|
||||
return layout{ ret_data_t, ret_format, tensor(batch(new_size.batch[0]), feature(new_size.feature[0]),
|
||||
spatial(new_size.spatial[0], new_size.spatial[1])) };
|
||||
return layout{ ret_data_t, ret_format, new_size };
|
||||
}
|
||||
|
||||
std::string border_inst::to_string(border_node const& node) {
|
||||
|
||||
@@ -55,26 +55,13 @@ std::string broadcast_inst::to_string(broadcast_node const& node) {
|
||||
broadcast_inst::typed_primitive_inst(network& network, broadcast_node const& node) : parent(network, node) {
|
||||
auto input_layout = node.input().get_output_layout();
|
||||
|
||||
const auto& input_sizes = input_layout.size;
|
||||
const auto& output_sizes = argument.broadcast_sizes;
|
||||
const auto format = input_layout.format;
|
||||
|
||||
std::vector<tensor::value_type> input_dims;
|
||||
size_t max_axes_num;
|
||||
std::vector<tensor::value_type> input_dims = input_layout.get_dims();
|
||||
size_t max_axes_num = input_layout.get_rank();
|
||||
|
||||
if (format == format::bfzyx) {
|
||||
max_axes_num = 5;
|
||||
input_dims = {input_sizes.batch[0],
|
||||
input_sizes.feature[0],
|
||||
input_sizes.spatial[2],
|
||||
input_sizes.spatial[1],
|
||||
input_sizes.spatial[0]};
|
||||
} else {
|
||||
max_axes_num = 4;
|
||||
input_dims = {input_sizes.batch[0], input_sizes.feature[0], input_sizes.spatial[1], input_sizes.spatial[0]};
|
||||
}
|
||||
|
||||
std::vector<tensor::value_type> reordered_input_dims(5, 0);
|
||||
std::vector<tensor::value_type> reordered_input_dims(max_axes_num, 0);
|
||||
std::set<uint16_t> existing;
|
||||
|
||||
const auto& broadcast_axes = node.get_primitive()->broadcast_axes;
|
||||
@@ -122,18 +109,7 @@ broadcast_inst::typed_primitive_inst(network& network, broadcast_node const& nod
|
||||
++input_index;
|
||||
}
|
||||
}
|
||||
tensor input_sizes_to_compare;
|
||||
if (format == format::bfzyx)
|
||||
input_sizes_to_compare = {reordered_input_dims.at(0),
|
||||
reordered_input_dims.at(1),
|
||||
reordered_input_dims.at(4),
|
||||
reordered_input_dims.at(3),
|
||||
reordered_input_dims.at(2)};
|
||||
else
|
||||
input_sizes_to_compare = {reordered_input_dims.at(0),
|
||||
reordered_input_dims.at(1),
|
||||
reordered_input_dims.at(3),
|
||||
reordered_input_dims.at(2)};
|
||||
tensor input_sizes_to_compare = tensor(format::get_default_format(reordered_input_dims.size()), reordered_input_dims);
|
||||
|
||||
CLDNN_ERROR_TENSOR_SIZES_NOT_DIVIDABLE(node.id(),
|
||||
"Broadcast sizes",
|
||||
|
||||
@@ -23,7 +23,7 @@ layout convolution_inst::calc_output_layout(convolution_node const& node) {
|
||||
auto desc = node.get_primitive();
|
||||
|
||||
auto input_layout = node.input().get_output_layout();
|
||||
auto weights_layout = node.weights(0).get_output_layout(); // weights are stored after inputs
|
||||
auto weights_layout = node.weights(0).get_output_layout().convert_to_weights_layout(desc->grouped_weights_shape);
|
||||
|
||||
auto pad = desc->pad;
|
||||
auto stride = desc->stride;
|
||||
@@ -36,16 +36,12 @@ layout convolution_inst::calc_output_layout(convolution_node const& node) {
|
||||
|
||||
auto input_type = input_layout.data_type;
|
||||
|
||||
// FIXME: use optional output data type once it's correct in IE
|
||||
auto output_type = input_type;
|
||||
// auto output_type = node.get_primitive()->output_data_type ? *node.get_primitive()->output_data_type : input_type;
|
||||
|
||||
if (node.has_fused_primitives()) {
|
||||
output_type = node.get_fused_output_layout().data_type;
|
||||
}
|
||||
|
||||
if ((input_type == data_types::u8 || input_type == data_types::i8) &&
|
||||
// !node.get_primitive()->output_data_type &&
|
||||
!node.has_fused_primitives()) {
|
||||
output_type = data_types::f32;
|
||||
}
|
||||
@@ -58,7 +54,6 @@ layout convolution_inst::calc_output_layout(convolution_node const& node) {
|
||||
uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1;
|
||||
uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1;
|
||||
|
||||
|
||||
// TODO: Consider moving general parameter verification to arguments constructor.
|
||||
CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(),
|
||||
"Stride spatial X",
|
||||
@@ -141,22 +136,22 @@ layout convolution_inst::calc_output_layout(convolution_node const& node) {
|
||||
"expected value",
|
||||
1,
|
||||
"Winograd 2x3 convolution does not support dilatation");
|
||||
if (input_layout.size.feature[0] % 32 != 0)
|
||||
if (input_layout.feature() % 32 != 0)
|
||||
CLDNN_ERROR_MESSAGE(node.id(),
|
||||
"Input for winograd 2x3 convolution should have features count divisable by 32");
|
||||
if (weights_layout.size.batch[0] % 32 != 0)
|
||||
if (weights_layout.ofm() % 32 != 0)
|
||||
CLDNN_ERROR_MESSAGE(node.id(),
|
||||
"Number of filters (OFM) for winograd 2x3 convolution should be divisable by 32");
|
||||
|
||||
CLDNN_ERROR_LESS_THAN(node.id(),
|
||||
"input width",
|
||||
input_layout.size.spatial[0],
|
||||
input_layout.spatial(0),
|
||||
"filter width",
|
||||
3,
|
||||
"Convolution input is smaller than weights");
|
||||
CLDNN_ERROR_LESS_THAN(node.id(),
|
||||
"input height",
|
||||
input_layout.size.spatial[1],
|
||||
input_layout.spatial(1),
|
||||
"filter height",
|
||||
3,
|
||||
"Convolution input is smaller than weights");
|
||||
@@ -169,10 +164,10 @@ layout convolution_inst::calc_output_layout(convolution_node const& node) {
|
||||
|
||||
return layout{output_type,
|
||||
input_layout.format,
|
||||
tensor{input_layout.size.batch[0],
|
||||
weights_layout.size.batch[0] * weights_layout.size.group[0],
|
||||
input_layout.size.spatial[0],
|
||||
input_layout.size.spatial[1] - winograd_filter_height + 1},
|
||||
tensor{input_layout.batch(),
|
||||
weights_layout.ofm() * weights_layout.group(),
|
||||
input_layout.spatial(0),
|
||||
input_layout.spatial(1) - winograd_filter_height + 1},
|
||||
input_layout.data_padding};
|
||||
}
|
||||
|
||||
@@ -226,7 +221,7 @@ layout convolution_inst::calc_output_layout(convolution_node const& node) {
|
||||
0,
|
||||
"must be positive(>= 1)");
|
||||
|
||||
tensor output_size(input_layout.size.batch[0],
|
||||
tensor output_size(input_layout.batch(),
|
||||
desc->output_size.feature[0],
|
||||
desc->output_size.spatial[0],
|
||||
desc->output_size.spatial[1],
|
||||
@@ -246,10 +241,8 @@ layout convolution_inst::calc_output_layout(convolution_node const& node) {
|
||||
true,
|
||||
1);
|
||||
|
||||
tensor::value_type output_features =
|
||||
desc->output_size.feature[0] != 0 ? desc->output_size.feature[0] : number_of_features;
|
||||
tensor output_size = tensor(input_layout.size.batch[0],
|
||||
output_features,
|
||||
tensor output_size = tensor(input_layout.batch(),
|
||||
weights_layout.ofm() * weights_layout.group(),
|
||||
output_range.spatial[0],
|
||||
output_range.spatial[1],
|
||||
output_range.spatial[2]);
|
||||
@@ -309,48 +302,44 @@ convolution_inst::typed_primitive_inst(network& network, convolution_node const&
|
||||
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Input number of dimensions",
|
||||
input_layout.size.raw.size(),
|
||||
input_layout.get_rank(),
|
||||
"output number of dimensions",
|
||||
output_layout.size.raw.size(),
|
||||
"Input/output dims mismatch");
|
||||
output_layout.get_rank(),
|
||||
"Input/output rank mismatch");
|
||||
|
||||
auto split = node.get_split();
|
||||
for (decltype(split) j = 0; j < split; j++) {
|
||||
auto filter_inst = node.weights(j).get_output_layout(); // convolution filter
|
||||
auto weights_ifm = filter_inst.size.feature[0];
|
||||
if (argument.grouped_weights_shape && !format::is_grouped(filter_inst.format)) {
|
||||
weights_ifm = filter_inst.size.spatial[filter_inst.format.spatial_num() - 1] * argument.groups;
|
||||
}
|
||||
auto filter_inst = node.weights(j).get_output_layout().convert_to_weights_layout(argument.grouped_weights_shape);
|
||||
|
||||
if (bias_term()) {
|
||||
auto bias_inst = node.bias(j).get_output_layout();
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Bias batch[0]",
|
||||
bias_inst.size.batch[0],
|
||||
bias_inst.batch(),
|
||||
"expected size of batch",
|
||||
1,
|
||||
"Biases isn't 1D vector.");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Bias feature[0]",
|
||||
bias_inst.size.feature[0],
|
||||
bias_inst.feature(),
|
||||
"expected feature map number",
|
||||
output_size.feature[0] / split,
|
||||
"Bias/fm mismatch");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Bias spatial[2]",
|
||||
bias_inst.size.spatial[2],
|
||||
bias_inst.spatial(2),
|
||||
"expected size of spatial[2]",
|
||||
1,
|
||||
"Biases isn't 1D vector.");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Bias spatial[1]",
|
||||
bias_inst.size.spatial[1],
|
||||
bias_inst.spatial(1),
|
||||
"expected size of spatial[1]",
|
||||
1,
|
||||
"Biases isn't 1D vector.");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Bias spatial[0]",
|
||||
bias_inst.size.spatial[0],
|
||||
bias_inst.spatial(0),
|
||||
"expected size of spatial[0]",
|
||||
1,
|
||||
"Biases isn't 1D vector.");
|
||||
@@ -358,12 +347,6 @@ convolution_inst::typed_primitive_inst(network& network, convolution_node const&
|
||||
|
||||
auto pad = argument.pad;
|
||||
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Weights number of dimensions",
|
||||
filter_inst.size.raw.size(),
|
||||
"output number of dimensions",
|
||||
output_layout.size.raw.size(),
|
||||
"Weights/output dims mismatch");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Convolution padding mode",
|
||||
node.get_output_layout().data_padding.filling_value(),
|
||||
@@ -382,21 +365,12 @@ convolution_inst::typed_primitive_inst(network& network, convolution_node const&
|
||||
"expected output size",
|
||||
1,
|
||||
"Only one-dimensional batch size are supported");
|
||||
CLDNN_ERROR_LESS_THAN(node.id(),
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Weights feature maps number",
|
||||
input_layout.size.feature[0],
|
||||
filter_inst.ifm() * filter_inst.group(),
|
||||
"input feature maps number",
|
||||
weights_ifm,
|
||||
input_layout.feature(),
|
||||
"Weights/ifm mismatch");
|
||||
|
||||
if (!argument.grouped_weights_shape && !format::is_grouped(filter_inst.format)) {
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Weights feature maps number",
|
||||
input_layout.size.feature[0],
|
||||
"input feature maps number",
|
||||
weights_ifm,
|
||||
"Weights/ifm mismatch");
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace cldnn
|
||||
@@ -24,7 +24,7 @@ layout deconvolution_inst::calc_output_layout(deconvolution_node const& node) {
|
||||
auto desc = node.get_primitive();
|
||||
|
||||
auto input_layout = node.input().get_output_layout();
|
||||
auto weights_layout = node.weights(0).get_output_layout(); // weights are stored after inputs
|
||||
auto weights_layout = node.weights(0).get_output_layout().convert_to_weights_layout(desc->grouped_weights_shape);
|
||||
|
||||
auto data_type = input_layout.data_type;
|
||||
if ((input_layout.data_type == data_types::i8 || input_layout.data_type == data_types::u8) && !node.has_fused_primitives()) {
|
||||
@@ -37,18 +37,8 @@ layout deconvolution_inst::calc_output_layout(deconvolution_node const& node) {
|
||||
|
||||
auto pad = desc->pad;
|
||||
auto strd = desc->stride;
|
||||
auto group = desc->groups;
|
||||
|
||||
int32_t number_of_features = 0;
|
||||
if (desc->grouped_weights_shape && !format::is_grouped(weights_layout.format)) {
|
||||
number_of_features = weights_layout.size.feature[0] * static_cast<int32_t>(group);
|
||||
} else {
|
||||
if (format::is_grouped(weights_layout.format)) {
|
||||
number_of_features = weights_layout.size.batch[0] * static_cast<int32_t>(group);
|
||||
} else {
|
||||
number_of_features = weights_layout.size.batch[0];
|
||||
}
|
||||
}
|
||||
int32_t number_of_features = weights_layout.group() * weights_layout.ofm();
|
||||
|
||||
if (desc->with_output_size) {
|
||||
CLDNN_ERROR_LESS_OR_EQUAL_THAN(node.id(),
|
||||
@@ -70,7 +60,7 @@ layout deconvolution_inst::calc_output_layout(deconvolution_node const& node) {
|
||||
0,
|
||||
"User-defined size of output layout must be positive (>= 1)");
|
||||
|
||||
tensor output_size(desc->output_size.batch[0],
|
||||
tensor output_size(input_layout.batch(),
|
||||
number_of_features,
|
||||
desc->output_size.spatial[0],
|
||||
desc->output_size.spatial[1],
|
||||
@@ -78,9 +68,6 @@ layout deconvolution_inst::calc_output_layout(deconvolution_node const& node) {
|
||||
return {data_type, input_layout.format, output_size};
|
||||
}
|
||||
|
||||
// compute output_dim <= stride * (input_size - 1) + kernel_size - 2 * pad;
|
||||
auto filter_size = weights_layout.size;
|
||||
|
||||
int32_t off_factor = -2;
|
||||
size_t spatial_dims = input_layout.get_spatial_rank();
|
||||
CLDNN_ERROR_GREATER_THAN(node.id(),
|
||||
@@ -100,7 +87,7 @@ layout deconvolution_inst::calc_output_layout(deconvolution_node const& node) {
|
||||
z = off_factor * pad[pad.size() - 3] + (input_layout.spatial(2) - 1) * strd[strd.size() - 3] + weights_layout.spatial(2);
|
||||
}
|
||||
|
||||
tensor output_size(input_layout.size.batch[0],
|
||||
tensor output_size(input_layout.batch(),
|
||||
number_of_features, x, y, z);
|
||||
return {data_type, input_layout.format, output_size};
|
||||
}
|
||||
@@ -158,9 +145,9 @@ deconvolution_inst::typed_primitive_inst(network& network, deconvolution_node co
|
||||
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Input size",
|
||||
input_layout.size.raw.size(),
|
||||
input_layout.get_rank(),
|
||||
"output size",
|
||||
output_layout.size.raw.size(),
|
||||
output_layout.get_rank(),
|
||||
"Input/output number of dimension does not match.");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Stride size",
|
||||
@@ -178,42 +165,37 @@ deconvolution_inst::typed_primitive_inst(network& network, deconvolution_node co
|
||||
|
||||
auto split = node.get_split();
|
||||
for (decltype(split) j = 0; j < split; j++) {
|
||||
auto filter_inst = node.weights(j).get_output_layout(); // deconvolution filter
|
||||
auto pad = argument.pad;
|
||||
auto weights_ifm = filter_inst.size.feature[0];
|
||||
if (argument.grouped_weights_shape && !format::is_grouped(filter_inst.format)) {
|
||||
weights_ifm = filter_inst.size.spatial[filter_inst.format.spatial_num() - 1] * argument.groups;
|
||||
}
|
||||
auto filter_inst = node.weights(j).get_output_layout().convert_to_weights_layout(argument.grouped_weights_shape);
|
||||
|
||||
if (argument.bias.size() != 0) {
|
||||
auto bias_inst = node.bias(j).get_output_layout();
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Bias batch[0]",
|
||||
bias_inst.size.batch[0],
|
||||
bias_inst.batch(),
|
||||
"dimension size",
|
||||
1,
|
||||
"Batch[0] of bias should be 1. Bias isn't 1D vector.");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Bias feature[0]",
|
||||
bias_inst.size.feature[0],
|
||||
bias_inst.feature(),
|
||||
"output feature size / split",
|
||||
output_size.feature[0] / split,
|
||||
output_layout.feature(),
|
||||
"Biases/output feature maps number does not match.");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Bias spatial[2]",
|
||||
bias_inst.size.spatial[2],
|
||||
bias_inst.spatial(2),
|
||||
"dimension size",
|
||||
1,
|
||||
"Spatial[2] of bias should be 1. Bias isn't 1D vector.");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Bias spatial[1]",
|
||||
bias_inst.size.spatial[1],
|
||||
bias_inst.spatial(1),
|
||||
"dimension size",
|
||||
1,
|
||||
"Spatial[1] of bias should be 1. Bias isn't 1D vector.");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Bias spatial[0]",
|
||||
bias_inst.size.spatial[0],
|
||||
bias_inst.spatial(0),
|
||||
"dimension size",
|
||||
1,
|
||||
"Spatial[0] of bias should be 1. Bias isn't 1D vector.");
|
||||
@@ -226,38 +208,11 @@ deconvolution_inst::typed_primitive_inst(network& network, deconvolution_node co
|
||||
0.0f,
|
||||
"Unknown padding mode in deconvolution.");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Output feature size",
|
||||
output_size.feature.size(),
|
||||
"expected output feature size",
|
||||
1,
|
||||
"Only one-dimensional features are supported");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Output feature size",
|
||||
output_size.feature.size(),
|
||||
"expected output feature size",
|
||||
1,
|
||||
"Only one-dimensional features are supported");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Output batch size",
|
||||
output_size.batch.size(),
|
||||
"expected output batch size",
|
||||
1,
|
||||
"Only one-dimensional features are supported");
|
||||
CLDNN_ERROR_LESS_THAN(node.id(),
|
||||
"Weights feature maps number",
|
||||
input_layout.size.feature[0],
|
||||
filter_inst.ifm() * filter_inst.group(),
|
||||
"input feature maps number",
|
||||
weights_ifm,
|
||||
input_layout.feature(),
|
||||
"Weights/ifm mismatch");
|
||||
|
||||
if (!argument.grouped_weights_shape && !format::is_grouped(filter_inst.format)) {
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Weights feature maps number",
|
||||
input_layout.size.feature[0],
|
||||
"input feature maps number",
|
||||
weights_ifm,
|
||||
"Weights/ifm mismatch");
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace cldnn
|
||||
@@ -23,7 +23,7 @@ layout deformable_conv_inst::calc_output_layout(deformable_conv_node const& node
|
||||
auto input_type = input_layout.data_type;
|
||||
auto output_type = node.get_primitive()->output_data_type ? *node.get_primitive()->output_data_type : input_type;
|
||||
|
||||
tensor output_size(input_layout.size.batch[0],
|
||||
tensor output_size(input_layout.batch(),
|
||||
desc->output_size.feature[0],
|
||||
desc->output_size.spatial[0],
|
||||
desc->output_size.spatial[1],
|
||||
@@ -70,8 +70,8 @@ layout deformable_interp_inst::calc_output_layout(deformable_interp_node const&
|
||||
auto input_type = input_layout.data_type;
|
||||
auto output_type = node.get_primitive()->output_data_type ? *node.get_primitive()->output_data_type : input_type;
|
||||
|
||||
tensor output_size(input_layout.size.batch[0],
|
||||
input_layout.size.feature[0]*kernel_size.spatial[0]*kernel_size.spatial[1],
|
||||
tensor output_size(input_layout.batch(),
|
||||
input_layout.feature()*kernel_size.spatial[0]*kernel_size.spatial[1],
|
||||
desc->output_size.spatial[0],
|
||||
desc->output_size.spatial[1],
|
||||
desc->output_size.spatial[2]);
|
||||
|
||||
@@ -28,7 +28,7 @@ layout depth_to_space_inst::calc_output_layout(depth_to_space_node const& node)
|
||||
"Invalid depthToSpace block_size value (should equal at least two). Actual block size is" +
|
||||
std::to_string(block_size));
|
||||
|
||||
if (input_layout.size.feature[0] % (block_size * block_size) != 0)
|
||||
if (input_layout.feature() % (block_size * block_size) != 0)
|
||||
CLDNN_ERROR_MESSAGE(
|
||||
node.id(),
|
||||
"The depth of the input tensor must be divisible by squared block size. Actual block size is " +
|
||||
@@ -36,16 +36,16 @@ layout depth_to_space_inst::calc_output_layout(depth_to_space_node const& node)
|
||||
|
||||
auto out_size = input_layout.size;
|
||||
if (format::spatial_num(input_layout.format) == 3) {
|
||||
const size_t feature = input_layout.size.feature[0] / block_size / block_size / block_size;
|
||||
const size_t z = input_layout.size.spatial[2] * block_size;
|
||||
const size_t y = input_layout.size.spatial[1] * block_size;
|
||||
const size_t x = input_layout.size.spatial[0] * block_size;
|
||||
out_size = tensor(TensorValue(input_layout.size.batch[0]), TensorValue(feature), TensorValue(x), TensorValue(y), TensorValue(z));
|
||||
const size_t feature = input_layout.feature() / block_size / block_size / block_size;
|
||||
const size_t z = input_layout.spatial(2) * block_size;
|
||||
const size_t y = input_layout.spatial(1) * block_size;
|
||||
const size_t x = input_layout.spatial(0) * block_size;
|
||||
out_size = tensor(TensorValue(input_layout.batch()), TensorValue(feature), TensorValue(x), TensorValue(y), TensorValue(z));
|
||||
} else {
|
||||
const size_t feature = input_layout.size.feature[0] / block_size / block_size;
|
||||
const size_t y = input_layout.size.spatial[1] * block_size;
|
||||
const size_t x = input_layout.size.spatial[0] * block_size;
|
||||
out_size = tensor(TensorValue(input_layout.size.batch[0]), TensorValue(feature), TensorValue(x), TensorValue(y));
|
||||
const size_t feature = input_layout.feature() / block_size / block_size;
|
||||
const size_t y = input_layout.spatial(1) * block_size;
|
||||
const size_t x = input_layout.spatial(0) * block_size;
|
||||
out_size = tensor(TensorValue(input_layout.batch()), TensorValue(feature), TensorValue(x), TensorValue(y));
|
||||
}
|
||||
|
||||
if (node.has_fused_primitives()) {
|
||||
|
||||
@@ -42,7 +42,7 @@ layout detection_output_inst::calc_output_layout(detection_output_node const& no
|
||||
}
|
||||
|
||||
if (node.get_primitive()->top_k != -1) {
|
||||
int top_k = node.get_primitive()->top_k * num_classes * input_layout.size.batch[0];
|
||||
int top_k = node.get_primitive()->top_k * num_classes * input_layout.batch();
|
||||
if (top_k < output_size) {
|
||||
output_size = top_k;
|
||||
}
|
||||
@@ -50,10 +50,10 @@ layout detection_output_inst::calc_output_layout(detection_output_node const& no
|
||||
|
||||
output_size *= DETECTION_OUTPUT_ROW_SIZE;
|
||||
// Add space for number of output results per image - needed in the next detection output step
|
||||
output_size += ((input_layout.size.batch[0] + 15) / 16) * 16;
|
||||
output_size += ((input_layout.batch() + 15) / 16) * 16;
|
||||
|
||||
return {input_layout.data_type, cldnn::format::bfyx,
|
||||
cldnn::tensor(1, 1, DETECTION_OUTPUT_ROW_SIZE, node.get_primitive()->keep_top_k * input_layout.size.batch[0])};
|
||||
cldnn::tensor(1, 1, DETECTION_OUTPUT_ROW_SIZE, node.get_primitive()->keep_top_k * input_layout.batch())};
|
||||
}
|
||||
|
||||
std::string detection_output_inst::to_string(detection_output_node const& node) {
|
||||
@@ -138,36 +138,33 @@ detection_output_inst::typed_primitive_inst(network& network, detection_output_n
|
||||
"expected bfyx input format",
|
||||
format::bfyx);
|
||||
|
||||
tensor location_size = location_layout.size;
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Location input dimensions",
|
||||
(location_size.feature[0] * location_size.batch[0]),
|
||||
(location_layout.feature() * location_layout.batch()),
|
||||
"detection output layer dimensions",
|
||||
static_cast<int>(location_layout.count()),
|
||||
"Location input/ detection output dims mismatch");
|
||||
|
||||
tensor confidence_size = confidence_layout.size;
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Confidence input dimensions",
|
||||
(confidence_size.feature[0] * confidence_size.batch[0]),
|
||||
(confidence_layout.feature() * confidence_layout.batch()),
|
||||
"detection output layer dimensions",
|
||||
static_cast<int>(confidence_layout.count()),
|
||||
"Confidence input/detection output dims mistmach");
|
||||
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Confidence batch size",
|
||||
confidence_size.batch[0],
|
||||
confidence_layout.batch(),
|
||||
"location input batch size",
|
||||
location_size.batch[0],
|
||||
location_layout.batch(),
|
||||
"Batch sizes mismatch.");
|
||||
|
||||
auto desc = node.get_primitive();
|
||||
int prior_feature_size = desc->variance_encoded_in_target ? 1 : 2;
|
||||
tensor prior_box_size = prior_box_layout.size;
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(), "Prior box spatial X", prior_box_size.spatial[0], "expected value", 1, "");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(), "Prior box spatial X", prior_box_layout.spatial(0), "expected value", 1, "");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Prior box feature size",
|
||||
prior_box_size.feature[0],
|
||||
prior_box_layout.feature(),
|
||||
"expected value",
|
||||
prior_feature_size,
|
||||
"");
|
||||
|
||||
@@ -98,9 +98,9 @@ layout eltwise_inst::calc_output_layout(eltwise_node const& node) {
|
||||
if (!eltw->stride.empty()) {
|
||||
// we can safely use only first stride, since we're using first input, and input / stride should give exact same
|
||||
// value for every input
|
||||
input_node_layout.size.spatial[0] = (input_node_layout.size.spatial[0] - 1) / eltw->stride[0].spatial[0] + 1;
|
||||
input_node_layout.size.spatial[1] = (input_node_layout.size.spatial[1] - 1) / eltw->stride[0].spatial[1] + 1;
|
||||
input_node_layout.size.spatial[2] = (input_node_layout.size.spatial[2] - 1) / eltw->stride[0].spatial[2] + 1;
|
||||
input_node_layout.size.spatial[0] = (input_node_layout.spatial(0) - 1) / eltw->stride[0].spatial[0] + 1;
|
||||
input_node_layout.size.spatial[1] = (input_node_layout.spatial(1) - 1) / eltw->stride[0].spatial[1] + 1;
|
||||
input_node_layout.size.spatial[2] = (input_node_layout.spatial(2) - 1) / eltw->stride[0].spatial[2] + 1;
|
||||
return input_node_layout;
|
||||
}
|
||||
return output_layout;
|
||||
@@ -221,14 +221,14 @@ eltwise_inst::typed_primitive_inst(network& network, eltwise_node const& node) :
|
||||
prim->stride.size(),
|
||||
"");
|
||||
|
||||
const auto out_x = node.get_output_layout().size.spatial[0];
|
||||
const auto out_y = node.get_output_layout().size.spatial[1];
|
||||
const auto out_x = node.get_output_layout().spatial(0);
|
||||
const auto out_y = node.get_output_layout().spatial(1);
|
||||
// check if strides are correctly set. I.e INPUT_SIZE_X / STRIDE_X = OUTPUT_SIZE_X, same for Y dimension
|
||||
for (size_t i = 0; i < inputs_count; i++) {
|
||||
const auto& in_layout = node.input(i).get_output_layout();
|
||||
auto stride = prim->stride[i];
|
||||
|
||||
const auto in_x_div_stride_x = (in_layout.size.spatial[0] - 1) / stride.spatial[0] + 1;
|
||||
const auto in_x_div_stride_x = (in_layout.spatial(0) - 1) / stride.spatial[0] + 1;
|
||||
if (in_x_div_stride_x != out_x && in_x_div_stride_x != 1)
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Eltwise input_x / stride_x",
|
||||
@@ -237,7 +237,7 @@ eltwise_inst::typed_primitive_inst(network& network, eltwise_node const& node) :
|
||||
out_x,
|
||||
"");
|
||||
|
||||
const auto in_y_div_stride_y = (in_layout.size.spatial[1] - 1) / stride.spatial[1] + 1;
|
||||
const auto in_y_div_stride_y = (in_layout.spatial(1) - 1) / stride.spatial[1] + 1;
|
||||
if (in_y_div_stride_y != out_y && in_y_div_stride_y != 1)
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Eltwise inputyx / stride_y",
|
||||
|
||||
@@ -35,8 +35,8 @@ layout experimental_detectron_roi_feature_extractor_inst::calc_output_layout(exp
|
||||
"Output data type forcing is not supported for roi_pooling_node!");
|
||||
layout rois_layout = node.input(0).get_output_layout();
|
||||
layout data_layout = node.input(1).get_output_layout();
|
||||
int num_rois = rois_layout.size.batch[0];
|
||||
int num_channels = data_layout.size.feature[0];
|
||||
int num_rois = rois_layout.batch();
|
||||
int num_channels = data_layout.feature();
|
||||
auto desc = node.get_primitive();
|
||||
|
||||
return layout(data_layout.data_type, format::bfyx, {num_rois, num_channels, desc->output_dim, desc->output_dim});
|
||||
|
||||
@@ -64,7 +64,7 @@ format::type get_preferred_format(const fully_connected_node& node) {
|
||||
if (input_layout.data_type == data_types::f32 &&
|
||||
input_layout.format == format::bfyx &&
|
||||
no_spatial_padding &&
|
||||
input_layout.size.batch[0] != 8)
|
||||
input_layout.batch() != 8)
|
||||
return format::bfyx;
|
||||
|
||||
auto input_pitches = input_layout.get_pitches();
|
||||
@@ -72,7 +72,7 @@ format::type get_preferred_format(const fully_connected_node& node) {
|
||||
input_layout.format == format::bfyx &&
|
||||
no_spatial_padding &&
|
||||
input_pitches.batch[0] % 2 == 0 &&
|
||||
input_layout.size.batch[0] != 16)
|
||||
input_layout.batch() != 16)
|
||||
return format::bfyx;
|
||||
|
||||
// this condition tests whether our input is batch>1 in bfyx format, if yes there will be
|
||||
@@ -80,7 +80,7 @@ format::type get_preferred_format(const fully_connected_node& node) {
|
||||
// "is_batch_after_spatial" should return true)
|
||||
if (data_type_traits::is_floating_point(input_layout.data_type) &&
|
||||
input_layout.format == format::bfyx &&
|
||||
input_layout.size.batch[0] > 1)
|
||||
input_layout.batch() > 1)
|
||||
return format::yxfb;
|
||||
|
||||
return format::bfyx;
|
||||
@@ -101,9 +101,9 @@ layout fully_connected_inst::calc_output_layout(fully_connected_node const& node
|
||||
output_type = node.get_fused_output_layout().data_type;
|
||||
}
|
||||
|
||||
auto output_size = tensor(input_layout.size.batch[0], weights_layout.size.batch[0], 1, 1);
|
||||
auto output_size = tensor(input_layout.batch(), weights_layout.batch(), 1, 1);
|
||||
if (desc->input_size == 3) {
|
||||
output_size = tensor(input_layout.size.batch[0], input_layout.size.feature[0], 1, weights_layout.size.batch[0]);
|
||||
output_size = tensor(input_layout.batch(), input_layout.feature(), 1, weights_layout.batch());
|
||||
}
|
||||
format output_format = get_preferred_format(node);
|
||||
|
||||
@@ -129,14 +129,5 @@ std::string fully_connected_inst::to_string(fully_connected_node const& node) {
|
||||
}
|
||||
|
||||
fully_connected_inst::typed_primitive_inst(network& network, fully_connected_node const& node)
|
||||
: parent(network, node) {
|
||||
auto input_layout = node.input().get_output_layout();
|
||||
auto output_layout = node.get_output_layout();
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Input size",
|
||||
input_layout.size.raw.size(),
|
||||
"output size",
|
||||
output_layout.size.raw.size(),
|
||||
"");
|
||||
}
|
||||
: parent(network, node) { }
|
||||
} // namespace cldnn
|
||||
@@ -25,8 +25,8 @@ layout gemm_inst::calc_output_layout(gemm_node const& node) {
|
||||
bool transpose_input0 = prim->transpose_input0;
|
||||
bool transpose_input1 = prim->transpose_input1;
|
||||
|
||||
auto M = !transpose_input0 ? input0_layout.size.spatial[1] : input0_layout.size.spatial[0];
|
||||
auto N = !transpose_input1 ? input1_layout.size.spatial[0] : input1_layout.size.spatial[1];
|
||||
auto M = !transpose_input0 ? input0_layout.spatial(1) : input0_layout.spatial(0);
|
||||
auto N = !transpose_input1 ? input1_layout.spatial(0) : input1_layout.spatial(1);
|
||||
|
||||
auto output_size = input0_layout.size;
|
||||
|
||||
@@ -79,15 +79,15 @@ gemm_inst::typed_primitive_inst(network& network, gemm_node const& node) : paren
|
||||
bool transpose_input0 = node.get_primitive()->transpose_input0;
|
||||
bool transpose_input1 = node.get_primitive()->transpose_input1;
|
||||
|
||||
auto transposed_x0 = input0_layout.size.spatial[0];
|
||||
auto transposed_y0 = input0_layout.size.spatial[1];
|
||||
auto transposed_x0 = input0_layout.spatial(0);
|
||||
auto transposed_y0 = input0_layout.spatial(1);
|
||||
|
||||
if (transpose_input0) {
|
||||
std::swap(transposed_x0, transposed_y0);
|
||||
}
|
||||
|
||||
auto transposed_x1 = input1_layout.size.spatial[0];
|
||||
auto transposed_y1 = input1_layout.size.spatial[1];
|
||||
auto transposed_x1 = input1_layout.spatial(0);
|
||||
auto transposed_y1 = input1_layout.spatial(1);
|
||||
|
||||
if (transpose_input1) {
|
||||
std::swap(transposed_x1, transposed_y1);
|
||||
@@ -107,13 +107,13 @@ gemm_inst::typed_primitive_inst(network& network, gemm_node const& node) : paren
|
||||
"Input 0 external dimension size",
|
||||
transposed_y0,
|
||||
"Input 2 rows number",
|
||||
input2_layout.size.spatial[1],
|
||||
input2_layout.spatial(1),
|
||||
"");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Input 1 external dimension size",
|
||||
transposed_x1,
|
||||
"Input 2 columns number",
|
||||
input2_layout.size.spatial[0],
|
||||
input2_layout.spatial(0),
|
||||
"");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,6 +169,8 @@ void add_required_reorders::run(program& p) {
|
||||
std::vector<cldnn::format> preffered_layout_formats;
|
||||
size_t max_in_dims = std::max(cldnn::format::dimension(original_layout.format), static_cast<size_t>(4));
|
||||
for (auto& node : usr->get_dependencies()) {
|
||||
if (format::is_weights_format(node->get_output_layout().format))
|
||||
continue;
|
||||
max_in_dims = std::max(cldnn::format::dimension(node->get_output_layout().format), max_in_dims);
|
||||
}
|
||||
// This list of preffered layouts has been selected arbitrary due to developers' experience
|
||||
|
||||
@@ -68,14 +68,14 @@ void shuffle_weights(data_node& node, const std::vector<shuffle_range>& ranges,
|
||||
mem_lock<uint8_t, mem_lock_type::write> new_weights_memory_lock{new_weights_memory, stream};
|
||||
auto old_ptr = old_weights_memory_lock.data();
|
||||
auto new_ptr = new_weights_memory_lock.data();
|
||||
for (int32_t ofi = 0; ofi < wei_layout.size.batch[0]; ++ofi) {
|
||||
for (int32_t ofi = 0; ofi < wei_layout.batch(); ++ofi) {
|
||||
int32_t new_ifi = 0;
|
||||
for (auto& range : ranges) {
|
||||
for (int32_t ifi = range.first; ifi < range.second; ++ifi, ++new_ifi) {
|
||||
for (int32_t wi = 0; wi < wei_layout.size.spatial[3]; ++wi) {
|
||||
for (int32_t zi = 0; zi < wei_layout.size.spatial[2]; ++zi) {
|
||||
for (int32_t yi = 0; yi < wei_layout.size.spatial[1]; ++yi) {
|
||||
for (int32_t xi = 0; xi < wei_layout.size.spatial[0]; ++xi) {
|
||||
for (int32_t wi = 0; wi < wei_layout.spatial(3); ++wi) {
|
||||
for (int32_t zi = 0; zi < wei_layout.spatial(2); ++zi) {
|
||||
for (int32_t yi = 0; yi < wei_layout.spatial(1); ++yi) {
|
||||
for (int32_t xi = 0; xi < wei_layout.spatial(0); ++xi) {
|
||||
auto old_coords = tensor(batch(ofi), feature(ifi), spatial(xi, yi, zi, wi));
|
||||
auto new_coords = tensor(batch(ofi), feature(new_ifi), spatial(xi, yi, zi, wi));
|
||||
auto old_offset = wei_layout.get_linear_offset(old_coords);
|
||||
@@ -145,7 +145,7 @@ void concat_input_order::run(program& p) {
|
||||
auto& dep = concat_node.get_dependency(input_idx);
|
||||
auto dep_layout = dep.get_output_layout();
|
||||
single_format &= dep_layout.format == out_format;
|
||||
feature_sizes.push_back(dep_layout.size.feature[0]);
|
||||
feature_sizes.push_back(dep_layout.feature());
|
||||
}
|
||||
// Alignment is not optimal if aligned input follows unaligned one
|
||||
bool already_aligned = true;
|
||||
|
||||
@@ -88,11 +88,11 @@ void eltwise_shrinking::run(program& p) {
|
||||
auto dep_stride_x = stride_x;
|
||||
auto dep_stride_y = stride_y;
|
||||
// don't shrink if input is broadcasted
|
||||
if (node->get_dependency(dep).get_output_layout().size.spatial[0] == 1) {
|
||||
if (node->get_dependency(dep).get_output_layout().spatial(0) == 1) {
|
||||
dep_stride_x = 1;
|
||||
}
|
||||
|
||||
if (node->get_dependency(dep).get_output_layout().size.spatial[1] == 1) {
|
||||
if (node->get_dependency(dep).get_output_layout().spatial(1) == 1) {
|
||||
dep_stride_y = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -121,13 +121,12 @@ void graph_initializations::handle_lstm_node(program& p, lstm_node& node) {
|
||||
// calculating sizes
|
||||
program_node& input = node.input();
|
||||
layout input_layout = input.get_output_layout();
|
||||
tensor input_size = input_layout.size;
|
||||
tensor recurrent_size = p.get_node(recurrent_id).get_output_layout().size;
|
||||
|
||||
// hidden tensor size = [batch, seq, hidden_size, direction]
|
||||
// the output of the element wise operation is cropped and used in the next time step
|
||||
// sequence_len = 1 and direction = 1. The backward pass is separated from the forward pass
|
||||
auto hidden_size = tensor(input_size.batch[0], 1, recurrent_size.spatial[0], 1);
|
||||
auto hidden_size = tensor(input_layout.batch(), 1, recurrent_size.spatial[0], 1);
|
||||
|
||||
size_t directions = recurrent_size.feature[0];
|
||||
size_t num_input_dependencies = node.get_dependencies().size();
|
||||
@@ -138,7 +137,7 @@ void graph_initializations::handle_lstm_node(program& p, lstm_node& node) {
|
||||
// input is not divided into sequence elements
|
||||
if (sequence_len == 1 && num_input_dependencies == 1) {
|
||||
// Get the sequence length from the input to LSTM
|
||||
sequence_len = input_size.feature[0];
|
||||
sequence_len = input_layout.feature();
|
||||
|
||||
// If the input's feature/sequence length field is > 1, i.e. If
|
||||
// the sequence elements are concatenated into one single input
|
||||
@@ -146,7 +145,7 @@ void graph_initializations::handle_lstm_node(program& p, lstm_node& node) {
|
||||
if (sequence_len > 1) {
|
||||
for (size_t sequence_element = 0; sequence_element < sequence_len; sequence_element++) {
|
||||
primitive_id crop_id = input.id() + ":crop:" + get_id_string(sequence_element);
|
||||
tensor crop_tensor{input_size.batch[0], 1, input_size.spatial[0], input_size.spatial[1]};
|
||||
tensor crop_tensor{input_layout.batch(), 1, input_layout.spatial(0), input_layout.spatial(1)};
|
||||
tensor offset_tensor{0, static_cast<tensor::value_type>(sequence_element), 0, 0};
|
||||
auto input_crop = std::make_shared<crop>(crop_id, input.id(), crop_tensor, offset_tensor);
|
||||
auto& input_crop_node = p.get_or_create(input_crop);
|
||||
@@ -189,7 +188,7 @@ void graph_initializations::handle_lstm_node(program& p, lstm_node& node) {
|
||||
std::vector<program_node*> cell_list(directions * sequence_len);
|
||||
std::vector<program_node*> hidden_list(directions * sequence_len);
|
||||
std::map<size_t, std::pair<primitive_id, program_node*>> output_map;
|
||||
size_t input_directions = input_size.spatial[1];
|
||||
size_t input_directions = input_layout.spatial(1);
|
||||
|
||||
// lstm expanding
|
||||
for (size_t dir = 0; dir < directions; ++dir) {
|
||||
@@ -310,7 +309,7 @@ void graph_initializations::handle_lstm_node(program& p, lstm_node& node) {
|
||||
if (emit_last_cell)
|
||||
concatenate_len++;
|
||||
|
||||
tensor output_size{input_size.batch[0],
|
||||
tensor output_size{input_layout.batch(),
|
||||
static_cast<int32_t>(concatenate_len),
|
||||
hidden_size.spatial[0],
|
||||
(int32_t)directions};
|
||||
|
||||
@@ -35,7 +35,6 @@ void pre_replace_deconv::run(program& p) {
|
||||
auto& deconv_node = node->as<deconvolution>();
|
||||
auto& weights_node = deconv_node.weights();
|
||||
auto deconv_prim = deconv_node.typed_desc();
|
||||
auto filter_size = weights_node.get_output_layout().size;
|
||||
auto filter_layout = weights_node.get_output_layout().convert_to_weights_layout(deconv_prim->grouped_weights_shape);
|
||||
auto weights_nodes_id = deconv_prim->weights;
|
||||
auto biases_nodes_id = deconv_prim->bias;
|
||||
@@ -168,9 +167,9 @@ void pre_replace_deconv::run(program& p) {
|
||||
update_processing_order = true;
|
||||
// current optimization only available for specific deconvolution parameters
|
||||
} else if (deconv_node.is_output() == false &&
|
||||
deconv_node.get_output_layout().size.feature[0] == 1 &&
|
||||
deconv_node.get_output_layout().feature() == 1 &&
|
||||
deconv_prim->stride[deconv_prim->stride.size() - 1] == 2 && deconv_prim->stride[deconv_prim->stride.size() - 2] == 2 &&
|
||||
filter_size.spatial[0] == 9 && filter_size.spatial[1] == 9 &&
|
||||
filter_layout.spatial(0) == 9 && filter_layout.spatial(1) == 9 &&
|
||||
deconv_prim->pad[deconv_prim->pad.size() - 1] == 4 && deconv_prim->pad[deconv_prim->pad.size() - 2] == 4 &&
|
||||
weights_nodes_id.size() == 1 && biases_nodes_id.size() == 1 &&
|
||||
input_node.get_output_layout().format == format::bfyx) {
|
||||
@@ -213,7 +212,7 @@ void pre_replace_deconv::run(program& p) {
|
||||
// reshape weights
|
||||
int pixel_shuffle_size = scale_factor * scale_factor;
|
||||
int kernel_size = 5;
|
||||
tensor target_weights_size = { pixel_shuffle_size, filter_size.feature[0], kernel_size, kernel_size };
|
||||
tensor target_weights_size = { pixel_shuffle_size, filter_layout.feature(), kernel_size, kernel_size };
|
||||
auto target_weights_layout = layout{ weights_layout.data_type, weights_layout.format, target_weights_size };
|
||||
|
||||
const primitive_id weight_replace_node_id = weight_node_id + "_conv_rpl";
|
||||
@@ -235,9 +234,9 @@ void pre_replace_deconv::run(program& p) {
|
||||
std::vector<std::vector<std::vector<float> > > subpixel_weights(pixel_shuffle_size);
|
||||
|
||||
program_helpers::reshape_deconvolution_weights(weights_vec_float,
|
||||
static_cast<int>(filter_size.feature[0]),
|
||||
static_cast<int>(filter_size.spatial[0]),
|
||||
static_cast<int>(filter_size.spatial[1]),
|
||||
static_cast<int>(filter_layout.feature()),
|
||||
static_cast<int>(filter_layout.spatial(0)),
|
||||
static_cast<int>(filter_layout.spatial(1)),
|
||||
scale_factor,
|
||||
subpixel_weights);
|
||||
|
||||
|
||||
@@ -141,14 +141,14 @@ 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.
|
||||
if (idx != node.get_dependencies().size() - 1) {
|
||||
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 != 1))
|
||||
(l.feature() % 16 != 0 || node.get_primitive()->axis != 1))
|
||||
return false;
|
||||
|
||||
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 != 1))
|
||||
(l.feature() % 32 != 0 || node.get_primitive()->axis != 1))
|
||||
return false;
|
||||
|
||||
if (l.format == format::b_fs_yx_fsv4 && (l.size.feature[0] != 4 || node.get_primitive()->axis != 1))
|
||||
if (l.format == format::b_fs_yx_fsv4 && (l.feature() != 4 || node.get_primitive()->axis != 1))
|
||||
return false;
|
||||
}
|
||||
idx++;
|
||||
@@ -348,7 +348,7 @@ void prepare_buffer_fusing::run(program& p) {
|
||||
const auto& crop_size = crop_layout.size;
|
||||
const auto& out_padd = crop_layout.data_padding;
|
||||
const auto opt_lower_pad = crop_prim->offsets.feature[0];
|
||||
const auto opt_upper_pad = input_layout.size.feature[0] - crop_prim->offsets.feature[0] - crop_size.feature[0];
|
||||
const auto opt_upper_pad = input_layout.feature() - crop_prim->offsets.feature[0] - crop_size.feature[0];
|
||||
|
||||
// do not optimize crop if paddings are not properly aligned
|
||||
for (auto& usr : node.get_users()) {
|
||||
@@ -365,9 +365,9 @@ void prepare_buffer_fusing::run(program& p) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (format == format::bfyx && crop_size.batch[0] == input_layout.size.batch[0] &&
|
||||
crop_size.spatial[0] == input_layout.size.spatial[0] &&
|
||||
crop_size.spatial[1] == input_layout.size.spatial[1] && out_padd.lower_size().feature[0] == 0 &&
|
||||
if (format == format::bfyx && crop_size.batch[0] == input_layout.batch() &&
|
||||
crop_size.spatial[0] == input_layout.spatial(0) &&
|
||||
crop_size.spatial[1] == input_layout.spatial(1) && out_padd.lower_size().feature[0] == 0 &&
|
||||
out_padd.upper_size().feature[0] == 0 && out_padd.lower_size().batch[0] == 0 &&
|
||||
out_padd.upper_size().batch[0] == 0 && out_padd.lower_size().spatial[0] == 0 &&
|
||||
out_padd.lower_size().spatial[1] == 0 && out_padd.upper_size().spatial[0] == 0 &&
|
||||
|
||||
@@ -292,13 +292,13 @@ void prepare_primitive_fusing::fuse_bias(program &p) {
|
||||
return node.as<fully_connected>().get_primitive()->input_size == 3;
|
||||
};
|
||||
|
||||
size_t out_features = static_cast<size_t>(node->get_output_layout().size.feature[0]);
|
||||
size_t out_features = static_cast<size_t>(node->get_output_layout().feature());
|
||||
|
||||
// Change out_features value to proper dimension for 3D FC case
|
||||
if (is_3d_fully_connected(node->get_dependency(0)))
|
||||
out_features = static_cast<size_t>(node->get_dependency(0).get_output_layout().size.spatial[1]);
|
||||
out_features = static_cast<size_t>(node->get_dependency(0).get_output_layout().spatial(1));
|
||||
else if (is_3d_fully_connected(node->get_dependency(1)))
|
||||
out_features = static_cast<size_t>(node->get_dependency(1).get_output_layout().size.spatial[1]);
|
||||
out_features = static_cast<size_t>(node->get_dependency(1).get_output_layout().spatial(1));
|
||||
|
||||
int bias_idx = -1;
|
||||
for (size_t i = 0; i < eltw_node.get_dependencies().size(); i++) {
|
||||
@@ -511,7 +511,7 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) {
|
||||
_lo.is_format_optimized(node, format::fs_b_yx_fsv32) && node.get_primitive()->groups == 1)))
|
||||
return true;
|
||||
|
||||
const size_t in_feature = node.get_dependency(0).get_output_layout().size.feature[0];
|
||||
const size_t in_feature = node.get_dependency(0).get_output_layout().feature();
|
||||
if ((node.get_output_layout().format == format::b_fs_zyx_fsv16 ||
|
||||
(_lo.is_format_optimized(node, format::b_fs_zyx_fsv16) &&
|
||||
_lo.get_optimization_attributes().b_fs_zyx_fsv16_network)) && in_feature != 3)
|
||||
@@ -543,7 +543,7 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) {
|
||||
|
||||
auto const_layout = eltw_node.get_dependency(1).get_output_layout();
|
||||
auto conv_layout = conv_node.get_output_layout();
|
||||
auto per_channel_eltwise = const_layout.size.feature[0] == conv_layout.size.feature[0];
|
||||
auto per_channel_eltwise = const_layout.feature() == conv_layout.feature();
|
||||
|
||||
if (eltw_node.get_dependency(1).is_constant() && per_channel_eltwise &&
|
||||
(eltw_prim.mode == eltwise_mode::sum || eltw_prim.mode == eltwise_mode::prod) &&
|
||||
@@ -601,8 +601,8 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) {
|
||||
auto& eltw = static_cast<const eltwise&>(*node.get_users().front()->get_primitive());
|
||||
auto& conv = node.get_dependency(0).as<convolution>();
|
||||
auto eltw_mode = eltw.mode == eltwise_mode::sum;
|
||||
auto conv_size = conv.get_dependency(0).get_output_layout().size.spatial[0] % 128 == 0 &&
|
||||
conv.get_dependency(0).get_output_layout().size.spatial[1] % 2 == 0;
|
||||
auto conv_size = conv.get_dependency(0).get_output_layout().spatial(0) % 128 == 0 &&
|
||||
conv.get_dependency(0).get_output_layout().spatial(1) % 2 == 0;
|
||||
auto format = conv.get_output_layout().format == format::bfyx;
|
||||
auto dt = conv.get_output_layout().data_type == data_types::f16;
|
||||
if (eltw_mode && conv_size && format && dt)
|
||||
@@ -624,7 +624,7 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) {
|
||||
auto eltwise_supports_fusings = [&](eltwise_node& node) -> bool {
|
||||
if (_lo.get_optimization_attributes().use_onednn_impls == 0) {
|
||||
auto out_layout = node.get_output_layout();
|
||||
if (out_layout.data_type == data_types::f16 && out_layout.size.batch[0] > 1 &&
|
||||
if (out_layout.data_type == data_types::f16 && out_layout.batch() > 1 &&
|
||||
(_lo.get_optimization_attributes().fs_b_yx_fsv32_network || out_layout.format == format::fs_b_yx_fsv32)) {
|
||||
return false;
|
||||
}
|
||||
@@ -840,10 +840,10 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) {
|
||||
bool should_fuse = input_data.is_type<binary_convolution>() &&
|
||||
((out_dt == data_types::bin &&
|
||||
quantize_node.get_dependencies().size() == 5 &&
|
||||
((in_layout.size.feature[0] == input_lo.get_output_layout().size.feature[0] &&
|
||||
in_layout.size.feature[0] == input_hi.get_output_layout().size.feature[0]) ||
|
||||
(input_lo.get_output_layout().size.feature[0] == 1 &&
|
||||
input_hi.get_output_layout().size.feature[0] == 1)))) &&
|
||||
((in_layout.feature() == input_lo.get_output_layout().feature() &&
|
||||
in_layout.feature() == input_hi.get_output_layout().feature()) ||
|
||||
(input_lo.get_output_layout().feature() == 1 &&
|
||||
input_hi.get_output_layout().feature() == 1)))) &&
|
||||
all_ones(input_data.as<binary_convolution>().get_primitive()->dilation);
|
||||
|
||||
auto expected_format = _lo.get_preferred_format(input_data);
|
||||
@@ -1018,10 +1018,10 @@ void prepare_primitive_fusing::fuse_simple_primitives(program &p) {
|
||||
auto peer_node = parents[peer_idx];
|
||||
|
||||
if (_lo.get_optimization_attributes().use_onednn_impls) {
|
||||
auto eltw_in_size = peer_node->get_output_layout().size;
|
||||
auto eltw_in_size = peer_node->get_output_layout();
|
||||
// Temporary disable mul fusion with full tensor as onednn doesn't support it
|
||||
if (fused_node->is_type<convolution>() && prim->mode == eltwise_mode::prod &&
|
||||
(eltw_in_size.spatial[0] > 1 || eltw_in_size.spatial[1] > 1 || eltw_in_size.batch[0] > 1))
|
||||
(eltw_in_size.spatial(0) > 1 || eltw_in_size.spatial(1) > 1 || eltw_in_size.batch() > 1))
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,10 +153,10 @@ void prepare_quantization::prepare_scale_shift_opt(program &p, quantize_node& q
|
||||
bool need_post_shift = false;
|
||||
int levels = quantize_node.get_primitive()->levels;
|
||||
|
||||
for (int b = 0; b < scales_layout.size.batch[0]; b++) {
|
||||
for (int f = 0; f < scales_layout.size.feature[0]; f++) {
|
||||
for (int y = 0; y < scales_layout.size.spatial[1]; y++) {
|
||||
for (int x = 0; x < scales_layout.size.spatial[0]; x++) {
|
||||
for (int b = 0; b < scales_layout.batch(); b++) {
|
||||
for (int f = 0; f < scales_layout.feature(); f++) {
|
||||
for (int y = 0; y < scales_layout.spatial(1); y++) {
|
||||
for (int x = 0; x < scales_layout.spatial(0); x++) {
|
||||
auto idx = cldnn::tensor(format::bfyx, {b, f, y, x}, 0);
|
||||
auto s_offset = scales_layout.get_linear_offset(idx);
|
||||
float in_lo = get_data_input_low(get_offset_safe(mem_input_low->get_layout(), idx));
|
||||
@@ -523,9 +523,9 @@ void prepare_quantization::prepare_asymmetric_quantization(program &p, convoluti
|
||||
const auto& wl = w->get_layout();
|
||||
|
||||
const int GS = groups;
|
||||
const int OC = wl.size.batch[0] / GS;
|
||||
const int IC = wl.size.feature[0]; // already divided by GS
|
||||
const int KS = wl.size.spatial[0]*wl.size.spatial[1]*wl.size.spatial[2];
|
||||
const int OC = wl.batch() / GS;
|
||||
const int IC = wl.feature(); // already divided by GS
|
||||
const int KS = wl.spatial(0)*wl.spatial(1)*wl.spatial(2);
|
||||
|
||||
const auto& w_dt = wl.data_type;
|
||||
const auto& azp_dt = azp->get_layout().data_type;
|
||||
@@ -609,8 +609,8 @@ void prepare_quantization::prepare_asymmetric_quantization(program &p, convoluti
|
||||
bool need_compensation = false;
|
||||
|
||||
auto output_size = convolution_node.get_output_layout().size;
|
||||
int ofm = in1.get_output_layout().size.batch[0];
|
||||
int ifm = in0.get_output_layout().size.feature[0];
|
||||
int ofm = in1.get_output_layout().batch();
|
||||
int ifm = in0.get_output_layout().feature();
|
||||
int ofm_aligned = ((ofm + 31) / 32) * 32;
|
||||
int ifm_aligned = ((ifm + 31) / 32) * 32;
|
||||
|
||||
@@ -619,7 +619,7 @@ void prepare_quantization::prepare_asymmetric_quantization(program &p, convoluti
|
||||
new_a_zp = &in0.get_dependency(1);
|
||||
|
||||
auto l = layout{new_a_zp->get_output_layout().data_type, format::bfyx, tensor{1, ifm_aligned, 1, 1}};
|
||||
int s = new_a_zp->get_output_layout().size.feature[0];
|
||||
int s = new_a_zp->get_output_layout().feature();
|
||||
auto azp_aligned = p.get_engine().allocate_memory(l);
|
||||
auto old_ptr = new_a_zp->as<data>().get_attached_memory_ptr();
|
||||
mem_lock<int8_t, mem_lock_type::write> new_data{azp_aligned, stream};
|
||||
@@ -642,7 +642,7 @@ void prepare_quantization::prepare_asymmetric_quantization(program &p, convoluti
|
||||
new_w_zp = &in1.get_dependency(1);
|
||||
|
||||
auto l = layout{new_w_zp->get_output_layout().data_type, format::bfyx, tensor{ofm_aligned, 1, 1, 1}};
|
||||
int s = new_w_zp->get_output_layout().size.batch[0];
|
||||
int s = new_w_zp->get_output_layout().batch();
|
||||
auto wzp_aligned = p.get_engine().allocate_memory(l);
|
||||
auto old_ptr = new_w_zp->as<data>().get_attached_memory_ptr();
|
||||
mem_lock<int8_t, mem_lock_type::write> new_data{wzp_aligned, stream};
|
||||
|
||||
@@ -210,7 +210,7 @@ void remove_redundant_reorders::run(program& p) {
|
||||
// Optimize reorder b_fs_yx_fsv16 -> bfyx when spatials are equal to 1. In this case we can reinterpret buffer,
|
||||
// but pads need to be handled correctly.
|
||||
if (i_layout.format == format::b_fs_yx_fsv16 && o_layout.format == format::bfyx && !r_node.is_output() &&
|
||||
i_layout.size.spatial[0] == 1 && i_layout.size.spatial[1] == 1 &&
|
||||
i_layout.spatial(0) == 1 && i_layout.spatial(1) == 1 &&
|
||||
i_layout.data_padding.upper_size().spatial[0] == 0 && i_layout.data_padding.lower_size().spatial[0] == 0 &&
|
||||
i_layout.data_padding.upper_size().spatial[1] == 0 && i_layout.data_padding.lower_size().spatial[1] == 0 &&
|
||||
o_layout.data_padding.upper_size() == (tensor)0 && o_layout.data_padding.lower_size() == (tensor)0 &&
|
||||
@@ -227,8 +227,8 @@ void remove_redundant_reorders::run(program& p) {
|
||||
pad_lo.feature[0] = i_layout.data_padding.lower_size().feature[0];
|
||||
pad_hi.feature[0] = i_layout.data_padding.upper_size().feature[0];
|
||||
|
||||
if (i_layout.size.feature[0] % 16 != 0) {
|
||||
pad_hi.feature[0] += 16 - i_layout.size.feature[0] % 16;
|
||||
if (i_layout.feature() % 16 != 0) {
|
||||
pad_hi.feature[0] += 16 - i_layout.feature() % 16;
|
||||
}
|
||||
|
||||
r_node.merge_output_padding(padding{pad_lo.sizes(), pad_hi.sizes()});
|
||||
|
||||
@@ -81,13 +81,12 @@ private:
|
||||
|
||||
auto function = instance.argument.function;
|
||||
auto& offset = instance.argument.offset;
|
||||
auto& range = compare_layout.size;
|
||||
|
||||
for (auto b = 0; b < range.batch[0]; b++) {
|
||||
for (auto f = 0; f < range.feature[0]; f++) {
|
||||
for (auto z = 0; z < range.spatial[2]; z++) {
|
||||
for (auto y = 0; y < range.spatial[1]; y++) {
|
||||
for (auto x = 0; x < range.spatial[0]; x++) {
|
||||
for (auto b = 0; b < compare_layout.batch(); b++) {
|
||||
for (auto f = 0; f < compare_layout.feature(); f++) {
|
||||
for (auto z = 0; z < compare_layout.spatial(2); z++) {
|
||||
for (auto y = 0; y < compare_layout.spatial(1); y++) {
|
||||
for (auto x = 0; x < compare_layout.spatial(0); x++) {
|
||||
tensor input_tensor{
|
||||
batch(b + offset.batch[0]),
|
||||
feature(f + offset.feature[0]),
|
||||
|
||||
@@ -425,12 +425,12 @@ struct detection_output_impl : typed_primitive_impl<detection_output> {
|
||||
const int num_of_images = static_cast<int>(locations.size());
|
||||
mem_lock<dtype, mem_lock_type::read> lock{input_location, stream};
|
||||
auto location_data = lock.begin();
|
||||
assert(num_of_priors * num_loc_classes * PRIOR_BOX_SIZE == input_location->get_layout().size.feature[0]);
|
||||
assert(num_of_priors * num_loc_classes * PRIOR_BOX_SIZE == input_location->get_layout().feature());
|
||||
|
||||
const auto& input_buffer_size = location_layout.get_buffer_size();
|
||||
const int input_buffer_size_x = input_buffer_size.spatial[0];
|
||||
const int input_buffer_size_y = input_buffer_size.spatial[1];
|
||||
const int input_buffer_size_f = input_buffer_size.feature[0];
|
||||
const auto& input_buffer_size = location_layout.get_padded_dims();
|
||||
const int input_buffer_size_x = input_buffer_size[3];
|
||||
const int input_buffer_size_y = input_buffer_size[2];
|
||||
const int input_buffer_size_f = input_buffer_size[1];
|
||||
const auto& input_padding = location_layout.data_padding;
|
||||
const int input_padding_lower_x = input_padding.lower_size().spatial[0];
|
||||
const int input_padding_lower_y = input_padding.lower_size().spatial[1];
|
||||
@@ -526,7 +526,7 @@ struct detection_output_impl : typed_primitive_impl<detection_output> {
|
||||
mem_lock<dtype, mem_lock_type::read> lock{input_confidence, stream};
|
||||
auto confidence_data = lock.begin();
|
||||
|
||||
assert(num_of_priors * num_classes == input_confidence->get_layout().size.feature[0]);
|
||||
assert(num_of_priors * num_classes == input_confidence->get_layout().feature());
|
||||
|
||||
const auto& input_buffer_size = input_confidence->get_layout().get_buffer_size();
|
||||
const int input_buffer_size_x = input_buffer_size.spatial[0];
|
||||
@@ -618,7 +618,7 @@ struct detection_output_impl : typed_primitive_impl<detection_output> {
|
||||
mem_lock<dtype, mem_lock_type::read> lock{input_confidence, stream};
|
||||
auto confidence_data = lock.begin();
|
||||
|
||||
assert(num_of_priors * num_classes == confidence_layout.size.feature[0]);
|
||||
assert(num_of_priors * num_classes == confidence_layout.feature());
|
||||
|
||||
const auto& input_buffer_size = confidence_layout.get_buffer_size();
|
||||
const int input_buffer_size_x = input_buffer_size.spatial[0];
|
||||
@@ -731,7 +731,7 @@ struct detection_output_impl : typed_primitive_impl<detection_output> {
|
||||
auto priors_layout = instance.prior_box_memory()->get_layout();
|
||||
|
||||
const int num_of_images = static_cast<int>(bboxes.size());
|
||||
const int num_of_priors = priors_layout.size.spatial[1] / args.prior_info_size;
|
||||
const int num_of_priors = priors_layout.spatial(1) / args.prior_info_size;
|
||||
const int num_loc_classes = args.share_location ? 1 : args.num_classes;
|
||||
|
||||
// Extract locations per image.
|
||||
@@ -739,7 +739,7 @@ struct detection_output_impl : typed_primitive_impl<detection_output> {
|
||||
num_of_images); // Per image : label -> bounding boxes.
|
||||
extract_locations_per_image<dtype>(stream, instance, locations, num_of_priors, num_loc_classes);
|
||||
|
||||
int32_t batches_in_prior_boxes = priors_layout.size.batch[0];
|
||||
int32_t batches_in_prior_boxes = priors_layout.batch();
|
||||
std::vector<bounding_box> prior_bboxes(batches_in_prior_boxes *
|
||||
num_of_priors); // Prior-Boxes (identical for all images since we assume
|
||||
// all images in a batch are of same dimension).
|
||||
@@ -804,7 +804,7 @@ struct detection_output_impl : typed_primitive_impl<detection_output> {
|
||||
auto& stream = instance.get_network().get_stream();
|
||||
|
||||
auto ev = stream.create_user_event(false);
|
||||
const int num_of_images = instance.location_memory()->get_layout().size.batch[0]; // batch size
|
||||
const int num_of_images = instance.location_memory()->get_layout().batch(); // batch size
|
||||
// Per image : label -> decoded bounding boxes.
|
||||
std::vector<std::vector<std::vector<bounding_box>>> bboxes(num_of_images);
|
||||
// Per image : class -> confidences per bounding box.
|
||||
|
||||
@@ -113,8 +113,8 @@ template <typename T>
|
||||
vector2D<bounding_box> load_boxes_impl(stream& stream, memory::ptr mem, bool center_point) {
|
||||
vector2D<bounding_box> result;
|
||||
auto lay = mem->get_layout();
|
||||
auto batch_size = lay.size.batch[0];
|
||||
auto boxes_num = lay.size.feature[0];
|
||||
auto batch_size = lay.batch();
|
||||
auto boxes_num = lay.feature();
|
||||
result.resize(batch_size);
|
||||
|
||||
mem_lock<T, mem_lock_type::read> boxes_lock(mem, stream);
|
||||
@@ -160,9 +160,9 @@ vector2D<bounding_box> load_boxes(stream& stream, memory::ptr mem, bool center_p
|
||||
template <typename T>
|
||||
vector3D<float> load_scores_impl(stream& stream, memory::ptr mem) {
|
||||
auto lay = mem->get_layout();
|
||||
auto batch_size = lay.size.batch[0];
|
||||
auto classes_num = lay.size.feature[0];
|
||||
auto boxes_num = lay.size.spatial[1];
|
||||
auto batch_size = lay.batch();
|
||||
auto classes_num = lay.feature();
|
||||
auto boxes_num = lay.spatial(1);
|
||||
|
||||
vector3D<float> result(batch_size, vector2D<float>(classes_num));
|
||||
|
||||
@@ -222,7 +222,7 @@ void store_result_impl(stream& stream, memory::ptr mem, const std::vector<result
|
||||
mem_lock<T, mem_lock_type::write> lock(mem, stream);
|
||||
auto ptr = lock.data();
|
||||
|
||||
auto output_size = static_cast<size_t>(mem->get_layout().size.batch[0]);
|
||||
auto output_size = static_cast<size_t>(mem->get_layout().batch());
|
||||
auto results_size = result.size();
|
||||
|
||||
size_t si = 0;
|
||||
@@ -276,7 +276,7 @@ void store_second_output_impl(stream& stream, memory::ptr mem, const std::vector
|
||||
mem_lock<T, mem_lock_type::write> lock(mem, stream);
|
||||
auto ptr = lock.data();
|
||||
|
||||
auto output_size = static_cast<size_t>(mem->get_layout().size.batch[0]);
|
||||
auto output_size = static_cast<size_t>(mem->get_layout().batch());
|
||||
auto results_size = result.size();
|
||||
|
||||
size_t si = 0;
|
||||
|
||||
@@ -278,9 +278,9 @@ struct proposal_impl : typed_primitive_impl<proposal> {
|
||||
bool for_deformable = instance.argument.for_deformable;
|
||||
|
||||
// feat map sizes
|
||||
const auto& score_size = cls_scores->get_layout().size;
|
||||
int fm_h = score_size.spatial[1];
|
||||
int fm_w = score_size.spatial[0];
|
||||
const auto& score_layout = cls_scores->get_layout();
|
||||
int fm_h = score_layout.spatial(1);
|
||||
int fm_w = score_layout.spatial(0);
|
||||
|
||||
int fm_sz = fm_w * fm_h;
|
||||
|
||||
@@ -289,7 +289,7 @@ struct proposal_impl : typed_primitive_impl<proposal> {
|
||||
const dtype* cls_scores_mem = cls_scores_ptr.data();
|
||||
const dtype* bbox_pred_mem = bbox_pred_ptr.data();
|
||||
|
||||
for (int n = 0; n < score_size.batch[0]; n++) {
|
||||
for (int n = 0; n < score_layout.batch(); n++) {
|
||||
std::vector<proposal_t> sorted_proposals_confidence;
|
||||
size_t num_proposals = fm_h * fm_w * anchors_num;
|
||||
sorted_proposals_confidence.reserve(num_proposals);
|
||||
@@ -431,7 +431,7 @@ struct proposal_impl : typed_primitive_impl<proposal> {
|
||||
|
||||
static primitive_impl* create(const proposal_node& arg) {
|
||||
const layout& l = arg.image_info().get_output_layout();
|
||||
const size_t count = l.size.feature[0] == 1 ? static_cast<size_t>(l.size.batch[0]) : static_cast<size_t>(l.size.feature[0]);
|
||||
const size_t count = l.feature() == 1 ? static_cast<size_t>(l.batch()) : static_cast<size_t>(l.feature());
|
||||
|
||||
// Supported image_info sizes and components meaning:
|
||||
// - image_info[3] = { img_height, img_width, img_depth }
|
||||
|
||||
@@ -48,8 +48,8 @@ struct activation_impl : typed_primitive_impl_ocl<activation> {
|
||||
CLDNN_ERROR_LESS_THAN(arg.id(),
|
||||
"Slope layout size count",
|
||||
slope_layout.size.count(),
|
||||
"output_layout.size.feature[0] * params_num",
|
||||
static_cast<size_t>(output_layout.size.feature[0] * params_num),
|
||||
"output_layout.feature() * params_num",
|
||||
static_cast<size_t>(output_layout.feature() * params_num),
|
||||
"Error - not enough data inside additional params buffer");
|
||||
|
||||
activation_params.inputActivationParams.push_back(convert_data_tensor(slope_layout));
|
||||
|
||||
@@ -62,7 +62,7 @@ protected:
|
||||
public:
|
||||
static primitive_impl* create(const binary_convolution_node& arg) {
|
||||
const auto& primitive = arg.get_primitive();
|
||||
const auto& weights_layout = arg.weights(0).get_output_layout();
|
||||
const auto& weights_layout = arg.weights(0).get_output_layout().convert_to_weights_layout(false);
|
||||
const auto& weights_size = weights_layout.size;
|
||||
|
||||
const auto& split = primitive->split();
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
const auto depthwise_separable_opt = arg.get_depthwise_sep_opt();
|
||||
const auto actual_split = depthwise_separable_opt ? (decltype(split))1 : split;
|
||||
|
||||
assert(arg.get_output_layout().size.feature[0] / primitive->split() == weights_layout.size.batch[0]);
|
||||
assert(arg.get_output_layout().feature() / primitive->split() == weights_layout.batch());
|
||||
|
||||
auto conv_params =
|
||||
get_weights_bias_default_params<kernel_selector::binary_convolution_params>(arg, actual_split);
|
||||
|
||||
@@ -62,11 +62,10 @@ protected:
|
||||
public:
|
||||
static primitive_impl* create(const convolution_node& arg) {
|
||||
const auto& primitive = arg.get_primitive();
|
||||
const auto& weights_layout = arg.weights(0).get_output_layout();
|
||||
const auto& weights_size = weights_layout.size;
|
||||
const auto& weights_layout = arg.weights(0).get_output_layout().convert_to_weights_layout(primitive->grouped_weights_shape);
|
||||
|
||||
const auto &split = primitive->split();
|
||||
const auto& stride = primitive->stride;
|
||||
auto stride = primitive->stride;
|
||||
const auto& dilation = primitive->dilation;
|
||||
const auto& pad = primitive->pad;
|
||||
const auto& groups = primitive->groups;
|
||||
@@ -94,10 +93,9 @@ public:
|
||||
conv_params.split = split;
|
||||
conv_params.groups = groups;
|
||||
|
||||
auto spatial_size = arg.get_output_layout().format.dimension() - 2;
|
||||
uint32_t kx = weights_size.spatial[0];
|
||||
uint32_t ky = weights_size.spatial[1];
|
||||
uint32_t kz = spatial_size == 2 ? 1 : weights_size.spatial[2];
|
||||
uint32_t kx = weights_layout.spatial(0);
|
||||
uint32_t ky = weights_layout.spatial(1);
|
||||
uint32_t kz = weights_layout.spatial(2);
|
||||
conv_params.filterSize = { kx, ky, kz };
|
||||
|
||||
uint32_t pad_z = std::max<std::ptrdiff_t>(pad.size() >= 3 ? pad[pad.size() - 3] : 0, 0);
|
||||
|
||||
@@ -53,9 +53,7 @@ protected:
|
||||
public:
|
||||
static primitive_impl* create(const deconvolution_node& arg) {
|
||||
const auto& primitive = arg.get_primitive();
|
||||
const auto& weights_layout = arg.weights(0).get_output_layout();
|
||||
|
||||
const auto& weights_size = weights_layout.size;
|
||||
const auto& weights_layout = arg.weights(0).get_output_layout().convert_to_weights_layout(primitive->grouped_weights_shape);
|
||||
|
||||
const auto& split = primitive->split();
|
||||
const auto& stride = primitive->stride;
|
||||
@@ -80,10 +78,10 @@ public:
|
||||
deconv_params.split = split;
|
||||
deconv_params.groups = groups;
|
||||
|
||||
auto spatial_size = arg.get_output_layout().format.dimension() - 2;
|
||||
uint32_t kx = weights_size.spatial[0];
|
||||
uint32_t ky = weights_size.spatial[1];
|
||||
uint32_t kz = spatial_size == 2 ? 1 : weights_size.spatial[2];
|
||||
uint32_t kx = weights_layout.spatial(0);
|
||||
uint32_t ky = weights_layout.spatial(1);
|
||||
uint32_t kz = weights_layout.spatial(2);
|
||||
|
||||
deconv_params.filterSize = { kx, ky, kz };
|
||||
|
||||
uint32_t pad_z = std::max<std::ptrdiff_t>(pad.size() >= 3 ? pad[pad.size() - 3] : 0, 0);
|
||||
|
||||
@@ -39,7 +39,7 @@ protected:
|
||||
public:
|
||||
static primitive_impl* create(const deformable_conv_node& arg) {
|
||||
const auto& primitive = arg.get_primitive();
|
||||
const auto& weights_layout = arg.weights(0).get_output_layout();
|
||||
const auto& weights_layout = arg.weights(0).get_output_layout().convert_to_weights_layout(false);
|
||||
const auto& weights_size = weights_layout.size;
|
||||
|
||||
const auto& split = primitive->split();
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
const auto& input_layout = arg.input().get_output_layout();
|
||||
const auto& kernel_size = primitive->kernel_size;
|
||||
|
||||
const auto& stride = primitive->stride;
|
||||
auto stride = primitive->stride;
|
||||
const auto& dilation = primitive->dilation;
|
||||
const auto& pad = primitive->pad;
|
||||
const auto& groups = primitive->groups;
|
||||
@@ -132,7 +132,6 @@ public:
|
||||
uint32_t dilation_z = dilation.size() >= 3 ? dilation[dilation.size() - 3] : 1;
|
||||
uint32_t dilation_y = dilation.size() >= 2 ? dilation[dilation.size() - 2] : 1;
|
||||
uint32_t dilation_x = dilation.size() >= 1 ? dilation[dilation.size() - 1] : 1;
|
||||
|
||||
conv_params.dilation = {dilation_x, dilation_y, dilation_z};
|
||||
|
||||
conv_params.kernelSize = { (uint32_t)kernel_size.spatial[0],
|
||||
|
||||
@@ -44,8 +44,8 @@ private:
|
||||
detectOutParams.decrease_label_id = primitive->decrease_label_id;
|
||||
detectOutParams.clip_before_nms = primitive->clip_before_nms;
|
||||
detectOutParams.clip_after_nms = primitive->clip_after_nms;
|
||||
detectOutParams.conf_size_x = arg.confidence().get_output_layout().get_buffer_size().spatial[0];
|
||||
detectOutParams.conf_size_y = arg.confidence().get_output_layout().get_buffer_size().spatial[1];
|
||||
detectOutParams.conf_size_x = arg.confidence().get_output_layout().get_padded_dims()[2];
|
||||
detectOutParams.conf_size_y = arg.confidence().get_output_layout().get_padded_dims()[3];
|
||||
detectOutParams.conf_padding_x = arg.confidence().get_output_layout().data_padding.lower_size().spatial[0];
|
||||
detectOutParams.conf_padding_y = arg.confidence().get_output_layout().data_padding.lower_size().spatial[1];
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
const auto& cell_layout = arg.cell().get_output_layout();
|
||||
lstm_elt_params.SetCell(convert_data_tensor(cell_layout));
|
||||
// TODO: make a generic function to get the direction
|
||||
if (cell_layout.size.spatial[1] > 1) {
|
||||
if (cell_layout.spatial(1) > 1) {
|
||||
lstm_elt_params.cell_direction = arg.direction();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
const auto& hidden_layout = arg.hidden().get_output_layout();
|
||||
lstm_gemm_params.SetHidden(convert_data_tensor(hidden_layout));
|
||||
// TODO: make a generic function to get the direction
|
||||
if (hidden_layout.size.spatial[1] > 1) {
|
||||
if (hidden_layout.spatial(1) > 1) {
|
||||
lstm_gemm_params.hidden_direction = arg.direction();
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
|
||||
// Update the direction of the input for the gemm kernel
|
||||
const auto& input_layout = arg.input().get_output_layout();
|
||||
size_t input_directions = input_layout.size.spatial[1];
|
||||
size_t input_directions = input_layout.spatial(1);
|
||||
|
||||
if (input_directions > 1) { // For bidirection input, input direction can be 1 or 0
|
||||
lstm_gemm_params.input_direction = arg.direction();
|
||||
|
||||
@@ -38,8 +38,8 @@ struct pyramid_roi_align_impl : typed_primitive_impl_ocl<pyramid_roi_align> {
|
||||
params.sampling_ratio_y = prim->sampling_ratio;
|
||||
|
||||
auto first_layer_scale = prim->pyramid_scales[0];
|
||||
auto image_size_x = arg.P2().get_output_layout().size.spatial[0] * first_layer_scale;
|
||||
auto image_size_y = arg.P2().get_output_layout().size.spatial[1] * first_layer_scale;
|
||||
auto image_size_x = arg.P2().get_output_layout().spatial(0) * first_layer_scale;
|
||||
auto image_size_y = arg.P2().get_output_layout().spatial(1) * first_layer_scale;
|
||||
params.image_size_x = image_size_x;
|
||||
params.image_size_y = image_size_y;
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
if (output_layout.format == format::winograd_2x3_s1_data) {
|
||||
reorder_params.winograd_input_offset_x = 0;
|
||||
reorder_params.winograd_input_offset_y = 0;
|
||||
reorder_params.winograd_nr_tiles_x = ceil_div(output_layout.size.spatial[0], 4);
|
||||
reorder_params.winograd_nr_tiles_x = ceil_div(output_layout.spatial(0), 4);
|
||||
}
|
||||
|
||||
reorder_params.winograd = input_layout.format.is_winograd() || output_layout.format.is_winograd();
|
||||
|
||||
@@ -126,7 +126,7 @@ void combine_bf_with_first_spatial_dim(cldnn::layout& l) {
|
||||
auto rank = cldnn::format::dimension(l.format);
|
||||
auto last_spatial_dim_idx = rank - 2 - 1;
|
||||
|
||||
l.size.batch[0] *= l.size.feature[0];
|
||||
l.size.batch[0] *= l.feature();
|
||||
l.size.feature[0] = l.size.spatial[last_spatial_dim_idx];
|
||||
l.size.spatial[last_spatial_dim_idx] = 1;
|
||||
}
|
||||
@@ -164,8 +164,8 @@ dnnl::memory::desc layout_to_memory_desc(cldnn::layout l, dnnl::memory::format_t
|
||||
dims.insert(dims.begin(), 1);
|
||||
padded_dims = dims;
|
||||
} else if (target_fmt == dnnl::memory::format_tag::ab) {
|
||||
dims.push_back(l.size.batch[0]);
|
||||
dims.push_back(l.size.count() / l.size.batch[0]);
|
||||
dims.push_back(l.batch());
|
||||
dims.push_back(l.size.count() / l.batch());
|
||||
padded_dims = dims;
|
||||
} else if (flatten) {
|
||||
dims = flatten_tensor(l.size);
|
||||
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
return get_dependency(3);
|
||||
}
|
||||
|
||||
int32_t direction() const { return weights().get_output_layout().size.feature[0]; }
|
||||
int32_t direction() const { return weights().get_output_layout().feature(); }
|
||||
bool dyn_length_term() const { return !get_primitive()->dyn_length.empty(); }
|
||||
bool bias_term() const { return !get_primitive()->bias.empty(); }
|
||||
bool weights_term() const { return !get_primitive()->weights.empty(); }
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
typed_primitive_inst(network& network, lstm_dynamic_node const& node);
|
||||
|
||||
static void check_direction(program_node& node, int32_t direction, std::string name) {
|
||||
if (node.get_output_layout().size.spatial[1] != direction)
|
||||
if (node.get_output_layout().spatial(1) != direction)
|
||||
CLDNN_ERROR_MESSAGE(node.id(), name + " directions size need to equal 1 or 2 (bidrectional) !");
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
int32_t hidden_size,
|
||||
int32_t direction,
|
||||
std::string name) {
|
||||
auto node_tensor = node.get_output_layout().size;
|
||||
auto node_layout = node.get_output_layout();
|
||||
CLDNN_ERROR_NOT_PROPER_FORMAT(node.id(),
|
||||
name + " format",
|
||||
node.get_output_layout().format.value,
|
||||
@@ -60,20 +60,20 @@ public:
|
||||
format::bfyx);
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
name + " batch size",
|
||||
node_tensor.batch[0],
|
||||
node_layout.batch(),
|
||||
"input batch size",
|
||||
batch_size,
|
||||
"Sizes mismatch, " + name + ": " + node.id());
|
||||
check_direction(node, direction, name);
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
name + " x size",
|
||||
node_tensor.spatial[0],
|
||||
node_layout.spatial(0),
|
||||
"input_size",
|
||||
hidden_size,
|
||||
"Sizes mismatch, " + name + ": " + node.id());
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
name + " f size",
|
||||
node_tensor.feature[0],
|
||||
node_layout.feature(),
|
||||
"1",
|
||||
1,
|
||||
"Sizes mismatch, " + name + ": " + node.id());
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
program_node& initial_cell() const { return get_dependency_by_name("initial_cell"); }
|
||||
|
||||
float clip() const { return get_primitive()->clip; }
|
||||
int32_t direction() const { return recurrent().get_output_layout().size.feature[0]; }
|
||||
int32_t direction() const { return recurrent().get_output_layout().feature(); }
|
||||
bool input_forget() const { return get_primitive()->input_forget; }
|
||||
bool dyn_length_term() const { return !get_primitive()->dyn_length.empty(); }
|
||||
bool recurrent_term() const { return !get_primitive()->recurrent.empty(); }
|
||||
|
||||
@@ -112,8 +112,6 @@ kernel_selector::data_layout to_data_layout(format f) {
|
||||
return kernel_selector::data_layout::bs_f_bsv16__af8;
|
||||
case format::bs_xs_xsv8_bsv8:
|
||||
return kernel_selector::data_layout::bs_f_bsv8__af8;
|
||||
case format::bs_xs_xsv8_bsv16:
|
||||
return kernel_selector::data_layout::bs_f_bsv16__af8;
|
||||
case format::winograd_2x3_s1_data:
|
||||
return kernel_selector::data_layout::winograd_2x3_s1_data;
|
||||
case format::b_fs_yx_fsv4:
|
||||
@@ -320,8 +318,9 @@ kernel_selector::weights_layout to_weights_layout(format f, bool is_grouped) {
|
||||
case format::iozyx:
|
||||
return kernel_selector::weights_layout::iozyx;
|
||||
case format::bs_xs_xsv8_bsv8:
|
||||
case format::os_i_osv8__ai8:
|
||||
return kernel_selector::weights_layout::os_i_osv8__ai8;
|
||||
case format::bs_xs_xsv8_bsv16:
|
||||
case format::os_i_osv16__ai8:
|
||||
return kernel_selector::weights_layout::os_i_osv16__ai8;
|
||||
case format::bs_x_bsv16:
|
||||
return kernel_selector::weights_layout::os_i_osv16;
|
||||
@@ -407,17 +406,16 @@ kernel_selector::weights_layout to_weights_layout(format f, bool is_grouped) {
|
||||
cldnn::format::type from_weights_layout(kernel_selector::weights_layout l) {
|
||||
switch (l) {
|
||||
case kernel_selector::weights_layout::oi:
|
||||
return cldnn::format::bfyx;
|
||||
return cldnn::format::oiyx;
|
||||
case kernel_selector::weights_layout::oiyx:
|
||||
return cldnn::format::bfyx;
|
||||
return cldnn::format::oiyx;
|
||||
case kernel_selector::weights_layout::oyxi:
|
||||
return cldnn::format::byxf;
|
||||
return cldnn::format::oyxi;
|
||||
case kernel_selector::weights_layout::io:
|
||||
return cldnn::format::iyxo;
|
||||
case kernel_selector::weights_layout::iyxo:
|
||||
return cldnn::format::iyxo;
|
||||
case kernel_selector::weights_layout::yxio:
|
||||
return cldnn::format::yxfb;
|
||||
return cldnn::format::yxio;
|
||||
case kernel_selector::weights_layout::os_yxi_osv16:
|
||||
return cldnn::format::os_yxi_osv16;
|
||||
case kernel_selector::weights_layout::o_is_yx_isv16:
|
||||
@@ -435,9 +433,9 @@ cldnn::format::type from_weights_layout(kernel_selector::weights_layout l) {
|
||||
case kernel_selector::weights_layout::os_i_osv16:
|
||||
return cldnn::format::bs_x_bsv16;
|
||||
case kernel_selector::weights_layout::os_i_osv8__ai8:
|
||||
return cldnn::format::bs_xs_xsv8_bsv8;
|
||||
return cldnn::format::os_i_osv8__ai8;
|
||||
case kernel_selector::weights_layout::os_i_osv16__ai8:
|
||||
return cldnn::format::bs_xs_xsv8_bsv16;
|
||||
return cldnn::format::os_i_osv16__ai8;
|
||||
case kernel_selector::weights_layout::image_2d_weights_c4_fyx_b:
|
||||
return cldnn::format::image_2d_weights_c4_fyx_b;
|
||||
case kernel_selector::weights_layout::image_2d_weights_c1_b_fyx:
|
||||
@@ -511,7 +509,7 @@ cldnn::format::type from_weights_layout(kernel_selector::weights_layout l) {
|
||||
case kernel_selector::weights_layout::os_is_yx_osv32_isv32p:
|
||||
return cldnn::format::os_is_yx_osv32_isv32p;
|
||||
case kernel_selector::weights_layout::oizyx:
|
||||
return cldnn::format::bfzyx;
|
||||
return cldnn::format::oizyx;
|
||||
case kernel_selector::weights_layout::os_is_zyx_isv16_osv16:
|
||||
return cldnn::format::os_is_zyx_isv16_osv16;
|
||||
case kernel_selector::weights_layout::is_os_zyx_isv16_osv16:
|
||||
|
||||
@@ -231,8 +231,8 @@ bool layout_optimizer::can_fuse_reorder(program_node& prev, program_node& next,
|
||||
return true;
|
||||
|
||||
if (next.is_type<permute>() && (fmt_prev == format::b_fs_zyx_fsv16 &&
|
||||
next_output_layout.size.batch[0] > 1 &&
|
||||
next_output_layout.size.feature[0] % 16 != 0)) {
|
||||
next_output_layout.batch() > 1 &&
|
||||
next_output_layout.feature() % 16 != 0)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -241,9 +241,9 @@ bool layout_optimizer::can_fuse_reorder(program_node& prev, program_node& next,
|
||||
fmt_prev == format::b_fs_yx_fsv16 || fmt_prev == format::fs_b_yx_fsv32 ||
|
||||
fmt_prev == format::b_fs_yx_fsv32 ||
|
||||
(fmt_prev == format::b_fs_yx_fsv4 &&
|
||||
prev_output_layout.size.feature[0] % 32 == 0 &&
|
||||
prev_output_layout.size.spatial[0] == 1 &&
|
||||
prev_output_layout.size.spatial[1] == 1)))
|
||||
prev_output_layout.feature() % 32 == 0 &&
|
||||
prev_output_layout.spatial(0) == 1 &&
|
||||
prev_output_layout.spatial(1) == 1)))
|
||||
return true;
|
||||
|
||||
if (next.is_type<convolution>() && fmt_prev == format::b_fs_yx_fsv16 && fmt_next == format::b_fs_yx_fsv4 && is_input_idx(0))
|
||||
@@ -258,30 +258,30 @@ bool layout_optimizer::can_fuse_reorder(program_node& prev, program_node& next,
|
||||
(!use_onednn_impls || fmt_prev == fmt_next) &&
|
||||
(fmt_prev == format::bfyx || fmt_prev == format::bs_fs_yx_bsv4_fsv2) &&
|
||||
((fmt_next == format::fs_b_yx_fsv32 && next.as<convolution>().get_primitive()->groups == 1) ||
|
||||
(fmt_next == format::b_fs_yx_fsv32 && (prev_output_layout.size.feature[0] == 3 || prev_output_layout.size.feature[0] == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv32_fsv32 && (prev_output_layout.size.feature[0] == 3 || prev_output_layout.size.feature[0] == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv32_fsv16 && (prev_output_layout.size.feature[0] == 3 || prev_output_layout.size.feature[0] == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv16_fsv16 && next_output_layout.size.feature[0] % 16 == 0 && prev_output_layout.size.feature[0] == 3) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv16_fsv16 && next_output_layout.size.feature[0] >= 16 && prev_output_layout.size.feature[0] == 3 &&
|
||||
(fmt_next == format::b_fs_yx_fsv32 && (prev_output_layout.feature() == 3 || prev_output_layout.feature() == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv32_fsv32 && (prev_output_layout.feature() == 3 || prev_output_layout.feature() == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv32_fsv16 && (prev_output_layout.feature() == 3 || prev_output_layout.feature() == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv16_fsv16 && next_output_layout.feature() % 16 == 0 && prev_output_layout.feature() == 3) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv16_fsv16 && next_output_layout.feature() >= 16 && prev_output_layout.feature() == 3 &&
|
||||
(next_output_layout.data_type != data_types::i8 && next_output_layout.data_type != data_types::u8))))
|
||||
return true;
|
||||
|
||||
if (next.is_type<convolution>() &&
|
||||
fmt_prev == format::bfyx && !use_onednn_impls &&
|
||||
(fmt_next == format::b_fs_yx_fsv16 || fmt_next == format::bs_fs_yx_bsv32_fsv16) &&
|
||||
next_output_layout.size.feature[0] >= 16 && prev_output_layout.size.feature[0] <= 4 &&
|
||||
next_output_layout.feature() >= 16 && prev_output_layout.feature() <= 4 &&
|
||||
next.as<convolution>().get_primitive()->activations_zero_points.empty() &&
|
||||
next.as<convolution>().get_primitive()->weights_zero_points.empty())
|
||||
return true;
|
||||
|
||||
if (next.is_type<convolution>() && !use_onednn_impls &&
|
||||
(fmt_prev == format::b_fs_yx_fsv4 || fmt_prev == format::bs_fs_yx_bsv4_fsv4 || fmt_prev == format::bs_fs_yx_bsv8_fsv4) &&
|
||||
((fmt_next == format::b_fs_yx_fsv32 && (prev_output_layout.size.feature[0] == 3 || prev_output_layout.size.feature[0] == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv32_fsv32 && (prev_output_layout.size.feature[0] == 3 || prev_output_layout.size.feature[0] == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv4_fsv4 && (prev_output_layout.size.feature[0] == 3 || prev_output_layout.size.feature[0] == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv8_fsv4 && (prev_output_layout.size.feature[0] == 3 || prev_output_layout.size.feature[0] == 4)) ||
|
||||
(fmt_next == format::b_fs_yx_fsv16 && next_output_layout.size.feature[0] >= 16 &&
|
||||
(prev_output_layout.size.feature[0] == 3 || (prev_output_layout.size.feature[0] == 4 && (prev_dt == data_types::u8 || prev_dt == data_types::i8))))))
|
||||
((fmt_next == format::b_fs_yx_fsv32 && (prev_output_layout.feature() == 3 || prev_output_layout.feature() == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv32_fsv32 && (prev_output_layout.feature() == 3 || prev_output_layout.feature() == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv4_fsv4 && (prev_output_layout.feature() == 3 || prev_output_layout.feature() == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv8_fsv4 && (prev_output_layout.feature() == 3 || prev_output_layout.feature() == 4)) ||
|
||||
(fmt_next == format::b_fs_yx_fsv16 && next_output_layout.feature() >= 16 &&
|
||||
(prev_output_layout.feature() == 3 || (prev_output_layout.feature() == 4 && (prev_dt == data_types::u8 || prev_dt == data_types::i8))))))
|
||||
return true;
|
||||
|
||||
if (next.is_type<quantize>() && (fmt_prev == format::bfyx || fmt_prev == format::bfzyx) &&
|
||||
@@ -291,7 +291,7 @@ bool layout_optimizer::can_fuse_reorder(program_node& prev, program_node& next,
|
||||
|
||||
if (next.is_type<convolution>() &&
|
||||
!(prev.is_type<quantize>() && (prev_dt == data_types::i8 || prev_dt == data_types::u8)) &&
|
||||
(fmt_prev == format::b_fs_yx_fsv4 || fmt_prev == format::bfyx) && prev_output_layout.size.feature[0] == 3 &&
|
||||
(fmt_prev == format::b_fs_yx_fsv4 || fmt_prev == format::bfyx) && prev_output_layout.feature() == 3 &&
|
||||
(fmt_next == format::b_fs_yx_fsv4 ||
|
||||
fmt_next == format::bs_fs_yx_bsv16_fsv16))
|
||||
return true;
|
||||
@@ -299,7 +299,7 @@ bool layout_optimizer::can_fuse_reorder(program_node& prev, program_node& next,
|
||||
if (next.is_type<convolution>() &&
|
||||
fmt_prev == format::bfzyx &&
|
||||
((fmt_next == format::b_fs_zyx_fsv16 || fmt_next == format::bs_fs_zyx_bsv16_fsv16) &&
|
||||
next_output_layout.size.feature[0] >= 16 && prev_output_layout.size.feature[0] == 3))
|
||||
next_output_layout.feature() >= 16 && prev_output_layout.feature() == 3))
|
||||
return true;
|
||||
|
||||
if (use_onednn_impls) {
|
||||
@@ -318,8 +318,8 @@ bool layout_optimizer::can_fuse_reorder(program_node& prev, program_node& next,
|
||||
// Remove reorder to support mixed format convolutions of bsv32fsv16 or bsv32fsv32 output
|
||||
if (next.is_type<convolution>() && (prev.is_type<eltwise>() || prev.is_type<quantize>()) &&
|
||||
(fmt_prev == format::bfyx || fmt_prev == format::bs_fs_yx_bsv4_fsv2 || fmt_prev == format::bs_fs_yx_bsv8_fsv4) &&
|
||||
((fmt_next == format::bs_fs_yx_bsv32_fsv32 && (prev_output_layout.size.feature[0] == 3 || prev_output_layout.size.feature[0] == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv32_fsv16 && (prev_output_layout.size.feature[0] == 3 || prev_output_layout.size.feature[0] == 4))))
|
||||
((fmt_next == format::bs_fs_yx_bsv32_fsv32 && (prev_output_layout.feature() == 3 || prev_output_layout.feature() == 4)) ||
|
||||
(fmt_next == format::bs_fs_yx_bsv32_fsv16 && (prev_output_layout.feature() == 3 || prev_output_layout.feature() == 4))))
|
||||
return true;
|
||||
|
||||
// Remove reorder to support blocked input for first convolution
|
||||
@@ -450,10 +450,10 @@ bool should_use_winograd_2x3_s1(std::shared_ptr<const convolution> const& prim,
|
||||
bool output_size_handling_enabled) {
|
||||
// cases when NOT to use winograd
|
||||
if (input_layout.data_type != data_types::f16
|
||||
|| input_layout.size.feature[0] % 64 != 0 // current algorithm is effective for ifm to be multiply of 64
|
||||
|| weights_layout.size.spatial[0] != 3 // weights have to be 3x3 by definiton
|
||||
|| weights_layout.size.spatial[1] != 3 // weights have to be 3x3 by definition
|
||||
|| weights_layout.size.batch[0] % 64 != 0 // current algorithm is effective for ofm to be multiply of 64
|
||||
|| input_layout.feature() % 64 != 0 // current algorithm is effective for ifm to be multiply of 64
|
||||
|| weights_layout.spatial(0) != 3 // weights have to be 3x3 by definiton
|
||||
|| weights_layout.spatial(1) != 3 // weights have to be 3x3 by definition
|
||||
|| weights_layout.batch() % 64 != 0 // current algorithm is effective for ofm to be multiply of 64
|
||||
|| any_not_one(prim->stride) // stride has to be 1x1 by definition
|
||||
|| any_not_one(prim->dilation) // no support for dilation
|
||||
|| prim->split() != 1 // no support for splitted convolutions
|
||||
@@ -461,8 +461,8 @@ bool should_use_winograd_2x3_s1(std::shared_ptr<const convolution> const& prim,
|
||||
prim->with_output_size) // no support for convolutions with user-specified output size
|
||||
|| (input_layout.count() > 3000000) // limit max input size as winograd consumes more memory
|
||||
|| (input_layout.count() < 50000) // limit min input size as winograd is not effective for small input
|
||||
|| (input_layout.size.spatial[0] < 8 &&
|
||||
input_layout.size.spatial[1] < 8) // disable winograd for small spatials as perf is poor
|
||||
|| (input_layout.spatial(0) < 8 &&
|
||||
input_layout.spatial(1) < 8) // disable winograd for small spatials as perf is poor
|
||||
|| prim->groups != 1) { // disable winograd for groups
|
||||
return false;
|
||||
}
|
||||
@@ -489,28 +489,28 @@ bool layout_optimizer::convolution_bfyx_opt(layout const& output_layout,
|
||||
const layout& weights_layout,
|
||||
std::shared_ptr<const convolution> conv) {
|
||||
// A set of rules that define when bfyx mem format has better performance than yxfb
|
||||
if (output_layout.size.batch[0] == 16 || output_layout.size.batch[0] % 16 != 0 ||
|
||||
output_layout.data_type != data_types::f16 || weights_layout.size.batch[0] % 16 != 0 ||
|
||||
!((weights_layout.size.spatial[0] == 1 && weights_layout.size.spatial[1] == 1) ||
|
||||
(weights_layout.size.spatial[0] >= 5 && weights_layout.size.spatial[1] >= 5) ||
|
||||
if (output_layout.batch() == 16 || output_layout.batch() % 16 != 0 ||
|
||||
output_layout.data_type != data_types::f16 || weights_layout.batch() % 16 != 0 ||
|
||||
!((weights_layout.spatial(0) == 1 && weights_layout.spatial(1) == 1) ||
|
||||
(weights_layout.spatial(0) >= 5 && weights_layout.spatial(1) >= 5) ||
|
||||
(conv->stride[0] > 1 && conv->stride[1] > 1) ||
|
||||
(weights_layout.size.feature[0] <= 32 && output_layout.size.spatial[0] < 224 &&
|
||||
output_layout.size.spatial[1] < 224) ||
|
||||
(weights_layout.size.feature[0] <= 64 && output_layout.size.spatial[0] < 112 &&
|
||||
output_layout.size.spatial[1] < 112) ||
|
||||
(weights_layout.size.feature[0] <= 128 && output_layout.size.spatial[0] < 56 &&
|
||||
output_layout.size.spatial[1] < 56) ||
|
||||
(weights_layout.size.feature[0] <= 256 && output_layout.size.spatial[0] < 28 &&
|
||||
output_layout.size.spatial[1] < 28) ||
|
||||
(weights_layout.size.feature[0] <= 512 && output_layout.size.spatial[0] < 14 &&
|
||||
output_layout.size.spatial[1] < 14) ||
|
||||
(weights_layout.size.feature[0] <= 1024 && output_layout.size.spatial[0] <= 7 &&
|
||||
output_layout.size.spatial[1] <= 7)) ||
|
||||
(weights_layout.size.feature[0] <= 32 && output_layout.spatial(0) < 224 &&
|
||||
output_layout.spatial(1) < 224) ||
|
||||
(weights_layout.size.feature[0] <= 64 && output_layout.spatial(0) < 112 &&
|
||||
output_layout.spatial(1) < 112) ||
|
||||
(weights_layout.size.feature[0] <= 128 && output_layout.spatial(0) < 56 &&
|
||||
output_layout.spatial(1) < 56) ||
|
||||
(weights_layout.size.feature[0] <= 256 && output_layout.spatial(0) < 28 &&
|
||||
output_layout.spatial(1) < 28) ||
|
||||
(weights_layout.size.feature[0] <= 512 && output_layout.spatial(0) < 14 &&
|
||||
output_layout.spatial(1) < 14) ||
|
||||
(weights_layout.size.feature[0] <= 1024 && output_layout.spatial(0) <= 7 &&
|
||||
output_layout.spatial(1) <= 7)) ||
|
||||
// WA for AgeGender, which has one convolution that is better on yxfb, but due to additonal reorder overall
|
||||
// performance is worse than bfyx
|
||||
(output_layout.size.spatial[0] == 82 && output_layout.size.spatial[1] == 82) ||
|
||||
(_optimization_attributes.splitted_convolution && output_layout.size.batch[0] == 16) ||
|
||||
(!_optimization_attributes.splitted_convolution && output_layout.size.batch[0] >= 128) ||
|
||||
(output_layout.spatial(0) == 82 && output_layout.spatial(1) == 82) ||
|
||||
(_optimization_attributes.splitted_convolution && output_layout.batch() == 16) ||
|
||||
(!_optimization_attributes.splitted_convolution && output_layout.batch() >= 128) ||
|
||||
_optimization_attributes.bfyx_only_layer)
|
||||
return true;
|
||||
|
||||
@@ -534,9 +534,9 @@ bool layout_optimizer::convolution_byxf_opt(const layout& input_layout,
|
||||
all_ones(conv->dilation) &&
|
||||
!node.get_transposed() &&
|
||||
node.get_groups() == 1 &&
|
||||
input_layout.size.feature[0] % 32 == 0 &&
|
||||
weights_layout.size.spatial[1] == 1 && output_layout.size.feature[0] % 64 == 0 &&
|
||||
weights_layout.size.batch[0] % 64 == 0 &&
|
||||
input_layout.feature() % 32 == 0 &&
|
||||
weights_layout.spatial(1) == 1 && output_layout.feature() % 64 == 0 &&
|
||||
weights_layout.batch() % 64 == 0 &&
|
||||
all_ones(conv->stride) &&
|
||||
all_zeroes(conv->pad)) ||
|
||||
// Winograd
|
||||
@@ -556,22 +556,22 @@ bool layout_optimizer::convolution_b_fs_yx_fsv16_opt(const layout& input_layout,
|
||||
weights_layout.data_type == data_types::i8;
|
||||
|
||||
if (i8_dt_case) {
|
||||
auto ks_x = weights_layout.size.spatial[0];
|
||||
auto ks_y = weights_layout.size.spatial[1];
|
||||
auto ks_x = weights_layout.spatial(0);
|
||||
auto ks_y = weights_layout.spatial(1);
|
||||
|
||||
size_t in_features_per_group = input_layout.size.feature[0] / conv->groups;
|
||||
size_t out_features_per_group = output_layout.size.feature[0] / conv->groups;
|
||||
size_t in_features_per_group = input_layout.feature() / conv->groups;
|
||||
size_t out_features_per_group = output_layout.feature() / conv->groups;
|
||||
|
||||
// Check for non-grouped or depthwise convolution
|
||||
if (input_layout.format.dimension() == 4 &&
|
||||
((ks_x == 7 && ks_y == 7) || (ks_x == 3 && ks_y == 3) || (ks_x == 1 && ks_y == 1) || (ks_x == 5 && ks_y == 5)) &&
|
||||
output_layout.size.feature[0] >= 16 &&
|
||||
output_layout.feature() >= 16 &&
|
||||
((conv->groups == 1 && conv->split() == 1) ||
|
||||
conv->groups == static_cast<uint32_t>(input_layout.size.feature[0]) ||
|
||||
conv->split() == static_cast<int32_t>(input_layout.size.feature[0])))
|
||||
conv->groups == static_cast<uint32_t>(input_layout.feature()) ||
|
||||
conv->split() == static_cast<int32_t>(input_layout.feature())))
|
||||
return true;
|
||||
// Check for grouped convolution
|
||||
else if (input_layout.format.dimension() == 4 && input_layout.size.batch[0] < 16 &&
|
||||
else if (input_layout.format.dimension() == 4 && input_layout.batch() < 16 &&
|
||||
out_features_per_group >= 16 &&
|
||||
// Need to extend imad fsv4 kernel to handle e.g. 3 input features per group
|
||||
(in_features_per_group % 4 == 0) &&
|
||||
@@ -587,16 +587,16 @@ bool layout_optimizer::convolution_b_fs_yx_fsv16_opt(const layout& input_layout,
|
||||
int32_t feature_block_size = 16;
|
||||
bool correct_data_type = (input_layout.data_type == data_types::f16 || input_layout.data_type == data_types::f32) &&
|
||||
(weights_layout.data_type == input_layout.data_type);
|
||||
bool correct_batch = (input_layout.size.batch[0] == 1) || (input_layout.size.batch[0] > 1 && input_layout.data_type == data_types::f32);
|
||||
bool correct_spatial_dims = input_layout.size.spatial[2] == 1 && input_layout.size.spatial[3] == 1;
|
||||
bool correct_batch = (input_layout.batch() == 1) || (input_layout.batch() > 1 && input_layout.data_type == data_types::f32);
|
||||
bool correct_spatial_dims = input_layout.spatial(2) == 1 && input_layout.spatial(3) == 1;
|
||||
int32_t required_feature_num = weak_restrictions ? feature_block_size / 2 : feature_block_size;
|
||||
bool correct_in_feature = (input_layout.size.feature[0] >= required_feature_num &&
|
||||
output_layout.size.feature[0] >= required_feature_num);
|
||||
int32_t in_features_per_group = input_layout.size.feature[0] / conv->groups;
|
||||
int32_t out_features_per_group = output_layout.size.feature[0] / conv->groups;
|
||||
if (!correct_in_feature && input_layout.size.feature[0] <= 4 && out_features_per_group >= feature_block_size)
|
||||
bool correct_in_feature = (input_layout.feature() >= required_feature_num &&
|
||||
output_layout.feature() >= required_feature_num);
|
||||
int32_t in_features_per_group = input_layout.feature() / conv->groups;
|
||||
int32_t out_features_per_group = output_layout.feature() / conv->groups;
|
||||
if (!correct_in_feature && input_layout.feature() <= 4 && out_features_per_group >= feature_block_size)
|
||||
correct_in_feature = true;
|
||||
bool depthwise = conv->groups == static_cast<uint32_t>(input_layout.size.feature[0]); // depthwise conv
|
||||
bool depthwise = conv->groups == static_cast<uint32_t>(input_layout.feature()); // depthwise conv
|
||||
bool grouped = ((feature_block_size % out_features_per_group == 0) &&
|
||||
(feature_block_size % in_features_per_group == 0) &&
|
||||
(feature_block_size / out_features_per_group > 1) &&
|
||||
@@ -640,8 +640,8 @@ bool layout_optimizer::convolution_b_fs_zyx_fsv16_opt(const layout& input_layout
|
||||
const layout& weights_layout,
|
||||
std::shared_ptr<const convolution> conv) {
|
||||
// A set of rules that define when b_fs_zyx_fsv16 mem format can be used
|
||||
size_t in_features_per_group = input_layout.size.feature[0] / conv->groups;
|
||||
size_t out_features_per_group = output_layout.size.feature[0] / conv->groups;
|
||||
size_t in_features_per_group = input_layout.feature() / conv->groups;
|
||||
size_t out_features_per_group = output_layout.feature() / conv->groups;
|
||||
|
||||
// Check for fsv16 imad kernel
|
||||
if ((input_layout.format.dimension() == 5) &&
|
||||
@@ -665,21 +665,21 @@ bool layout_optimizer::convolution_bs_fs_yx_bsv16_fsv16_opt(const layout& input_
|
||||
const layout& weights_layout,
|
||||
std::shared_ptr<const convolution> conv) {
|
||||
// A set of rules that define when bs_fs_yx_bsv16_fsv16 mem format can be used
|
||||
bool correct_batch = input_layout.size.batch[0] > 16;
|
||||
bool correct_feature = (input_layout.size.feature[0] % 16 == 0 || input_layout.size.feature[0] == 3) && conv->output_size.feature[0] % 16 == 0;
|
||||
bool fp16_ver = input_layout.data_type == data_types::f16 && input_layout.size.batch[0] % 32 == 0;
|
||||
bool fp32_ver = input_layout.data_type == data_types::f32 && input_layout.size.batch[0] % 16 == 0;
|
||||
bool correct_batch = input_layout.batch() > 16;
|
||||
bool correct_feature = (input_layout.feature() % 16 == 0 || input_layout.feature() == 3) && conv->output_size.feature[0] % 16 == 0;
|
||||
bool fp16_ver = input_layout.data_type == data_types::f16 && input_layout.batch() % 32 == 0;
|
||||
bool fp32_ver = input_layout.data_type == data_types::f32 && input_layout.batch() % 16 == 0;
|
||||
bool single_group = conv->groups == 1;
|
||||
|
||||
bool int8_sup = (input_layout.data_type == data_types::i8 || input_layout.data_type == data_types::u8);
|
||||
if (int8_sup)
|
||||
correct_batch = input_layout.size.batch[0] >= 16;
|
||||
int8_sup &= (input_layout.size.batch[0] % 16 == 0 && weights_layout.data_type == data_types::i8 &&
|
||||
correct_batch = input_layout.batch() >= 16;
|
||||
int8_sup &= (input_layout.batch() % 16 == 0 && weights_layout.data_type == data_types::i8 &&
|
||||
conv->activations_zero_points.empty() && conv->weights_zero_points.empty());
|
||||
auto ks_x = weights_layout.size.spatial[0];
|
||||
auto ks_y = weights_layout.size.spatial[1];
|
||||
int8_sup &= (input_layout.size.spatial[2] == 1 && ((ks_x == 1 && ks_y == 1) || (ks_x == 3 && ks_y == 3) || (ks_x == 7 && ks_y == 7)) &&
|
||||
output_layout.size.feature[0] % 32 == 0 && conv->split() == 1 && all_ones(conv->dilation));
|
||||
auto ks_x = weights_layout.spatial(0);
|
||||
auto ks_y = weights_layout.spatial(1);
|
||||
int8_sup &= (input_layout.spatial(2) == 1 && ((ks_x == 1 && ks_y == 1) || (ks_x == 3 && ks_y == 3) || (ks_x == 7 && ks_y == 7)) &&
|
||||
output_layout.feature() % 32 == 0 && conv->split() == 1 && all_ones(conv->dilation));
|
||||
|
||||
return (int8_sup || fp16_ver || fp32_ver) && correct_feature && correct_batch && single_group;
|
||||
}
|
||||
@@ -689,13 +689,13 @@ bool layout_optimizer::convolution_fs_b_yx_fsv32_opt(const layout& input_layout,
|
||||
const layout& weights_layout,
|
||||
std::shared_ptr<const convolution> conv,
|
||||
bool weak_restrictions) {
|
||||
auto ofm = output_layout.size.feature[0];
|
||||
auto ofm = output_layout.feature();
|
||||
// A set of rules that define when fs_b_yx_fsv32 mem format can be used
|
||||
bool correct_batch = input_layout.size.batch[0] > 1;
|
||||
bool correct_in_feature = input_layout.size.feature[0] >= 16;
|
||||
bool correct_batch = input_layout.batch() > 1;
|
||||
bool correct_in_feature = input_layout.feature() >= 16;
|
||||
bool correct_out_feature = weak_restrictions ? ofm >= 16 : ofm > 16;
|
||||
bool dw_conv = static_cast<int>(conv->groups) == input_layout.size.feature[0];
|
||||
if (!correct_in_feature && input_layout.size.feature[0] == 3 && conv->groups == 1) { // bfyx with 3 feature -> fs_b_yx_fsv32 case
|
||||
bool dw_conv = static_cast<int>(conv->groups) == input_layout.feature();
|
||||
if (!correct_in_feature && input_layout.feature() == 3 && conv->groups == 1) { // bfyx with 3 feature -> fs_b_yx_fsv32 case
|
||||
correct_in_feature = true;
|
||||
}
|
||||
|
||||
@@ -736,7 +736,7 @@ bool layout_optimizer::deconvolution_b_fs_yx_fsv16_opt(layout const &input_layou
|
||||
if ((input_layout.format == format::bfyx || input_layout.format == format::b_fs_yx_fsv16) &&
|
||||
(input_layout.data_type == data_types::f32 || input_layout.data_type == data_types::f16) &&
|
||||
deconv->split() == 1 &&
|
||||
(deconv->groups == 1 || (static_cast<int>(deconv->groups) == weights_layout.size.group[0])))
|
||||
(deconv->groups == 1 || (static_cast<int>(deconv->groups) == weights_layout.group())))
|
||||
return true;
|
||||
|
||||
if (input_layout.format.dimension() == 4 &&
|
||||
@@ -801,7 +801,7 @@ bool layout_optimizer::needs_onednn_small_ic_to_blocked(format fmt_next, layout&
|
||||
fmt_next == format::b_fs_yx_fsv32 || fmt_next == format::bs_fs_yx_bsv32_fsv32))
|
||||
return false;
|
||||
|
||||
if (next_output_layout.size.feature[0] >= 8 && prev_output_layout.size.feature[0] <= 4)
|
||||
if (next_output_layout.feature() >= 8 && prev_output_layout.feature() <= 4)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@@ -934,11 +934,11 @@ layout layout_optimizer::get_expected_layout(layout const& current_layout,
|
||||
|
||||
const float cond_denom = _total_conv > 0 ? 1.0f / static_cast<float>(_total_conv) : 1.0f;
|
||||
|
||||
bool is_dw = input_layout.size.feature[0] == static_cast<int>(prim->groups);
|
||||
int ofm_per_group = output_layout.size.feature[0] / prim->groups;
|
||||
int ifm_per_group = input_layout.size.feature[0] / prim->groups;
|
||||
bool is_dw = input_layout.feature() == static_cast<int>(prim->groups);
|
||||
int ofm_per_group = output_layout.feature() / prim->groups;
|
||||
int ifm_per_group = input_layout.feature() / prim->groups;
|
||||
int compute_block = 32;
|
||||
bool valid_int8_dw = is_dw && output_layout.size.batch[0] % 16 == 0;
|
||||
bool valid_int8_dw = is_dw && output_layout.batch() % 16 == 0;
|
||||
bool non_grouped = prim->groups == 1;
|
||||
bool is_2d = input_layout.format.spatial_num() == 2;
|
||||
bool onednn_valid_post_ops = get_post_ops_count(node) <= 32;
|
||||
@@ -963,7 +963,7 @@ layout layout_optimizer::get_expected_layout(layout const& current_layout,
|
||||
|
||||
if (i8_u8_output) {
|
||||
if ((non_grouped || valid_grouped || valid_int8_dw) && onednn_valid_post_ops && is_2d) {
|
||||
if (input_layout.size.batch[0] >= 16) {
|
||||
if (input_layout.batch() >= 16) {
|
||||
expected_format = cldnn::format::bs_fs_yx_bsv32_fsv32;
|
||||
} else {
|
||||
if (data_type_traits::is_floating_point(output_layout.data_type) &&
|
||||
@@ -984,7 +984,7 @@ layout layout_optimizer::get_expected_layout(layout const& current_layout,
|
||||
} else if ((output_layout.data_type == data_types::f16 || output_layout.data_type == data_types::f32) && is_2d) {
|
||||
expected_tensor = current_layout.size;
|
||||
|
||||
if (input_layout.size.batch[0] >= 16 && onednn_valid_post_ops) {
|
||||
if (input_layout.batch() >= 16 && onednn_valid_post_ops) {
|
||||
if (non_grouped || valid_grouped || is_dw) {
|
||||
expected_format = cldnn::format::bs_fs_yx_bsv32_fsv16;
|
||||
} else {
|
||||
@@ -998,14 +998,14 @@ layout layout_optimizer::get_expected_layout(layout const& current_layout,
|
||||
(output_layout.data_type == input_layout.data_type ||
|
||||
!data_type_traits::is_floating_point(input_layout.data_type)) && is_2d) {
|
||||
expected_tensor = current_layout.size;
|
||||
if (prim->groups == 1 || (output_layout.size.feature[0] % 16 == 0 && input_layout.size.feature[0] % 16 == 0)) {
|
||||
if (prim->groups == 1 || (output_layout.feature() % 16 == 0 && input_layout.feature() % 16 == 0)) {
|
||||
expected_format = cldnn::format::bs_fs_yx_bsv32_fsv16;
|
||||
} else {
|
||||
expected_format = cldnn::format::bs_fs_yx_bsv16_fsv16;
|
||||
}
|
||||
} // TODO: add this case when corresponding fsv32 optimizations inside clDNN will be implemented
|
||||
//else if (input_layout.data_type == data_types::f32 && i8_u8_output && !is_first_conv && is_2d) {
|
||||
// if (input_layout.size.batch[0] % 16 == 0) {
|
||||
// if (input_layout.batch() % 16 == 0) {
|
||||
// expected_format = cldnn::format::bs_fs_yx_bsv32_fsv32;
|
||||
// } else {
|
||||
// expected_format = cldnn::format::b_fs_yx_fsv32;
|
||||
@@ -1031,8 +1031,8 @@ layout layout_optimizer::get_expected_layout(layout const& current_layout,
|
||||
} else if (_optimization_attributes.b_fs_zyx_fsv16_network &&
|
||||
convolution_b_fs_zyx_fsv16_opt(input_layout, output_layout, weights_layout, prim)) {
|
||||
expected_tensor = current_layout.size;
|
||||
if ((current_layout.data_type == data_types::f32 && expected_tensor.batch[0] % 16 == 0) ||
|
||||
(current_layout.data_type == data_types::f16 && expected_tensor.batch[0] % 32 == 0))
|
||||
if ((current_layout.data_type == data_types::f32 && current_layout.batch() % 16 == 0) ||
|
||||
(current_layout.data_type == data_types::f16 && current_layout.batch() % 32 == 0))
|
||||
expected_format = cldnn::format::bs_fs_zyx_bsv16_fsv16;
|
||||
else
|
||||
expected_format = cldnn::format::b_fs_zyx_fsv16;
|
||||
@@ -1066,7 +1066,7 @@ layout layout_optimizer::get_expected_layout(layout const& current_layout,
|
||||
layout_optimizer::convolution_byxf_opt(input_layout, current_layout, weights_layout, node) &&
|
||||
(users_for_convolution_byxf_opt(node, 2) || deps_for_convolution_byxf_opt(node, 2)) &&
|
||||
// todo: remove this condition when yxfb optimizations will be disabled
|
||||
current_layout.format != cldnn::format::yxfb && current_layout.size.batch[0] == 1) {
|
||||
current_layout.format != cldnn::format::yxfb && current_layout.batch() == 1) {
|
||||
expected_tensor = current_layout.size;
|
||||
expected_format = cldnn::format::byxf;
|
||||
} else if (current_layout.format == format::b_fs_yx_fsv4 ||
|
||||
@@ -1105,13 +1105,13 @@ layout layout_optimizer::get_expected_layout(layout const& current_layout,
|
||||
|
||||
if (use_onednn_impls && is_node_for_onednn(node)) {
|
||||
if (input_layout.data_type == data_types::f16) {
|
||||
if (input_layout.size.batch[0] < 16) {
|
||||
if (input_layout.batch() < 16) {
|
||||
expected_format = is_2d ? cldnn::format::b_fs_yx_fsv16 : cldnn::format::b_fs_zyx_fsv16;
|
||||
} else {
|
||||
expected_format = is_2d ? cldnn::format::bs_fs_yx_bsv32_fsv16 : cldnn::format::bs_fs_zyx_bsv32_fsv16;
|
||||
}
|
||||
} else {
|
||||
if (input_layout.size.batch[0] < 16) {
|
||||
if (input_layout.batch() < 16) {
|
||||
expected_format = is_2d ? cldnn::format::b_fs_yx_fsv32 : cldnn::format::b_fs_zyx_fsv32;
|
||||
} else {
|
||||
expected_format = is_2d ? cldnn::format::bs_fs_yx_bsv32_fsv32 : cldnn::format::bs_fs_zyx_bsv32_fsv32;
|
||||
@@ -1257,10 +1257,10 @@ impl_types layout_optimizer::get_preferred_impl_type(program_node& node, format
|
||||
auto& detection_output_node = node.as<detection_output>();
|
||||
auto confidence_layout = detection_output_node.confidence().get_output_layout();
|
||||
auto prim = detection_output_node.get_primitive();
|
||||
auto batch_size_limitations = (device_info.supports_immad && device_info.execution_units_count >= 256) ? true : confidence_layout.size.batch[0] >= 4;
|
||||
if (confidence_layout.size.batch[0] <= lws_max && batch_size_limitations &&
|
||||
auto batch_size_limitations = (device_info.supports_immad && device_info.execution_units_count >= 256) ? true : confidence_layout.batch() >= 4;
|
||||
if (confidence_layout.batch() <= lws_max && batch_size_limitations &&
|
||||
prim->confidence_threshold >= 0.1 &&
|
||||
prim->top_k <= 400 && prim->num_classes >= 16 && confidence_layout.size.feature[0] > 10000)
|
||||
prim->top_k <= 400 && prim->num_classes >= 16 && confidence_layout.feature() > 10000)
|
||||
preferred_impl = impl_types::ocl;
|
||||
else
|
||||
preferred_impl = impl_types::cpu;
|
||||
@@ -1360,8 +1360,8 @@ impl_types layout_optimizer::get_preferred_impl_type(program_node& node, format
|
||||
auto input_layout = conv.input().get_output_layout();
|
||||
auto output_layout = conv.get_output_layout();
|
||||
bool has_groups = conv.get_primitive()->groups > 1;
|
||||
bool is_depthwise = conv.get_primitive()->groups == input_layout.size.feature[0];
|
||||
bool first_conv = input_layout.size.feature[0] <= 4;
|
||||
bool is_depthwise = conv.get_primitive()->groups == input_layout.feature();
|
||||
bool first_conv = input_layout.feature() <= 4;
|
||||
if (((has_groups && !is_depthwise) || first_conv) &&
|
||||
output_layout.format == format::b_fs_yx_fsv16 &&
|
||||
!needs_onednn_small_ic_to_blocked(preferred_format, input_layout, conv))
|
||||
@@ -1517,11 +1517,11 @@ format layout_optimizer::get_preferred_format(program_node& node) {
|
||||
expected = _forcing_map.at(node.id()).first;
|
||||
} else if (node.is_type<convolution>()) {
|
||||
auto& conv_node = node.as<convolution>();
|
||||
auto weights_layout = conv_node.weights(0).get_output_layout();
|
||||
auto weights_layout = conv_node.weights(0).get_output_layout().convert_to_weights_layout(conv_node.get_primitive()->grouped_weights_shape);
|
||||
expected = get_expected_layout(output_layout, conv_node, weights_layout).format;
|
||||
} else if (node.is_type<binary_convolution>()) {
|
||||
auto& bconv_node = node.as<binary_convolution>();
|
||||
auto weights_layout = bconv_node.weights(0).get_output_layout();
|
||||
auto weights_layout = bconv_node.weights(0).get_output_layout().convert_to_weights_layout(false);
|
||||
expected = get_expected_layout(output_layout, bconv_node, weights_layout).format;
|
||||
} else if (node.is_type<detection_output>()) {
|
||||
expected = get_expected_layout(
|
||||
@@ -1554,26 +1554,26 @@ format layout_optimizer::get_preferred_format(program_node& node) {
|
||||
expected = format::bs_fs_yx_bsv8_fsv4;
|
||||
} else if (layout.format.spatial_num() == 2 &&
|
||||
(layout.data_type == data_types::i8 || layout.data_type == data_types::u8) &&
|
||||
layout.size.batch[0] % 16 == 0) {
|
||||
if (use_onednn_impls && layout.size.batch[0] % 32 == 0) {
|
||||
layout.batch() % 16 == 0) {
|
||||
if (use_onednn_impls && layout.batch() % 32 == 0) {
|
||||
if (node.get_users().size() == 1 && node.get_users().front()->is_type<convolution>()) {
|
||||
auto& conv = node.get_users().front()->as<convolution>();
|
||||
auto ws = conv.get_dependency(1).get_output_layout().size;
|
||||
if (ws.spatial[0] != 7 || conv.get_primitive()->groups > 1 || layout.size.feature[0] == 1)
|
||||
if (ws.spatial[0] != 7 || conv.get_primitive()->groups > 1 || layout.feature() == 1)
|
||||
expected = format::bfyx;
|
||||
else
|
||||
expected = format::bs_fs_yx_bsv8_fsv4;
|
||||
|
||||
auto conv_output_layout = conv.get_output_layout();
|
||||
auto weights_layout = conv.weights(0).get_output_layout();
|
||||
auto weights_layout = conv.weights(0).get_output_layout().convert_to_weights_layout(conv.get_primitive()->grouped_weights_shape);
|
||||
format expected_conv_fmt = get_expected_layout(conv_output_layout, conv, weights_layout).format;
|
||||
if (expected == format::bfyx && expected_conv_fmt == format::bs_fs_yx_bsv32_fsv32 && layout.size.feature[0] % 32 == 0)
|
||||
if (expected == format::bfyx && expected_conv_fmt == format::bs_fs_yx_bsv32_fsv32 && layout.feature() % 32 == 0)
|
||||
expected = expected_conv_fmt;
|
||||
}
|
||||
} else if (layout.size.feature[0] > 8) {
|
||||
} else if (layout.feature() > 8) {
|
||||
expected = format::b_fs_yx_fsv16;
|
||||
} else {
|
||||
if (use_onednn_impls && layout.size.batch[0] % 16 == 0 && node.get_users().front()->is_type<convolution>()) {
|
||||
if (use_onednn_impls && layout.batch() % 16 == 0 && node.get_users().front()->is_type<convolution>()) {
|
||||
auto& conv = node.get_users().front()->as<convolution>();
|
||||
auto ws = conv.get_dependency(1).get_output_layout().size;
|
||||
if (data_type_traits::is_floating_point(conv.get_output_layout().data_type) || ws.spatial[0] != 7 || conv.get_primitive()->groups > 1)
|
||||
@@ -1591,9 +1591,9 @@ format layout_optimizer::get_preferred_format(program_node& node) {
|
||||
(layout.data_type == data_types::i8 || layout.data_type == data_types::u8)) {
|
||||
auto& conv = node.get_users().front()->as<convolution>();
|
||||
auto conv_output_layout = conv.get_output_layout();
|
||||
auto weights_layout = conv.weights(0).get_output_layout();
|
||||
auto weights_layout = conv.weights(0).get_output_layout().convert_to_weights_layout(conv.get_primitive()->grouped_weights_shape);
|
||||
format expected_conv_fmt = get_expected_layout(conv_output_layout, conv, weights_layout).format;
|
||||
if (layout.format.spatial_num() == 2 && layout.size.feature[0] % 32 == 0 && expected_conv_fmt == format::b_fs_yx_fsv32)
|
||||
if (layout.format.spatial_num() == 2 && layout.feature() % 32 == 0 && expected_conv_fmt == format::b_fs_yx_fsv32)
|
||||
expected = expected_conv_fmt;
|
||||
}
|
||||
}
|
||||
@@ -1609,7 +1609,7 @@ format layout_optimizer::get_preferred_format(program_node& node) {
|
||||
}
|
||||
} else if (node.is_type<deconvolution>()) {
|
||||
auto& deconv_node = node.as<deconvolution>();
|
||||
auto weights_layout = deconv_node.weights(0).get_output_layout();
|
||||
auto weights_layout = deconv_node.weights(0).get_output_layout().convert_to_weights_layout(deconv_node.get_primitive()->grouped_weights_shape);
|
||||
expected = get_expected_layout(output_layout, deconv_node, weights_layout).format;
|
||||
} else if (node.is_type<mvn>()) {
|
||||
auto input_layout = node.get_dependency(0).get_output_layout();
|
||||
|
||||
@@ -113,10 +113,10 @@ layout loop_inst::calc_output_layout(loop_node const & node) {
|
||||
layout loop_output_layout = (*target)->get_output_layout();
|
||||
const int64_t axis_to_iterate_throgh = output_mapping.axis;
|
||||
if (axis_to_iterate_throgh != -1) {
|
||||
const auto shape = loop_output_layout.size.sizes(loop_output_layout.format);
|
||||
const size_t ndim = shape.size();
|
||||
const size_t raw_axis = node.convert_to_raw_axis(axis_to_iterate_throgh, static_cast<int>(ndim));
|
||||
loop_output_layout.size.raw[raw_axis] = static_cast<int32_t>(node.get_max_iteration());
|
||||
const size_t ndim = loop_output_layout.get_rank();
|
||||
auto shape = loop_output_layout.get_dims();
|
||||
shape[axis_to_iterate_throgh] = static_cast<int32_t>(node.get_max_iteration());
|
||||
loop_output_layout.size = tensor(format::get_default_format(ndim), shape);
|
||||
}
|
||||
return loop_output_layout;
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ layout lstm_inst::calc_output_layout(lstm_node const& node) {
|
||||
// output = [ batch, sequence, direction, hidden_size ]
|
||||
auto result = layout(input_layout.data_type,
|
||||
format::bfyx,
|
||||
tensor(hidden_layout.size.feature[0],
|
||||
input_layout.size.feature[0],
|
||||
hidden_layout.size.spatial[0],
|
||||
hidden_layout.size.spatial[1]));
|
||||
tensor(hidden_layout.feature(),
|
||||
input_layout.feature(),
|
||||
hidden_layout.spatial(0),
|
||||
hidden_layout.spatial(1)));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,12 +23,12 @@ layout lstm_dynamic_input_inst::calc_output_layout(lstm_dynamic_input_node const
|
||||
"Output data type forcing is not supported for lstm_dynamic_node!");
|
||||
auto input_layout = node.input().get_output_layout();
|
||||
auto weight_layout = node.weights().get_output_layout();
|
||||
auto batch = input_layout.size.batch[0];
|
||||
auto batch = input_layout.batch();
|
||||
auto direction = node.direction();
|
||||
auto output_sequence = input_layout.size.feature[0];
|
||||
auto output_sequence = input_layout.feature();
|
||||
return layout(input_layout.data_type,
|
||||
input_layout.format,
|
||||
tensor(batch, output_sequence, weight_layout.size.spatial[1], direction));
|
||||
tensor(batch, output_sequence, weight_layout.spatial(1), direction));
|
||||
}
|
||||
|
||||
std::string lstm_dynamic_input_inst::to_string(lstm_dynamic_input_node const& node) {
|
||||
@@ -41,9 +41,9 @@ std::string lstm_dynamic_input_inst::to_string(lstm_dynamic_input_node const& no
|
||||
lstm_dynamic_input_info.add("dyn_length id", desc->dyn_length);
|
||||
lstm_dynamic_input_info.add("weights id", desc->weights);
|
||||
lstm_dynamic_input_info.add("bias id", bias_id);
|
||||
lstm_dynamic_input_info.add("max seq len", node.input().get_output_layout().size.feature[0]);
|
||||
lstm_dynamic_input_info.add("hidden size", node.weights().get_output_layout().size.spatial[1] / 4);
|
||||
lstm_dynamic_input_info.add("direction", node.weights().get_output_layout().size.feature[0]);
|
||||
lstm_dynamic_input_info.add("max seq len", node.input().get_output_layout().feature());
|
||||
lstm_dynamic_input_info.add("hidden size", node.weights().get_output_layout().spatial(1) / 4);
|
||||
lstm_dynamic_input_info.add("direction", node.weights().get_output_layout().feature());
|
||||
node_info->add("lstm_dynamic_input info", lstm_dynamic_input_info);
|
||||
node_info->dump(primitive_description);
|
||||
|
||||
@@ -70,7 +70,7 @@ lstm_dynamic_input_inst::typed_primitive_inst(network& network, lstm_dynamic_inp
|
||||
auto dyn_length_size = node.dyn_length().get_output_layout().count();
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Batch",
|
||||
node.get_output_layout().size.batch[0],
|
||||
node.get_output_layout().batch(),
|
||||
"Dynamic tensor elements count.",
|
||||
dyn_length_size,
|
||||
"Should be equal.");
|
||||
@@ -78,8 +78,8 @@ lstm_dynamic_input_inst::typed_primitive_inst(network& network, lstm_dynamic_inp
|
||||
// check weights
|
||||
CLDNN_ERROR_BOOL(node.id(), "Weights memory", !node.weights_term(), "Id of weights memory is not set.");
|
||||
auto weights_id = node.weights().id();
|
||||
auto weights_tensor = node.weights().get_output_layout().size;
|
||||
auto hidden_size = weights_tensor.spatial[1] / 4;
|
||||
auto weights_layout = node.weights().get_output_layout();
|
||||
auto hidden_size = weights_layout.spatial(1) / 4;
|
||||
CLDNN_ERROR_NOT_PROPER_FORMAT(node.id(),
|
||||
"weights format",
|
||||
node.weights().get_output_layout().format.value,
|
||||
@@ -87,15 +87,15 @@ lstm_dynamic_input_inst::typed_primitive_inst(network& network, lstm_dynamic_inp
|
||||
format::oiyx, format::lstm_weights_dio, format::bfyx);
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Weights batch size",
|
||||
weights_tensor.batch[0],
|
||||
weights_layout.batch(),
|
||||
"1",
|
||||
1,
|
||||
"Sizes mismatch, weights_id: " + weights_id);
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Weights x size",
|
||||
weights_tensor.spatial[0],
|
||||
weights_layout.spatial(0),
|
||||
"input_size",
|
||||
input_layout.size.spatial[0],
|
||||
input_layout.spatial(0),
|
||||
"Sizes mismatch, weights_id: " + weights_id);
|
||||
|
||||
// check bias
|
||||
|
||||
@@ -86,11 +86,11 @@ layout lstm_dynamic_timeloop_inst::calc_output_layout(lstm_dynamic_timeloop_node
|
||||
assert(static_cast<bool>(node.get_primitive()->output_data_type) == false &&
|
||||
"Output data type forcing is not supported for lstm_dynamic_node!");
|
||||
auto input_layout = node.input().get_output_layout();
|
||||
auto batch = input_layout.size.batch[0];
|
||||
auto output_sequence = input_layout.size.feature[0];
|
||||
auto batch = input_layout.batch();
|
||||
auto output_sequence = input_layout.feature();
|
||||
auto reccurent_layout = node.recurrent().get_output_layout();
|
||||
auto hidden_size = reccurent_layout.size.spatial[0];
|
||||
auto direction = reccurent_layout.size.feature[0];
|
||||
auto hidden_size = reccurent_layout.spatial(0);
|
||||
auto direction = reccurent_layout.feature();
|
||||
return layout(input_layout.data_type, input_layout.format, tensor(batch, output_sequence, hidden_size, direction));
|
||||
}
|
||||
|
||||
@@ -110,9 +110,9 @@ std::string lstm_dynamic_timeloop_inst::to_string(lstm_dynamic_timeloop_node con
|
||||
lstm_dynamic_input_info.add("initial hidden id", initial_hidden_id);
|
||||
lstm_dynamic_input_info.add("last cell id", last_cell_id);
|
||||
lstm_dynamic_input_info.add("last hidden id", last_hidden_id);
|
||||
lstm_dynamic_input_info.add("max seq len", node.input().get_output_layout().size.feature[0]);
|
||||
lstm_dynamic_input_info.add("hidden size", node.recurrent().get_output_layout().size.spatial[0]);
|
||||
lstm_dynamic_input_info.add("direction", node.recurrent().get_output_layout().size.feature[0]);
|
||||
lstm_dynamic_input_info.add("max seq len", node.input().get_output_layout().feature());
|
||||
lstm_dynamic_input_info.add("hidden size", node.recurrent().get_output_layout().spatial(0));
|
||||
lstm_dynamic_input_info.add("direction", node.recurrent().get_output_layout().feature());
|
||||
node_info->add("lstm_dynamic_timeloop info", lstm_dynamic_input_info);
|
||||
node_info->dump(primitive_description);
|
||||
|
||||
@@ -121,14 +121,14 @@ std::string lstm_dynamic_timeloop_inst::to_string(lstm_dynamic_timeloop_node con
|
||||
|
||||
lstm_dynamic_timeloop_inst::typed_primitive_inst(network& network, lstm_dynamic_timeloop_node const& node)
|
||||
: parent(network, node) {
|
||||
auto batch_size = node.get_output_layout().size.batch[0];
|
||||
auto batch_size = node.get_output_layout().batch();
|
||||
auto direction = node.direction();
|
||||
|
||||
// TODO: check input sizes
|
||||
auto input_id = node.input().id();
|
||||
auto input_layout = node.input().get_output_layout();
|
||||
auto input_tensor = input_layout.size;
|
||||
auto hidden_size = input_tensor.spatial[0] / 4;
|
||||
auto hidden_size = input_layout.spatial(0) / 4;
|
||||
CLDNN_ERROR_NOT_PROPER_FORMAT(node.id(),
|
||||
"input format",
|
||||
input_layout.format.value,
|
||||
@@ -139,7 +139,7 @@ lstm_dynamic_timeloop_inst::typed_primitive_inst(network& network, lstm_dynamic_
|
||||
// check recurrent
|
||||
CLDNN_ERROR_BOOL(node.id(), "Recurrent memory", !node.recurrent_term(), "Id of weights memory is not set.");
|
||||
auto reccurent_id = node.recurrent().id();
|
||||
auto recurrent_tensor = node.recurrent().get_output_layout().size;
|
||||
auto recurrent_layout = node.recurrent().get_output_layout();
|
||||
CLDNN_ERROR_NOT_PROPER_FORMAT(node.id(),
|
||||
"recurrent format",
|
||||
node.recurrent().get_output_layout().format.value,
|
||||
@@ -147,21 +147,21 @@ lstm_dynamic_timeloop_inst::typed_primitive_inst(network& network, lstm_dynamic_
|
||||
format::bfyx);
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Recurrent batch size",
|
||||
recurrent_tensor.batch[0],
|
||||
recurrent_layout.batch(),
|
||||
"1",
|
||||
1,
|
||||
"Sizes mismatch, reccuren_id: " + reccurent_id);
|
||||
if (recurrent_tensor.feature[0] != direction)
|
||||
if (recurrent_layout.feature() != direction)
|
||||
CLDNN_ERROR_MESSAGE(node.id(), "Reccurent directions size needs to be equal to 1 or 2 (bidrectional) !");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Recurrent x size",
|
||||
recurrent_tensor.spatial[0],
|
||||
recurrent_layout.spatial(0),
|
||||
"hidden_size",
|
||||
hidden_size,
|
||||
"Sizes mismatch, reccuren_id: " + reccurent_id);
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Recurrent y size",
|
||||
recurrent_tensor.spatial[1],
|
||||
recurrent_layout.spatial(1),
|
||||
"4 * hidden_size",
|
||||
4 * hidden_size,
|
||||
"Sizes mismatch, reccuren_id: " + reccurent_id);
|
||||
|
||||
@@ -29,7 +29,7 @@ layout lstm_elt_inst::calc_output_layout(lstm_elt_node const& node) {
|
||||
auto result =
|
||||
layout(input_layout.data_type,
|
||||
input_layout.format,
|
||||
tensor(input_layout.size.batch[0], 2, input_layout.size.spatial[0] / 4, input_layout.size.feature[0]));
|
||||
tensor(input_layout.batch(), 2, input_layout.spatial(0) / 4, input_layout.feature()));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ layout lstm_gemm_inst::calc_output_layout(lstm_gemm_node const& node) {
|
||||
auto result =
|
||||
layout(input_layout.data_type,
|
||||
input_layout.format,
|
||||
tensor(input_layout.size.batch[0], weights_layout.size.feature[0], weights_layout.size.spatial[1], 1));
|
||||
tensor(input_layout.batch(), weights_layout.feature(), weights_layout.spatial(1), 1));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,8 @@ layout max_unpooling_inst::calc_output_layout(max_unpooling_node const& node) {
|
||||
"Argmax data type is not fp32.");
|
||||
|
||||
if (desc->with_output_size) {
|
||||
tensor output_size(input_layout.size.batch[0],
|
||||
input_layout.size.feature[0],
|
||||
tensor output_size(input_layout.batch(),
|
||||
input_layout.feature(),
|
||||
desc->output_size.spatial[0],
|
||||
desc->output_size.spatial[1]);
|
||||
return {input_layout.data_type, input_layout.format, output_size};
|
||||
@@ -81,8 +81,8 @@ layout max_unpooling_inst::calc_output_layout(max_unpooling_node const& node) {
|
||||
true,
|
||||
1);
|
||||
|
||||
tensor output_size(input_layout.size.batch[0],
|
||||
input_layout.size.feature[0],
|
||||
tensor output_size(input_layout.batch(),
|
||||
input_layout.feature(),
|
||||
output_range.spatial[0],
|
||||
output_range.spatial[1]);
|
||||
return {input_layout.data_type, input_layout.format, output_size};
|
||||
|
||||
@@ -154,23 +154,23 @@ static void dump(memory::ptr mem, stream& stream, std::ofstream& file_stream) {
|
||||
}
|
||||
template <>
|
||||
void dump<uint32_t>(memory::ptr mem, stream& stream, std::ofstream& file_stream) {
|
||||
auto&& size = mem->get_layout().size;
|
||||
auto&& l = mem->get_layout();
|
||||
|
||||
file_stream << "shape: ";
|
||||
file_stream << size.batch[0] << " ";
|
||||
file_stream << size.feature[0] << " ";
|
||||
file_stream << size.spatial[1] << " ";
|
||||
file_stream << size.spatial[0] << " ";
|
||||
file_stream << "(" << size.batch[0] * size.feature[0] * size.spatial[1] * size.spatial[0] << ")" << std::endl;
|
||||
file_stream << l.batch() << " ";
|
||||
file_stream << l.feature() << " ";
|
||||
file_stream << l.spatial(1) << " ";
|
||||
file_stream << l.spatial(0) << " ";
|
||||
file_stream << "(" << l.batch() * l.feature() * l.spatial(1) * l.spatial(0) << ")" << std::endl;
|
||||
|
||||
mem_lock<uint32_t, mem_lock_type::read> lock(mem, stream);
|
||||
auto mem_ptr = lock.data();
|
||||
|
||||
for (cldnn::tensor::value_type b = 0; b < size.batch[0]; ++b) {
|
||||
for (cldnn::tensor::value_type f = 0; f < (cldnn::tensor::value_type)ceil_div(size.feature[0], 32); ++f) {
|
||||
for (cldnn::tensor::value_type z = 0; z < size.spatial[2]; ++z) {
|
||||
for (cldnn::tensor::value_type y = 0; y < size.spatial[1]; ++y) {
|
||||
for (cldnn::tensor::value_type x = 0; x < size.spatial[0]; ++x) {
|
||||
for (cldnn::tensor::value_type b = 0; b < l.batch(); ++b) {
|
||||
for (cldnn::tensor::value_type f = 0; f < (cldnn::tensor::value_type)ceil_div(l.feature(), 32); ++f) {
|
||||
for (cldnn::tensor::value_type z = 0; z < l.spatial(2); ++z) {
|
||||
for (cldnn::tensor::value_type y = 0; y < l.spatial(1); ++y) {
|
||||
for (cldnn::tensor::value_type x = 0; x < l.spatial(0); ++x) {
|
||||
cldnn::tensor t(cldnn::batch(b), cldnn::feature(f), cldnn::spatial(x, y, z, 0));
|
||||
size_t input_it = mem->get_layout().get_linear_offset(t);
|
||||
file_stream << mem_ptr[input_it] << std::endl;
|
||||
|
||||
@@ -57,7 +57,7 @@ normalize_inst::typed_primitive_inst(network& network, normalize_node const& nod
|
||||
auto scale_size = scale_layout.size;
|
||||
auto scale_feature_size = scale_size.feature[0];
|
||||
auto input_layout = node.input().get_output_layout();
|
||||
auto input_feature_size = input_layout.size.feature[0];
|
||||
auto input_feature_size = input_layout.feature();
|
||||
|
||||
if (scale_feature_size != 1) {
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
|
||||
@@ -147,8 +147,8 @@ layout pooling_inst::calc_output_layout(parent::typed_node const& node) {
|
||||
0,
|
||||
"User-defined size of output layout (spatial Z) must be positive (>= 1)");
|
||||
|
||||
tensor output_size(input_layout.size.batch[0],
|
||||
input_layout.size.feature[0],
|
||||
tensor output_size(input_layout.batch(),
|
||||
input_layout.feature(),
|
||||
desc->output_size.spatial[0],
|
||||
desc->output_size.spatial[1],
|
||||
desc->output_size.spatial[2]);
|
||||
@@ -168,8 +168,8 @@ layout pooling_inst::calc_output_layout(parent::typed_node const& node) {
|
||||
true,
|
||||
1);
|
||||
|
||||
tensor output_size(input_layout.size.batch[0],
|
||||
input_layout.size.feature[0],
|
||||
tensor output_size(input_layout.batch(),
|
||||
input_layout.feature(),
|
||||
output_range.spatial[0],
|
||||
output_range.spatial[1],
|
||||
output_range.spatial[2]);
|
||||
@@ -185,11 +185,13 @@ std::string pooling_inst::to_string(pooling_node const& node) {
|
||||
|
||||
std::stringstream primitive_description;
|
||||
|
||||
bool is_global = desc->global_pooling;
|
||||
|
||||
json_composite pooling_info;
|
||||
pooling_info.add("mode", mode);
|
||||
pooling_info.add("stride", cldnn::to_string(strd));
|
||||
pooling_info.add("kernel size", cldnn::to_string(kernel_size));
|
||||
pooling_info.add("pad", cldnn::to_string(desc->pad));
|
||||
pooling_info.add("is global", is_global ? "true" : "false");
|
||||
if (desc->with_output_size) {
|
||||
json_composite ud_out_size_info;
|
||||
ud_out_size_info.add("size", desc->output_size.to_string());
|
||||
|
||||
@@ -26,8 +26,8 @@ void calculate_prior_box_output(memory::ptr output_mem, stream& stream, layout c
|
||||
// All the inputs for this layer are known at this point,
|
||||
// so the output buffer is written here and not in execute().
|
||||
|
||||
const int layer_width = input_layout.size.spatial[0];
|
||||
const int layer_height = input_layout.size.spatial[1];
|
||||
const int layer_width = input_layout.spatial(0);
|
||||
const int layer_height = input_layout.spatial(1);
|
||||
const int img_width = argument.img_size.spatial[0];
|
||||
const int img_height = argument.img_size.spatial[1];
|
||||
float step_w = argument.step_width;
|
||||
@@ -39,7 +39,7 @@ void calculate_prior_box_output(memory::ptr output_mem, stream& stream, layout c
|
||||
const float offset = argument.offset;
|
||||
int num_priors = argument.is_clustered() ?
|
||||
static_cast<int>(argument.widths.size()) :
|
||||
output_mem->get_layout().size.spatial[1] / 4 / layer_width / layer_height;
|
||||
output_mem->get_layout().spatial(1) / 4 / layer_width / layer_height;
|
||||
int var_size = static_cast<int>(argument.variance.size());
|
||||
|
||||
mem_lock<dtype> lock{output_mem, stream};
|
||||
@@ -204,7 +204,7 @@ void calculate_prior_box_output(memory::ptr output_mem, stream& stream, layout c
|
||||
}
|
||||
|
||||
// set the variance.
|
||||
int count = output_mem->get_layout().size.spatial[0] * output_mem->get_layout().size.spatial[1];
|
||||
int count = output_mem->get_layout().spatial(0) * output_mem->get_layout().spatial(1);
|
||||
int var_loop_count = argument.is_clustered() ? var_size : 4;
|
||||
for (int h = 0; h < layer_height; ++h) {
|
||||
for (int w = 0; w < layer_width; ++w) {
|
||||
@@ -359,8 +359,8 @@ layout prior_box_inst::calc_output_layout(prior_box_node const& node) {
|
||||
auto desc = node.get_primitive();
|
||||
auto input_layout = node.input().get_output_layout();
|
||||
|
||||
const int layer_width = input_layout.size.spatial[0];
|
||||
const int layer_height = input_layout.size.spatial[1];
|
||||
const int layer_width = input_layout.spatial(0);
|
||||
const int layer_height = input_layout.spatial(1);
|
||||
|
||||
int num_priors = node.is_clustered() ?
|
||||
static_cast<int>(desc->widths.size()) :
|
||||
|
||||
@@ -261,7 +261,6 @@ bool program::analyze_output_size_handling_need() {
|
||||
prim->dilation,
|
||||
true,
|
||||
1);
|
||||
|
||||
if (specified_output_range != calc_output_range)
|
||||
handling_needed = true;
|
||||
} else if (node->is_type<deconvolution>()) {
|
||||
@@ -282,7 +281,7 @@ bool program::analyze_output_size_handling_need() {
|
||||
filter_size,
|
||||
prim->pad,
|
||||
prim->stride,
|
||||
{1, 1, 1, 1},
|
||||
ov::Strides(prim->stride.size(), 1),
|
||||
true,
|
||||
1);
|
||||
|
||||
|
||||
@@ -103,10 +103,10 @@ layout program_helpers::get_weights_layout(typed_program_node<cldnn::data>& data
|
||||
|
||||
return layout(mem_layout.data_type,
|
||||
mem_layout.format,
|
||||
{split * mem_layout.size.batch[0],
|
||||
mem_layout.size.feature[0],
|
||||
mem_layout.size.spatial[0],
|
||||
mem_layout.size.spatial[1]});
|
||||
{split * mem_layout.batch(),
|
||||
mem_layout.feature(),
|
||||
mem_layout.spatial(0),
|
||||
mem_layout.spatial(1)});
|
||||
}
|
||||
|
||||
// pair.first tells whether l1 and l2 are absolutely identical
|
||||
|
||||
@@ -911,7 +911,7 @@ void program_node::init_onednn_primitive_attributes() {
|
||||
update_onednn_post_op_list(onednn_post_op_type::binary_add, dep_idx);
|
||||
}
|
||||
} else {
|
||||
if (in.size.spatial[0] > 1 || in.size.spatial[1] > 1 || in.size.batch[0] > 1)
|
||||
if (in.spatial(0) > 1 || in.spatial(1) > 1 || in.batch() > 1)
|
||||
throw std::runtime_error("Unsupported eltwise mode for fused onednn op");
|
||||
if (idx == 0 && !has_out_scales(attrs)) {
|
||||
int mask = in.count() > 1 ? 2 : 0;
|
||||
|
||||
@@ -33,7 +33,7 @@ layout proposal_inst::calc_output_layout(proposal_node const& node) {
|
||||
|
||||
return layout(input_layout.data_type,
|
||||
format::bfyx,
|
||||
{input_layout.size.batch[0] * desc->post_nms_topn, CLDNN_ROI_VECTOR_SIZE, 1, 1});
|
||||
{input_layout.batch() * desc->post_nms_topn, CLDNN_ROI_VECTOR_SIZE, 1, 1});
|
||||
}
|
||||
|
||||
static inline std::string stringify_vector(std::vector<float> v) {
|
||||
|
||||
@@ -25,8 +25,8 @@ layout pyramid_roi_align_inst::calc_output_layout(pyramid_roi_align_node const&
|
||||
auto boxes_layout = node.input().get_output_layout();
|
||||
auto P2_layout = node.P2().get_output_layout();
|
||||
|
||||
int32_t output_b = boxes_layout.size.batch[0];
|
||||
int32_t output_f = P2_layout.size.feature[0];
|
||||
int32_t output_b = boxes_layout.batch();
|
||||
int32_t output_f = P2_layout.feature();
|
||||
|
||||
int32_t output_x = desc->output_size;
|
||||
int32_t output_y = desc->output_size;
|
||||
|
||||
@@ -24,8 +24,8 @@ layout region_yolo_inst::calc_output_layout(region_yolo_node const& node) {
|
||||
return cldnn::layout(
|
||||
input_layout.data_type,
|
||||
input_layout.format,
|
||||
tensor(input_layout.size.batch[0],
|
||||
input_layout.size.feature[0] * input_layout.size.spatial[0] * input_layout.size.spatial[1],
|
||||
tensor(input_layout.batch(),
|
||||
input_layout.feature() * input_layout.spatial(0) * input_layout.spatial(1),
|
||||
1,
|
||||
1));
|
||||
} else {
|
||||
@@ -33,7 +33,7 @@ layout region_yolo_inst::calc_output_layout(region_yolo_node const& node) {
|
||||
return cldnn::layout(
|
||||
input_layout.data_type,
|
||||
input_layout.format,
|
||||
tensor(input_layout.size.batch[0], features, input_layout.size.spatial[0], input_layout.size.spatial[1]));
|
||||
tensor(input_layout.batch(), features, input_layout.spatial(0), input_layout.spatial(1)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ layout reorder_inst::calc_output_layout(reorder_node const& node) {
|
||||
}
|
||||
|
||||
if (ifmt.is_nv12()) {
|
||||
auto data_size = tensor{ input_layout.size.batch[0], input_layout.size.feature[0] * 3,
|
||||
input_layout.size.spatial[0], input_layout.size.spatial[1] };
|
||||
auto data_size = tensor{ input_layout.batch(), input_layout.feature() * 3,
|
||||
input_layout.spatial(0), input_layout.spatial(1) };
|
||||
if (ofmt != ifmt)
|
||||
return layout(odt, ofmt, data_size, op);
|
||||
|
||||
@@ -67,10 +67,10 @@ layout reorder_inst::calc_output_layout(reorder_node const& node) {
|
||||
// each input tile produces one output tile so we can find no. of input tiles by calculating no. of output tiles
|
||||
// (which is equal to width of an output divided by output tile width)
|
||||
tensor::value_type conv_output_width =
|
||||
input_layout.size.spatial[0] - filter_width + 1;
|
||||
input_layout.spatial(0) - filter_width + 1;
|
||||
tensor::value_type input_tiles_count_x = conv_output_width / output_tile_width;
|
||||
tensor::value_type output_width = input_tiles_count_x * input_tile_width;
|
||||
tensor::value_type output_height = input_layout.size.spatial[1];
|
||||
tensor::value_type output_height = input_layout.spatial(1);
|
||||
|
||||
tensor::value_type padd_x = 0;
|
||||
tensor::value_type padd_y = (8 - ((output_height - 2) % 8)) % 8;
|
||||
@@ -80,7 +80,7 @@ layout reorder_inst::calc_output_layout(reorder_node const& node) {
|
||||
padd_x = 1;
|
||||
}
|
||||
|
||||
auto data_size = tensor{input_layout.size.batch[0], input_layout.size.feature[0], output_width, output_height};
|
||||
auto data_size = tensor{input_layout.batch(), input_layout.feature(), output_width, output_height};
|
||||
tensor upper_padd = tensor{0, 0, padd_x, padd_y};
|
||||
return layout(odt, ofmt, data_size, padding{{0, 0, 0, 0}, upper_padd.sizes()});
|
||||
}
|
||||
@@ -88,34 +88,34 @@ layout reorder_inst::calc_output_layout(reorder_node const& node) {
|
||||
// transformation of weights from standard to winograd
|
||||
if (ofmt == format::winograd_2x3_s1_weights || ofmt == format::winograd_2x3_s1_fused_weights) {
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"input_layout.size.spatial[0]",
|
||||
input_layout.size.spatial[0],
|
||||
"input_layout.spatial(0)",
|
||||
input_layout.spatial(0),
|
||||
"expected value",
|
||||
3,
|
||||
"input for conversion to winograd_2x3_s1 weights format should have spatial size 3x3");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"input_layout.size.spatial[1]",
|
||||
input_layout.size.spatial[1],
|
||||
"input_layout.spatial(1)",
|
||||
input_layout.spatial(1),
|
||||
"expected value",
|
||||
3,
|
||||
"input for conversion to winograd_2x3_s1 weights format should have spatial size 3x3");
|
||||
|
||||
return layout(odt, ofmt, tensor{input_layout.size.batch[0], input_layout.size.feature[0], 4, 3});
|
||||
return layout(odt, ofmt, tensor{input_layout.batch(), input_layout.feature(), 4, 3});
|
||||
} else if (ofmt == format::winograd_6x3_s1_fused_weights) {
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"input_layout.size.spatial[0]",
|
||||
input_layout.size.spatial[0],
|
||||
"input_layout.spatial(0)",
|
||||
input_layout.spatial(0),
|
||||
"expected value",
|
||||
3,
|
||||
"input for conversion to winograd_2x3_s1 weights format should have spatial size 3x3");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"input_layout.size.spatial[1]",
|
||||
input_layout.size.spatial[1],
|
||||
"input_layout.spatial(1)",
|
||||
input_layout.spatial(1),
|
||||
"expected value",
|
||||
3,
|
||||
"input for conversion to winograd_2x3_s1 weights format should have spatial size 3x3");
|
||||
|
||||
return layout(odt, ofmt, tensor{input_layout.size.batch[0], input_layout.size.feature[0], 8, 3});
|
||||
return layout(odt, ofmt, tensor{input_layout.batch(), input_layout.feature(), 8, 3});
|
||||
}
|
||||
|
||||
// transformation of data from winograd to standard
|
||||
@@ -130,16 +130,16 @@ layout reorder_inst::calc_output_layout(reorder_node const& node) {
|
||||
(output_tile_width - 1) * filter_stride; // input tile should be large enought to hold data for
|
||||
// computations of output tile (for given filter size and stride)
|
||||
|
||||
auto output_width = input_layout.size.spatial[0] / input_tile_width * output_tile_width;
|
||||
if (input_layout.size.spatial[0] % input_tile_width != 0) // leftovers
|
||||
auto output_width = input_layout.spatial(0) / input_tile_width * output_tile_width;
|
||||
if (input_layout.spatial(0) % input_tile_width != 0) // leftovers
|
||||
++output_width; // output tile is 2 by default, so we can have only 1 value as leftover
|
||||
|
||||
return layout(odt,
|
||||
ofmt,
|
||||
tensor{input_layout.size.batch[0],
|
||||
input_layout.size.feature[0],
|
||||
tensor{input_layout.batch(),
|
||||
input_layout.feature(),
|
||||
output_width,
|
||||
input_layout.size.spatial[1]});
|
||||
input_layout.spatial(1)});
|
||||
}
|
||||
|
||||
// transformation of weights from winograd to standard
|
||||
@@ -149,7 +149,7 @@ layout reorder_inst::calc_output_layout(reorder_node const& node) {
|
||||
"Conversion of weights from winograd to standard domain is currently unsupported");
|
||||
}
|
||||
|
||||
if (ofmt == format::bs_xs_xsv8_bsv8 || ofmt == format::bs_xs_xsv8_bsv16 || ofmt == format::bs_x_bsv16 ||
|
||||
if (ofmt == format::bs_xs_xsv8_bsv8 || ofmt == format::os_i_osv8__ai8 || ofmt == format::os_i_osv16__ai8 || ofmt == format::bs_x_bsv16 ||
|
||||
ofmt == format::bfzyx || ifmt == format::bfzyx || ofmt == format::b_fs_zyx_fsv16 || ifmt == format::b_fs_zyx_fsv16 ||
|
||||
ofmt == format::bs_fs_zyx_bsv16_fsv16 || ifmt == format::bs_fs_zyx_bsv16_fsv16 ||
|
||||
ofmt == format::b_fs_zyx_fsv32 || ifmt == format::b_fs_zyx_fsv32 ||
|
||||
@@ -210,7 +210,7 @@ reorder_inst::typed_primitive_inst(network& network, reorder_node const& node)
|
||||
if (input_layout.format != format::nv12) {
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
"Input feature size[0]",
|
||||
static_cast<size_t>(input_layout.size.feature[0]),
|
||||
static_cast<size_t>(input_layout.feature()),
|
||||
"argument subtract per feature size",
|
||||
argument.subtract_per_feature.size(),
|
||||
"Number of features/channels in input does not match the number of features/channels in "
|
||||
|
||||
@@ -23,10 +23,10 @@ layout reorg_yolo_inst::calc_output_layout(reorg_yolo_node const& node) {
|
||||
|
||||
cldnn::layout layoutTemp = cldnn::layout(input_layout.data_type,
|
||||
input_layout.format,
|
||||
tensor(input_layout.size.batch[0],
|
||||
input_layout.size.feature[0] * stride * stride,
|
||||
input_layout.size.spatial[0] / stride,
|
||||
input_layout.size.spatial[1] / stride));
|
||||
tensor(input_layout.batch(),
|
||||
input_layout.feature() * stride * stride,
|
||||
input_layout.spatial(0) / stride,
|
||||
input_layout.spatial(1) / stride));
|
||||
return layoutTemp;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ layout resample_inst::calc_output_layout(resample_node const& node) {
|
||||
|
||||
auto result_sizes = desc->output_size;
|
||||
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(), "Input batch size", input_layout.size.batch[0], "output batch size", result_sizes.batch[0], "");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(), "Input feature size", input_layout.size.feature[0], "output feature size", result_sizes.feature[0], "");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(), "Input batch size", input_layout.batch(), "output batch size", result_sizes.batch[0], "");
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(), "Input feature size", input_layout.feature(), "output feature size", result_sizes.feature[0], "");
|
||||
|
||||
auto result = layout({output_type, input_layout.format, result_sizes});
|
||||
return result;
|
||||
|
||||
@@ -21,8 +21,8 @@ layout roi_align_inst::calc_output_layout(roi_align_node const& node) {
|
||||
auto primitive = node.get_primitive();
|
||||
auto input_layout = node.input(0).get_output_layout();
|
||||
auto rois_layout = node.input(1).get_output_layout();
|
||||
auto num_rois = rois_layout.size.batch[0];
|
||||
auto num_channels = input_layout.size.feature[0];
|
||||
auto num_rois = rois_layout.batch();
|
||||
auto num_channels = input_layout.feature();
|
||||
return layout(input_layout.data_type, format::bfyx, {num_rois, num_channels, primitive->pooled_h, primitive->pooled_w});
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ layout roi_pooling_inst::calc_output_layout(roi_pooling_node const& node) {
|
||||
auto desc = node.get_primitive();
|
||||
layout data_layout = node.input().get_output_layout();
|
||||
layout rois_layout = node.rois().get_output_layout();
|
||||
int num_rois = rois_layout.size.batch[0];
|
||||
int out_fm = desc->position_sensitive ? desc->output_dim : data_layout.size.feature[0];
|
||||
int num_rois = rois_layout.batch();
|
||||
int out_fm = desc->position_sensitive ? desc->output_dim : data_layout.feature();
|
||||
|
||||
return layout(data_layout.data_type, format::bfyx, {num_rois, out_fm, desc->pooled_width, desc->pooled_height});
|
||||
}
|
||||
|
||||
@@ -17,17 +17,15 @@ primitive_type_id scale::type_id() {
|
||||
layout scale_inst::calc_output_layout(scale_node const& node) {
|
||||
auto desc = node.get_primitive();
|
||||
auto result = node.input().get_non_padded_output_layout();
|
||||
auto scale_layout = node.scale_in().get_non_padded_output_layout();
|
||||
|
||||
auto scale_sizes = node.scale_in().get_non_padded_output_layout().size;
|
||||
auto input_sizes = result.size;
|
||||
auto scale_x_size = scale_layout.spatial(0);
|
||||
auto scale_y_size = scale_layout.spatial(1);
|
||||
auto scale_z_size = scale_layout.spatial(2);
|
||||
|
||||
auto scale_x_size = scale_sizes.spatial[0];
|
||||
auto scale_y_size = scale_sizes.spatial[1];
|
||||
auto scale_z_size = scale_sizes.spatial[2];
|
||||
|
||||
auto input_x_size = input_sizes.spatial[0];
|
||||
auto input_y_size = input_sizes.spatial[1];
|
||||
auto input_z_size = input_sizes.spatial[2];
|
||||
auto input_x_size = result.spatial(0);
|
||||
auto input_y_size = result.spatial(1);
|
||||
auto input_z_size = result.spatial(2);
|
||||
|
||||
if ((result.data_type == data_types::u8 || result.data_type == data_types::i8 || result.data_type == data_types::i32) &&
|
||||
(node.scale_in().get_non_padded_output_layout().data_type == data_types::f32 ||
|
||||
@@ -76,11 +74,11 @@ scale_inst::typed_primitive_inst(network& network, scale_node const& node) : par
|
||||
auto scale_layout = node.scale_in().get_output_layout();
|
||||
auto scale_format = scale_layout.format;
|
||||
|
||||
auto scale_batch_size = scale_layout.size.batch[0];
|
||||
auto scale_feature_size = scale_layout.size.feature[0];
|
||||
auto scale_batch_size = scale_layout.batch();
|
||||
auto scale_feature_size = scale_layout.feature();
|
||||
|
||||
auto input_batch_size = node.input().get_output_layout().size.batch[0];
|
||||
auto input_feature_size = node.input().get_output_layout().size.feature[0];
|
||||
auto input_batch_size = node.input().get_output_layout().batch();
|
||||
auto input_feature_size = node.input().get_output_layout().feature();
|
||||
|
||||
if (scale_batch_size != 1) {
|
||||
CLDNN_ERROR_NOT_EQUAL(node.id(),
|
||||
|
||||
@@ -49,7 +49,7 @@ layout space_to_batch_inst::calc_output_layout(space_to_batch_node const& node)
|
||||
"pads_end[0] is expected to be 0. Actual pads_end[0] is " +
|
||||
std::to_string(pads_end.batch[0]));
|
||||
|
||||
if ((input_layout.size.feature[0] + pads_begin.feature[0] + pads_end.feature[0]) % block_shape.feature[0] != 0)
|
||||
if ((input_layout.feature() + pads_begin.feature[0] + pads_end.feature[0]) % block_shape.feature[0] != 0)
|
||||
CLDNN_ERROR_MESSAGE(node.id(),
|
||||
"Input feature shape after padding must be divisible by block_shape");
|
||||
|
||||
|
||||
@@ -38,40 +38,40 @@ layout space_to_depth_inst::calc_output_layout(space_to_depth_node const& node)
|
||||
"Invalid spaceToDepth block_size value (should be >= 1). Actual block size is" +
|
||||
std::to_string(block_size));
|
||||
|
||||
if (input_layout.size.spatial[0] % block_size != 0 || input_layout.size.spatial[1] % block_size != 0)
|
||||
if (input_layout.spatial(0) % block_size != 0 || input_layout.spatial(1) % block_size != 0)
|
||||
CLDNN_ERROR_MESSAGE(
|
||||
node.id(),
|
||||
"Sizes of spatials x, y must be divisible by block size. Actual spatial sizes are " +
|
||||
std::to_string(input_layout.size.spatial[0]) + ", " + std::to_string(input_layout.size.spatial[1]) +
|
||||
std::to_string(input_layout.spatial(0)) + ", " + std::to_string(input_layout.spatial(1)) +
|
||||
" (x, y). Actual block size is " + std::to_string(block_size));
|
||||
|
||||
|
||||
if (input_layout.format.dimension() == 5) {
|
||||
if (input_layout.size.spatial[2] % block_size != 0)
|
||||
if (input_layout.spatial(2) % block_size != 0)
|
||||
CLDNN_ERROR_MESSAGE(
|
||||
node.id(),
|
||||
"Sizes of spatials z must be divisible by block size. Actual spatial sizes are " +
|
||||
std::to_string(input_layout.size.spatial[2]) +
|
||||
std::to_string(input_layout.spatial(2)) +
|
||||
" (z). Block size is " + std::to_string(block_size));
|
||||
|
||||
const size_t feature = input_layout.size.feature[0] * block_size * block_size * block_size;
|
||||
const size_t z = input_layout.size.spatial[2] / block_size;
|
||||
const size_t y = input_layout.size.spatial[1] / block_size;
|
||||
const size_t x = input_layout.size.spatial[0] / block_size;
|
||||
const size_t feature = input_layout.feature() * block_size * block_size * block_size;
|
||||
const size_t z = input_layout.spatial(2) / block_size;
|
||||
const size_t y = input_layout.spatial(1) / block_size;
|
||||
const size_t x = input_layout.spatial(0) / block_size;
|
||||
|
||||
return layout{
|
||||
output_type,
|
||||
input_format,
|
||||
tensor(TensorValue(input_layout.size.batch[0]), TensorValue(feature), TensorValue(x), TensorValue(y), TensorValue(z))};
|
||||
tensor(TensorValue(input_layout.batch()), TensorValue(feature), TensorValue(x), TensorValue(y), TensorValue(z))};
|
||||
} else {
|
||||
const size_t feature = input_layout.size.feature[0] * block_size * block_size;
|
||||
const size_t y = input_layout.size.spatial[1] / block_size;
|
||||
const size_t x = input_layout.size.spatial[0] / block_size;
|
||||
const size_t feature = input_layout.feature() * block_size * block_size;
|
||||
const size_t y = input_layout.spatial(1) / block_size;
|
||||
const size_t x = input_layout.spatial(0) / block_size;
|
||||
|
||||
return layout{
|
||||
output_type,
|
||||
input_format,
|
||||
tensor(TensorValue(input_layout.size.batch[0]), TensorValue(feature), TensorValue(x), TensorValue(y))};
|
||||
tensor(TensorValue(input_layout.batch()), TensorValue(feature), TensorValue(x), TensorValue(y))};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,6 +141,6 @@ std::vector<size_t> layout::get_dims_order() const {
|
||||
|
||||
std::string layout::to_string() const {
|
||||
// TODO: Extend with format/data-type info
|
||||
return size.to_string();
|
||||
return format.to_string() + size.to_string();
|
||||
}
|
||||
} // namespace cldnn
|
||||
@@ -128,7 +128,7 @@ memory::ptr memory_pool::get_from_non_padded_pool(const layout& layout,
|
||||
it->second._memory->get_layout().format != format::fs_b_yx_fsv32 &&
|
||||
layout.format != format::fs_b_yx_fsv32 &&
|
||||
((layout.format != format::b_fs_yx_fsv32 && layout.format != format::b_fs_zyx_fsv32) ||
|
||||
(layout.size.feature[0] % 32 == 0)) &&
|
||||
(layout.feature() % 32 == 0)) &&
|
||||
!has_conflict(it->second._users, restrictions, network_id)) {
|
||||
it->second._users.insert(memory_user(id, network_id));
|
||||
auto ret_mem = _engine->reinterpret_buffer(*it->second._memory, layout);
|
||||
@@ -162,10 +162,10 @@ memory::ptr memory_pool::get_from_padded_pool(const layout& layout,
|
||||
if (rec_list._network_id == network_id &&
|
||||
rec_list._type == type &&
|
||||
((layout.format != format::b_fs_yx_fsv32 && layout.format != format::b_fs_zyx_fsv32) ||
|
||||
(layout.size.feature[0] % 32 == 0)) &&
|
||||
(layout.feature() % 32 == 0)) &&
|
||||
// TODO: check if this condition always correct
|
||||
layout.size.feature[0] <= rec_list._memory->get_layout().size.feature[0] &&
|
||||
layout.size.batch[0] <= rec_list._memory->get_layout().size.batch[0] &&
|
||||
layout.feature() <= rec_list._memory->get_layout().feature() &&
|
||||
layout.batch() <= rec_list._memory->get_layout().batch() &&
|
||||
rec_list._memory->get_layout().format != format::fs_b_yx_fsv32 &&
|
||||
layout.format != format::fs_b_yx_fsv32 &&
|
||||
!has_conflict(rec_list._users, restrictions, network_id)) {
|
||||
|
||||
@@ -125,37 +125,37 @@ gpu_image2d::gpu_image2d(ocl_engine* engine, const layout& layout)
|
||||
cl_channel_order order = CL_R;
|
||||
switch (layout.format) {
|
||||
case format::image_2d_weights_c1_b_fyx:
|
||||
_width = layout.size.batch[0];
|
||||
_height = layout.size.spatial[0] * layout.size.feature[0] * layout.size.spatial[1];
|
||||
_width = layout.batch();
|
||||
_height = layout.spatial(0) * layout.feature() * layout.spatial(1);
|
||||
break;
|
||||
case format::image_2d_weights_winograd_6x3_s1_fbxyb:
|
||||
_height = layout.size.feature[0];
|
||||
_width = layout.size.spatial[0] * layout.size.batch[0] * layout.size.spatial[1] * 8 / 3;
|
||||
_height = layout.feature();
|
||||
_width = layout.spatial(0) * layout.batch() * layout.spatial(1) * 8 / 3;
|
||||
break;
|
||||
case format::image_2d_weights_winograd_6x3_s1_xfbyb:
|
||||
_height = layout.size.feature[0] * layout.size.spatial[0] * 8 / 3;
|
||||
_width = layout.size.batch[0] * layout.size.spatial[1];
|
||||
_height = layout.feature() * layout.spatial(0) * 8 / 3;
|
||||
_width = layout.batch() * layout.spatial(1);
|
||||
break;
|
||||
case format::image_2d_weights_c4_fyx_b:
|
||||
_width = layout.size.batch[0];
|
||||
_height = layout.size.spatial[0] * layout.size.feature[0] * layout.size.spatial[1];
|
||||
_width = layout.batch();
|
||||
_height = layout.spatial(0) * layout.feature() * layout.spatial(1);
|
||||
order = CL_RGBA;
|
||||
break;
|
||||
case format::image_2d_rgba:
|
||||
_width = layout.size.spatial[0];
|
||||
_height = layout.size.spatial[1];
|
||||
_width = layout.spatial(0);
|
||||
_height = layout.spatial(1);
|
||||
order = CL_RGBA;
|
||||
if (layout.size.feature[0] != 3 && layout.size.feature[0] != 4) {
|
||||
if (layout.feature() != 3 && layout.feature() != 4) {
|
||||
CLDNN_ERROR_MESSAGE("2D image allocation", "invalid number of channels in image_2d_rgba input image (should be 3 or 4)!");
|
||||
}
|
||||
type = CL_UNORM_INT8;
|
||||
break;
|
||||
case format::nv12:
|
||||
_width = layout.size.spatial[1];
|
||||
_height = layout.size.spatial[0];
|
||||
if (layout.size.feature[0] == 2) {
|
||||
_width = layout.spatial(1);
|
||||
_height = layout.spatial(0);
|
||||
if (layout.feature() == 2) {
|
||||
order = CL_RG;
|
||||
} else if (layout.size.feature[0] > 2) {
|
||||
} else if (layout.feature() > 2) {
|
||||
CLDNN_ERROR_MESSAGE("2D image allocation", "invalid number of channels in NV12 input image!");
|
||||
}
|
||||
type = CL_UNORM_INT8;
|
||||
|
||||
@@ -351,10 +351,10 @@ public:
|
||||
#define CASE_CONV_ELTW_FP32_8 { 1, 32, 3, 5, 4 }, { 1, 16, 1, 3, 2 }, { 1, 1, 2, 1, 1 }, { 1, 1, 3, 3, 3 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 2, data_types::f32, format::b_fs_zyx_fsv16, data_types::f32, format::g_os_is_zyx_isv16_osv16, data_types::f32, format::bfzyx
|
||||
|
||||
#define CASE_CONV_ELTW_i8_1 { 1, 16, 3, 5 }, { 1, 32, 1, 3 }, { 1, 32, 3, 1 }, { 1, 1, 3, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx
|
||||
#define CASE_CONV_ELTW_i8_2 { 1, 16, 3, 5, 3 }, { 1, 32, 2, 4, 2 }, { 1, 1, 2, 4, 2 }, { 1, 1, 2, 2, 2 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oiyx, data_types::f32, format::bfzyx
|
||||
#define CASE_CONV_ELTW_i8_3 { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oiyx, data_types::f32, format::bfzyx
|
||||
#define CASE_CONV_ELTW_i8_2 { 1, 16, 3, 5, 3 }, { 1, 32, 2, 4, 2 }, { 1, 1, 2, 4, 2 }, { 1, 1, 2, 2, 2 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oizyx, data_types::f32, format::bfzyx
|
||||
#define CASE_CONV_ELTW_i8_3 { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oizyx, data_types::f32, format::bfzyx
|
||||
#define CASE_CONV_ELTW_i8_4 { 1, 16, 1, 4 }, { 1, 16, 1, 2 }, { 1, 16, 1, 1 }, { 1, 1, 1, 3 }, { 1, 1 }, { 0, 0 }, { 1, 1 }, 1, data_types::i8, format::b_fs_yx_fsv16, data_types::i8, format::os_is_yx_osv16_isv16, data_types::f32, format::bfyx
|
||||
#define CASE_CONV_ELTW_i8_5 { 1, 16, 1, 4, 1 }, { 1, 16, 1, 2, 1 }, { 1, 16, 2, 1, 1 }, { 1, 1, 1, 3, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oiyx, data_types::f32, format::bfzyx
|
||||
#define CASE_CONV_ELTW_i8_5 { 1, 16, 1, 4, 1 }, { 1, 16, 1, 2, 1 }, { 1, 16, 2, 1, 1 }, { 1, 1, 1, 3, 1 }, { 1, 1, 1 }, { 0, 0, 0 }, { 1, 1, 1 }, 1, data_types::i8, format::bfzyx, data_types::i8, format::oizyx, data_types::f32, format::bfzyx
|
||||
|
||||
/* ----------------------------------------------------------------------------------------------------- */
|
||||
/* ---------------------------------------- FP32 convolution cases ------------------------------------- */
|
||||
|
||||
@@ -55,10 +55,10 @@ TEST(activation_f32_fw_gpu, not_basic_yxfb) {
|
||||
auto output_layout = output_memory->get_layout();
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 5);
|
||||
@@ -100,10 +100,10 @@ TEST(activation_f32_fw_gpu, erf_basic_yxfb) {
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
cldnn::mem_lock<float> input_ptr(input, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 5);
|
||||
@@ -146,10 +146,10 @@ TEST(activation_f32_fw_gpu, hard_sigmoid_basic_yxfb) {
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
cldnn::mem_lock<float> input_ptr(input, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 5);
|
||||
@@ -192,10 +192,10 @@ TEST(activation_f32_fw_gpu, reciprocal_basic_yxfb) {
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
cldnn::mem_lock<float> input_ptr(input, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 5);
|
||||
@@ -239,10 +239,10 @@ TEST(activation_f32_fw_gpu, selu_basic_yxfb) {
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
cldnn::mem_lock<float> input_ptr(input, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 5);
|
||||
@@ -286,10 +286,10 @@ TEST(activation_f32_fw_gpu, softplus_basic_yxfb) {
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
cldnn::mem_lock<float> input_ptr(input, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 5);
|
||||
@@ -332,10 +332,10 @@ TEST(activation_f32_fw_gpu, softsign_basic_yxfb) {
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
cldnn::mem_lock<float> input_ptr(input, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 5);
|
||||
@@ -378,10 +378,10 @@ TEST(activation_f32_fw_gpu, sign_basic_yxfb) {
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
cldnn::mem_lock<float> input_ptr(input, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 5);
|
||||
@@ -415,10 +415,10 @@ TEST(activation_f32_fw_gpu, pow_basic_yxfb) {
|
||||
auto output_layout = output_memory->get_layout();
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 2);
|
||||
EXPECT_EQ(x_size, 2);
|
||||
@@ -451,10 +451,10 @@ TEST(activation_f16_fw_gpu, pow_basic_yxfb) {
|
||||
auto output_layout = output_memory->get_layout();
|
||||
cldnn::mem_lock<FLOAT16> output_ptr(output_memory, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 2);
|
||||
EXPECT_EQ(x_size, 2);
|
||||
@@ -508,10 +508,10 @@ TEST(activation_f32_fw_gpu, relu_basic_yxfb) {
|
||||
auto output_layout = output_memory->get_layout();
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 5);
|
||||
@@ -584,11 +584,11 @@ TEST(activation_f32_fw_gpu, relu_basic_bfzyx) {
|
||||
auto output_layout = output_memory->get_layout();
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
|
||||
int z_size = output_layout.size.spatial[2];
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int z_size = output_layout.spatial(2);
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::bfzyx);
|
||||
EXPECT_EQ(z_size, 2);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
@@ -682,10 +682,10 @@ TEST(activation_f32_fw_gpu, basic_yxfb_all_functions)
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
cldnn::mem_lock<float> input_ptr(input, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 5);
|
||||
@@ -832,10 +832,10 @@ TEST(activation_f16_fw_gpu, basic_bfyx_all_functions)
|
||||
cldnn::mem_lock<FLOAT16> output_ptr(output_memory, get_test_stream());
|
||||
cldnn::mem_lock<FLOAT16> input_ptr(input, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::bfyx);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 2);
|
||||
@@ -910,10 +910,10 @@ TEST(activation_f32_fw_gpu, basic_yxfb_asin_acos_log_atan)
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
cldnn::mem_lock<float> input_ptr(input, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 2);
|
||||
@@ -995,10 +995,10 @@ TEST(activation_f32_fw_gpu, relu_basic_acosh_yxfb) {
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
cldnn::mem_lock<float> input_ptr(input, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 5);
|
||||
@@ -1060,10 +1060,10 @@ TEST(activation_f32_fw_gpu, relu_basic_input_padding_yxfb) {
|
||||
auto output_layout = output_memory->get_layout();
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 5);
|
||||
@@ -1148,11 +1148,11 @@ TEST(activation_f32_fw_gpu, relu_basic_input_padding_bfzyx) {
|
||||
auto output_layout = output_memory->get_layout();
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
|
||||
int z_size = output_layout.size.spatial[2];
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int z_size = output_layout.spatial(2);
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::bfzyx);
|
||||
EXPECT_EQ(z_size, 2);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
@@ -1265,10 +1265,10 @@ TEST(activation_f32_fw_gpu, basic_yxfb_floor_ceil)
|
||||
cldnn::mem_lock<float> output_ptr(output_memory, get_test_stream());
|
||||
cldnn::mem_lock<float> input_ptr(input, get_test_stream());
|
||||
|
||||
int y_size = output_layout.size.spatial[1];
|
||||
int x_size = output_layout.size.spatial[0];
|
||||
int f_size = output_layout.size.feature[0];
|
||||
int b_size = output_layout.size.batch[0];
|
||||
int y_size = output_layout.spatial(1);
|
||||
int x_size = output_layout.spatial(0);
|
||||
int f_size = output_layout.feature();
|
||||
int b_size = output_layout.batch();
|
||||
EXPECT_EQ(output_layout.format, format::yxfb);
|
||||
EXPECT_EQ(y_size, 4);
|
||||
EXPECT_EQ(x_size, 2);
|
||||
@@ -1487,11 +1487,11 @@ struct activation_random_test : testing::TestWithParam<activation_random_test_pa
|
||||
|
||||
template <typename T>
|
||||
void fill_random_typed(memory::ptr mem, int min, int max, int k) {
|
||||
auto size = mem->get_layout().size;
|
||||
size_t b = size.batch[0];
|
||||
size_t f = size.feature[0];
|
||||
size_t x = size.spatial[0];
|
||||
size_t y = size.spatial[1];
|
||||
auto l = mem->get_layout();
|
||||
size_t b = l.batch();
|
||||
size_t f = l.feature();
|
||||
size_t x = l.spatial(0);
|
||||
size_t y = l.spatial(1);
|
||||
|
||||
auto data = generate_random_4d<T>(b, f, y, x, min, max, k);
|
||||
mem_lock<T> ptr{mem, get_test_stream()};
|
||||
@@ -1532,10 +1532,10 @@ struct activation_random_test : testing::TestWithParam<activation_random_test_pa
|
||||
bool compare_outputs(const memory::ptr out_ref, const memory::ptr out_opt) {
|
||||
auto output_lay = out_ref->get_layout();
|
||||
auto opt_output_lay = out_opt->get_layout();
|
||||
size_t b = output_lay.size.batch[0];
|
||||
size_t f = output_lay.size.feature[0];
|
||||
size_t x = output_lay.size.spatial[0];
|
||||
size_t y = output_lay.size.spatial[1];
|
||||
size_t b = output_lay.batch();
|
||||
size_t f = output_lay.feature();
|
||||
size_t x = output_lay.spatial(0);
|
||||
size_t y = output_lay.spatial(1);
|
||||
cldnn::mem_lock<T> ref_ptr(out_ref, get_test_stream());
|
||||
cldnn::mem_lock<T> opt_ptr(out_opt, get_test_stream());
|
||||
|
||||
|
||||
@@ -50,8 +50,8 @@ TEST(DISABLED_oooq_test, simple)
|
||||
net.set_input_data("in", input_mem);
|
||||
auto output = net.execute().at("c9").get_memory();
|
||||
|
||||
EXPECT_TRUE(output->get_layout().size.spatial[0] == 2);
|
||||
EXPECT_TRUE(output->get_layout().size.spatial[1] == 2);
|
||||
EXPECT_TRUE(output->get_layout().size.feature[0] == 1);
|
||||
EXPECT_TRUE(output->get_layout().size.batch[0] == 1);
|
||||
EXPECT_TRUE(output->get_layout().spatial(0) == 2);
|
||||
EXPECT_TRUE(output->get_layout().spatial(1) == 2);
|
||||
EXPECT_TRUE(output->get_layout().feature() == 1);
|
||||
EXPECT_TRUE(output->get_layout().batch() == 1);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
}
|
||||
|
||||
void check_results(const memory::ptr output, const int num, const std::string values) {
|
||||
assert(num < output->get_layout().size.spatial[1]);
|
||||
assert(num < output->get_layout().spatial(1));
|
||||
|
||||
// Split values to vector of items.
|
||||
std::vector<std::string> items;
|
||||
@@ -129,10 +129,10 @@ public:
|
||||
cldnn::mem_lock<T> out_ptr(output, get_test_stream());
|
||||
const T* data = out_ptr.data();
|
||||
for (int i = 0; i < 2; ++i) {
|
||||
EXPECT_EQ(static_cast<int>((float)data[num * output->get_layout().size.spatial[0] + i]), atoi(items[i].c_str()));
|
||||
EXPECT_EQ(static_cast<int>((float)data[num * output->get_layout().spatial(0) + i]), atoi(items[i].c_str()));
|
||||
}
|
||||
for (int i = 2; i < 7; ++i) {
|
||||
EXPECT_TRUE(floating_point_equal(data[num * output->get_layout().size.spatial[0] + i], (T)(float)atof(items[i].c_str())));
|
||||
EXPECT_TRUE(floating_point_equal(data[num * output->get_layout().spatial(0) + i], (T)(float)atof(items[i].c_str())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,10 +164,10 @@ public:
|
||||
EXPECT_EQ(outputs.size(), size_t(1));
|
||||
EXPECT_EQ(outputs.begin()->first, "detection_output");
|
||||
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.batch[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.feature[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[1], keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[0], 7);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().batch(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().feature(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(1), keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(0), 7);
|
||||
}
|
||||
|
||||
void setup_two_layers() {
|
||||
@@ -202,10 +202,10 @@ public:
|
||||
|
||||
EXPECT_EQ(it->first, "detection_output_" + std::to_string(i));
|
||||
|
||||
EXPECT_EQ(it->second.get_memory()->get_layout().size.batch[0], 1);
|
||||
EXPECT_EQ(it->second.get_memory()->get_layout().size.feature[0], 1);
|
||||
EXPECT_EQ(it->second.get_memory()->get_layout().size.spatial[1], keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(it->second.get_memory()->get_layout().size.spatial[0], 7);
|
||||
EXPECT_EQ(it->second.get_memory()->get_layout().batch(), 1);
|
||||
EXPECT_EQ(it->second.get_memory()->get_layout().feature(), 1);
|
||||
EXPECT_EQ(it->second.get_memory()->get_layout().spatial(1), keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(it->second.get_memory()->get_layout().spatial(0), 7);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
@@ -241,10 +241,10 @@ public:
|
||||
EXPECT_EQ(outputs.size(), size_t(1));
|
||||
EXPECT_EQ(outputs.begin()->first, "detection_output");
|
||||
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.batch[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.feature[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[1], keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[0], 7);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().batch(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().feature(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(1), keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(0), 7);
|
||||
|
||||
auto output_prim = outputs.begin()->second.get_memory();
|
||||
|
||||
@@ -289,10 +289,10 @@ public:
|
||||
EXPECT_EQ(outputs.size(), size_t(1));
|
||||
EXPECT_EQ(outputs.begin()->first, "detection_output");
|
||||
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.batch[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.feature[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[1], keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[0], 7);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().batch(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().feature(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(1), keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(0), 7);
|
||||
|
||||
auto output_prim = outputs.begin()->second.get_memory();
|
||||
|
||||
@@ -331,10 +331,10 @@ public:
|
||||
EXPECT_EQ(outputs.size(), size_t(1));
|
||||
EXPECT_EQ(outputs.begin()->first, "detection_output");
|
||||
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.batch[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.feature[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[1], keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[0], 7);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().batch(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().feature(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(1), keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(0), 7);
|
||||
|
||||
auto output_prim = outputs.begin()->second.get_memory();
|
||||
|
||||
@@ -384,10 +384,10 @@ public:
|
||||
EXPECT_EQ(outputs.size(), size_t(1));
|
||||
EXPECT_EQ(outputs.begin()->first, "detection_output");
|
||||
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.batch[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.feature[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[1], keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[0], 7);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().batch(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().feature(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(1), keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(0), 7);
|
||||
|
||||
auto output_prim = outputs.begin()->second.get_memory();
|
||||
|
||||
@@ -428,10 +428,10 @@ public:
|
||||
EXPECT_EQ(outputs.size(), size_t(1));
|
||||
EXPECT_EQ(outputs.begin()->first, "detection_output");
|
||||
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.batch[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.feature[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[1], keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[0], 7);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().batch(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().feature(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(1), keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(0), 7);
|
||||
|
||||
auto output_prim = outputs.begin()->second.get_memory();
|
||||
|
||||
@@ -489,10 +489,10 @@ public:
|
||||
EXPECT_EQ(outputs.size(), size_t(1));
|
||||
EXPECT_EQ(outputs.begin()->first, "detection_output");
|
||||
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.batch[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.feature[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[1], keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[0], 7);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().batch(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().feature(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(1), keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(0), 7);
|
||||
|
||||
auto output_prim = outputs.begin()->second.get_memory();
|
||||
|
||||
@@ -537,10 +537,10 @@ public:
|
||||
EXPECT_EQ(outputs.size(), size_t(1));
|
||||
EXPECT_EQ(outputs.begin()->first, "detection_output");
|
||||
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.batch[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.feature[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[1], keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[0], 7);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().batch(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().feature(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(1), keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(0), 7);
|
||||
|
||||
auto output_prim = outputs.begin()->second.get_memory();
|
||||
|
||||
@@ -588,10 +588,10 @@ public:
|
||||
EXPECT_EQ(outputs.size(), size_t(1));
|
||||
EXPECT_EQ(outputs.begin()->first, "detection_output");
|
||||
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.batch[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.feature[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[1], keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[0], 7);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().batch(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().feature(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(1), keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(0), 7);
|
||||
|
||||
auto output_prim = outputs.begin()->second.get_memory();
|
||||
|
||||
@@ -634,10 +634,10 @@ public:
|
||||
EXPECT_EQ(outputs.size(), size_t(1));
|
||||
EXPECT_EQ(outputs.begin()->first, "detection_output");
|
||||
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.batch[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.feature[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[1], keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[0], 7);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().batch(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().feature(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(1), keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(0), 7);
|
||||
|
||||
auto output_prim = outputs.begin()->second.get_memory();
|
||||
|
||||
@@ -697,10 +697,10 @@ public:
|
||||
EXPECT_EQ(outputs.size(), size_t(1));
|
||||
EXPECT_EQ(outputs.begin()->first, "detection_output");
|
||||
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.batch[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.feature[0], 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[1], keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().size.spatial[0], 7);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().batch(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().feature(), 1);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(1), keep_top_k * this->num_of_images);
|
||||
EXPECT_EQ(outputs.begin()->second.get_memory()->get_layout().spatial(0), 7);
|
||||
|
||||
auto output_prim = outputs.begin()->second.get_memory();
|
||||
|
||||
|
||||
@@ -116,11 +116,11 @@ void generic_eltwise_test(cldnn::format test_input_fmt, int input_b, int input_f
|
||||
|
||||
VVVVF<T> output_cpu = eltwise_reference<T>(input1_rnd, input2_rnd, mode, relu, slope, input_padding_y, input_padding_x, output_padding_y, output_padding_x);
|
||||
EXPECT_EQ(output_layout.format.value, test_input_fmt.value);
|
||||
tensor output_tensor = output_layout.get_buffer_size();
|
||||
int y_size = output_tensor.spatial[1];
|
||||
int x_size = output_tensor.spatial[0];
|
||||
int f_size = output_tensor.feature[0];
|
||||
int b_size = output_tensor.batch[0];
|
||||
auto output_tensor = output_layout.get_padded_dims();
|
||||
int x_size = output_tensor[3];
|
||||
int y_size = output_tensor[2];
|
||||
int f_size = output_tensor[1];
|
||||
int b_size = output_tensor[0];
|
||||
EXPECT_EQ(y_size, (int)output_cpu[0][0].size());
|
||||
EXPECT_EQ(x_size, (int)output_cpu[0][0][0].size());
|
||||
EXPECT_EQ(f_size, (int)output_cpu[0].size());
|
||||
@@ -3031,11 +3031,12 @@ void generic_eltwise_bool_test(cldnn::format test_input_fmt, int input_b, int in
|
||||
|
||||
VVVVF<int8_t> output_cpu = eltwise_bool_reference<T>(input1_rnd, input2_rnd, mode, input_padding_y, input_padding_x, output_padding_y, output_padding_x);
|
||||
EXPECT_EQ(output_layout.format.value, test_input_fmt.value);
|
||||
tensor output_tensor = output_layout.get_buffer_size();
|
||||
int y_size = output_tensor.spatial[1];
|
||||
int x_size = output_tensor.spatial[0];
|
||||
int f_size = output_tensor.feature[0];
|
||||
int b_size = output_tensor.batch[0];
|
||||
auto output_tensor = output_layout.get_padded_dims();
|
||||
int x_size = output_tensor[3];
|
||||
int y_size = output_tensor[2];
|
||||
int f_size = output_tensor[1];
|
||||
int b_size = output_tensor[0];
|
||||
|
||||
EXPECT_EQ(y_size, (int)output_cpu[0][0].size());
|
||||
EXPECT_EQ(x_size, (int)output_cpu[0][0][0].size());
|
||||
EXPECT_EQ(f_size, (int)output_cpu[0].size());
|
||||
@@ -3330,11 +3331,11 @@ struct eltwise_same_input_test : testing::TestWithParam<eltwise_same_input_test_
|
||||
{
|
||||
template <typename T>
|
||||
void fill_random_typed(memory::ptr mem, int min, int max, int k) {
|
||||
auto size = mem->get_layout().size;
|
||||
size_t b = size.batch[0];
|
||||
size_t f = size.feature[0];
|
||||
size_t x = size.spatial[0];
|
||||
size_t y = size.spatial[1];
|
||||
auto l = mem->get_layout();
|
||||
size_t b = l.batch();
|
||||
size_t f = l.feature();
|
||||
size_t x = l.spatial(0);
|
||||
size_t y = l.spatial(1);
|
||||
|
||||
auto data = generate_random_4d<T>(b, f, y, x, min, max, k);
|
||||
mem_lock<T> ptr{mem, get_test_stream()};
|
||||
@@ -3376,10 +3377,10 @@ struct eltwise_same_input_test : testing::TestWithParam<eltwise_same_input_test_
|
||||
auto output_lay = out_ref->get_layout();
|
||||
auto opt_output_lay = input_ref->get_layout();
|
||||
|
||||
size_t b = output_lay.size.batch[0];
|
||||
size_t f = output_lay.size.feature[0];
|
||||
size_t x = output_lay.size.spatial[0];
|
||||
size_t y = output_lay.size.spatial[1];
|
||||
size_t b = output_lay.batch();
|
||||
size_t f = output_lay.feature();
|
||||
size_t x = output_lay.spatial(0);
|
||||
size_t y = output_lay.spatial(1);
|
||||
mem_lock<T> ref_ptr{out_ref, get_test_stream()};
|
||||
mem_lock<T> input_ptr{input_ref, get_test_stream()};
|
||||
for (size_t bi = 0; bi < b; ++bi) {
|
||||
@@ -3917,11 +3918,11 @@ struct eltwise_random_test : testing::TestWithParam<eltwise_random_test_params>
|
||||
{
|
||||
template <typename T>
|
||||
void fill_random_typed(memory::ptr mem, int min, int max, int k) {
|
||||
auto size = mem->get_layout().size;
|
||||
size_t b = size.batch[0];
|
||||
size_t f = size.feature[0];
|
||||
size_t x = size.spatial[0];
|
||||
size_t y = size.spatial[1];
|
||||
auto l = mem->get_layout();
|
||||
size_t b = l.batch();
|
||||
size_t f = l.feature();
|
||||
size_t x = l.spatial(0);
|
||||
size_t y = l.spatial(1);
|
||||
|
||||
auto data = generate_random_4d<T>(b, f, y, x, min, max, k);
|
||||
mem_lock<T> ptr{mem, get_test_stream()};
|
||||
@@ -3963,10 +3964,10 @@ struct eltwise_random_test : testing::TestWithParam<eltwise_random_test_params>
|
||||
auto output_lay = out_ref->get_layout();
|
||||
auto opt_output_lay = out_opt->get_layout();
|
||||
|
||||
size_t b = output_lay.size.batch[0];
|
||||
size_t f = output_lay.size.feature[0];
|
||||
size_t x = output_lay.size.spatial[0];
|
||||
size_t y = output_lay.size.spatial[1];
|
||||
size_t b = output_lay.batch();
|
||||
size_t f = output_lay.feature();
|
||||
size_t x = output_lay.spatial(0);
|
||||
size_t y = output_lay.spatial(1);
|
||||
mem_lock<T> ref_ptr{out_ref, get_test_stream()};
|
||||
mem_lock<T> opt_ptr{out_opt, get_test_stream()};
|
||||
for (size_t bi = 0; bi < b; ++bi) {
|
||||
|
||||
@@ -84,10 +84,10 @@ TEST(loop_gpu, basic_no_concat)
|
||||
auto output = outputs.begin()->second.get_memory();
|
||||
auto output_layout = output->get_layout();
|
||||
|
||||
EXPECT_EQ(output_layout.size.batch[0], 1);
|
||||
EXPECT_EQ(output_layout.size.feature[0], 1);
|
||||
EXPECT_EQ(output_layout.size.spatial[0], 4);
|
||||
EXPECT_EQ(output_layout.size.spatial[1], 5);
|
||||
EXPECT_EQ(output_layout.batch(), 1);
|
||||
EXPECT_EQ(output_layout.feature(), 1);
|
||||
EXPECT_EQ(output_layout.spatial(0), 4);
|
||||
EXPECT_EQ(output_layout.spatial(1), 5);
|
||||
|
||||
// value check
|
||||
{
|
||||
@@ -179,10 +179,10 @@ TEST(loop_gpu, basic_concat)
|
||||
auto output = outputs.begin()->second.get_memory();
|
||||
auto output_layout = output->get_layout();
|
||||
|
||||
EXPECT_EQ(output_layout.size.batch[0], 1);
|
||||
EXPECT_EQ(output_layout.size.feature[0], 1);
|
||||
EXPECT_EQ(output_layout.size.spatial[0], 4);
|
||||
EXPECT_EQ(output_layout.size.spatial[1], 5);
|
||||
EXPECT_EQ(output_layout.batch(), 1);
|
||||
EXPECT_EQ(output_layout.feature(), 1);
|
||||
EXPECT_EQ(output_layout.spatial(0), 4);
|
||||
EXPECT_EQ(output_layout.spatial(1), 5);
|
||||
|
||||
// value check
|
||||
{
|
||||
@@ -333,10 +333,10 @@ TEST(loop_gpu, basic_concat_nested)
|
||||
/////////////////////////////////
|
||||
// compare
|
||||
/////////////////////////////////
|
||||
EXPECT_EQ(output_layout.size.batch[0], 1);
|
||||
EXPECT_EQ(output_layout.size.feature[0], 1);
|
||||
EXPECT_EQ(output_layout.size.spatial[0], 4);
|
||||
EXPECT_EQ(output_layout.size.spatial[1], 5);
|
||||
EXPECT_EQ(output_layout.batch(), 1);
|
||||
EXPECT_EQ(output_layout.feature(), 1);
|
||||
EXPECT_EQ(output_layout.spatial(0), 4);
|
||||
EXPECT_EQ(output_layout.spatial(1), 5);
|
||||
|
||||
// check output values
|
||||
EXPECT_EQ(output_layout.count(), expected.size());
|
||||
|
||||
@@ -272,20 +272,20 @@ struct lstm_dynamic_input_layer_test : public ::testing::Test
|
||||
|
||||
auto outputs = network.execute();
|
||||
auto out = outputs.at("dynamic_lstm_input");
|
||||
auto out_tensor = out.get_memory()->get_layout().size;
|
||||
auto out_layout = out.get_memory()->get_layout();
|
||||
cldnn::mem_lock<T> out_ptr(out.get_memory(), get_test_stream());
|
||||
|
||||
|
||||
auto output_ref = dynamic_lstm::lstm_dynamic_input_ref(ref_input, ref_weights, ref_bias, dynamic_lengths, max_sequence_len, has_bias, direction);
|
||||
|
||||
size_t i = 0;
|
||||
for (auto b = 0; b < out_tensor.batch[0]; b++)
|
||||
for (auto b = 0; b < out_layout.batch(); b++)
|
||||
{
|
||||
for (auto len = 0; len < max_sequence_len; len++)
|
||||
{
|
||||
for (auto dir = 0; dir < direction; dir++)
|
||||
{
|
||||
for (auto x = 0; x < out_tensor.spatial[0]; x++)
|
||||
for (auto x = 0; x < out_layout.spatial(0); x++)
|
||||
{
|
||||
EXPECT_NEAR(output_ref[b][len][dir][x], (float)out_ptr[i++], 1e-3f)
|
||||
<< "b:" << b << ", "
|
||||
@@ -436,19 +436,19 @@ struct lstm_dynamic_single_layer_test : public ::testing::Test
|
||||
clip_threshold, input_forget);
|
||||
auto real_outs = network.execute();
|
||||
auto out = real_outs.at("dynamic_lstm");
|
||||
auto out_tensor = out.get_memory()->get_layout().size;
|
||||
auto out_layout = out.get_memory()->get_layout();
|
||||
|
||||
cldnn::mem_lock<T> out_ptr(out.get_memory(), get_test_stream());
|
||||
cldnn::mem_lock<T> last_hidden_ptr(last_hidden_mem, get_test_stream());
|
||||
cldnn::mem_lock<T> last_cell_ptr(last_cell_mem, get_test_stream());
|
||||
size_t i = 0, i_lh = 0, i_lc = 0;
|
||||
for (auto b = 0; b < out_tensor.batch[0]; b++)
|
||||
for (auto b = 0; b < out_layout.batch(); b++)
|
||||
{
|
||||
for (auto len = 0; len < max_sequence_len; len++)
|
||||
{
|
||||
for (auto dir = 0; dir < direction; dir++)
|
||||
{
|
||||
for (auto x = 0; x < out_tensor.spatial[0]; x++)
|
||||
for (auto x = 0; x < out_layout.spatial(0); x++)
|
||||
{
|
||||
//check hidden
|
||||
if (len < dynamic_lengths[b])
|
||||
|
||||
@@ -618,14 +618,13 @@ void generic_lstm_gpu_test(int layers, int sequence_len, int direction, int batc
|
||||
|
||||
// Get the output tensor
|
||||
cldnn::layout output_layout = output->get_layout();
|
||||
cldnn::tensor output_tensor = output_layout.size;
|
||||
|
||||
// Compare the output tensor configuration against the reference value
|
||||
// Output tensor is configured in bfyx format
|
||||
ASSERT_EQ(batch_size, output_tensor.batch[0]);
|
||||
ASSERT_EQ(sequence_len, output_tensor.feature[0]);
|
||||
ASSERT_EQ(direction, output_tensor.spatial[1]);
|
||||
ASSERT_EQ(hidden_size, output_tensor.spatial[0]);
|
||||
ASSERT_EQ(batch_size, output_layout.batch());
|
||||
ASSERT_EQ(sequence_len, output_layout.feature());
|
||||
ASSERT_EQ(direction, output_layout.spatial(1));
|
||||
ASSERT_EQ(hidden_size, output_layout.spatial(0));
|
||||
|
||||
cldnn::mem_lock<T> output_ptr(output, get_test_stream());
|
||||
int32_t i = 0;
|
||||
@@ -746,7 +745,7 @@ void lstm_gpu_output_test(const lstm_output_selection& output_selection, int dir
|
||||
|
||||
for (auto itr = outputs.begin(); itr != outputs.end(); itr++)
|
||||
{
|
||||
auto output_tensor = itr->second.get_memory()->get_layout().size;
|
||||
auto output_layout = itr->second.get_memory()->get_layout();
|
||||
primitive_id primitive_name = itr->first;
|
||||
|
||||
cldnn::memory::ptr output_memory = itr->second.get_memory();
|
||||
@@ -782,10 +781,10 @@ void lstm_gpu_output_test(const lstm_output_selection& output_selection, int dir
|
||||
|
||||
// Compare the output tensor configuration against the reference value
|
||||
// Output tensor is configured in bfyx format
|
||||
ASSERT_EQ(ref_batch_size, output_tensor.batch[0]);
|
||||
ASSERT_EQ(ref_seq_len, output_tensor.feature[0]); // Sequence length should match
|
||||
ASSERT_EQ(ref_directions, output_tensor.spatial[1]); // directions should match
|
||||
ASSERT_EQ(ref_hidden_size, output_tensor.spatial[0]); // input size should match
|
||||
ASSERT_EQ(ref_batch_size, output_layout.batch());
|
||||
ASSERT_EQ(ref_seq_len, output_layout.feature()); // Sequence length should match
|
||||
ASSERT_EQ(ref_directions, output_layout.spatial(1)); // directions should match
|
||||
ASSERT_EQ(ref_hidden_size, output_layout.spatial(0)); // input size should match
|
||||
|
||||
cldnn::mem_lock<T> output_ptr(output_memory, get_test_stream());
|
||||
|
||||
@@ -912,7 +911,7 @@ void lstm_gpu_format_test(const cldnn::format& format, int directions) {
|
||||
|
||||
for (auto itr = outputs.begin(); itr != outputs.end(); itr++)
|
||||
{
|
||||
auto output_tensor = itr->second.get_memory()->get_layout().size;
|
||||
auto output_layout = itr->second.get_memory()->get_layout();
|
||||
primitive_id primitive_name = itr->first;
|
||||
|
||||
cldnn::memory::ptr output_memory = itr->second.get_memory();
|
||||
@@ -948,10 +947,10 @@ void lstm_gpu_format_test(const cldnn::format& format, int directions) {
|
||||
|
||||
// Compare the output tensor configuration against the reference value
|
||||
// Output tensor is configured in bfyx format
|
||||
ASSERT_EQ(ref_batch_size, output_tensor.batch[0]);
|
||||
ASSERT_EQ(ref_seq_len, output_tensor.feature[0]); // Sequence length should match
|
||||
ASSERT_EQ(ref_directions, output_tensor.spatial[1]); // directions should match
|
||||
ASSERT_EQ(ref_hidden_size, output_tensor.spatial[0]); // input size should match
|
||||
ASSERT_EQ(ref_batch_size, output_layout.batch());
|
||||
ASSERT_EQ(ref_seq_len, output_layout.feature()); // Sequence length should match
|
||||
ASSERT_EQ(ref_directions, output_layout.spatial(1)); // directions should match
|
||||
ASSERT_EQ(ref_hidden_size, output_layout.spatial(0)); // input size should match
|
||||
|
||||
cldnn::mem_lock<T> output_ptr(output_memory, get_test_stream());
|
||||
|
||||
@@ -1233,14 +1232,13 @@ void lstm_gpu_concatenated_input_test(int layers, int sequence_len, int directio
|
||||
|
||||
// Get the output tensor
|
||||
cldnn::layout output_layout = output->get_layout();
|
||||
cldnn::tensor output_tensor = output_layout.size;
|
||||
|
||||
// Compare the output tensor configuration against the reference value
|
||||
// Output tensor is configured in bfyx format
|
||||
ASSERT_EQ(batch_size, output_tensor.batch[0]);
|
||||
ASSERT_EQ(sequence_len, output_tensor.feature[0]);
|
||||
ASSERT_EQ(direction, output_tensor.spatial[1]);
|
||||
ASSERT_EQ(hidden_size, output_tensor.spatial[0]);
|
||||
ASSERT_EQ(batch_size, output_layout.batch());
|
||||
ASSERT_EQ(sequence_len, output_layout.feature());
|
||||
ASSERT_EQ(direction, output_layout.spatial(1));
|
||||
ASSERT_EQ(hidden_size, output_layout.spatial(0));
|
||||
|
||||
cldnn::mem_lock<T> output_ptr(output, get_test_stream());
|
||||
int32_t i = 0;
|
||||
@@ -1571,7 +1569,7 @@ void lstm_gpu_chain_test(int batch_size, int input_size, int hidden_size,
|
||||
auto outputs = network.execute();
|
||||
for (auto itr = outputs.begin(); itr != outputs.end(); itr++)
|
||||
{
|
||||
auto output_tensor = itr->second.get_memory()->get_layout().size;
|
||||
auto output_layout = itr->second.get_memory()->get_layout();
|
||||
primitive_id primitive_name = itr->first;
|
||||
|
||||
// Split the primitive id to get the chain id
|
||||
@@ -1617,10 +1615,10 @@ void lstm_gpu_chain_test(int batch_size, int input_size, int hidden_size,
|
||||
|
||||
// Compare the output tensor configuration against the reference value
|
||||
// Output tensor is configured in bfyx format
|
||||
ASSERT_EQ(ref_batch_size, output_tensor.batch[0]);
|
||||
ASSERT_EQ(ref_seq_len, output_tensor.feature[0]); // Sequence length should match
|
||||
ASSERT_EQ(ref_directions, output_tensor.spatial[1]); // directions should match
|
||||
ASSERT_EQ(ref_hidden_size, output_tensor.spatial[0]); // input size should match
|
||||
ASSERT_EQ(ref_batch_size, output_layout.batch());
|
||||
ASSERT_EQ(ref_seq_len, output_layout.feature()); // Sequence length should match
|
||||
ASSERT_EQ(ref_directions, output_layout.spatial(1)); // directions should match
|
||||
ASSERT_EQ(ref_hidden_size, output_layout.spatial(0)); // input size should match
|
||||
|
||||
cldnn::mem_lock<T> output_ptr(output_memory, get_test_stream());
|
||||
|
||||
|
||||
@@ -21,13 +21,13 @@ class mvn_gpu_test : public ::testing::TestWithParam<cldnn::format> {};
|
||||
|
||||
template <typename T>
|
||||
void mvn_compute_mean_across_channels(cldnn::memory::ptr output, bool normalize_variance) {
|
||||
auto output_size = output->get_layout().size;
|
||||
auto l = output->get_layout();
|
||||
|
||||
uint32_t batch_size = output_size.batch[0];
|
||||
uint32_t feature_size = output_size.feature[0];
|
||||
uint32_t z_size = output_size.spatial[2];
|
||||
uint32_t y_size = output_size.spatial[1];
|
||||
uint32_t x_size = output_size.spatial[0];
|
||||
uint32_t batch_size = l.batch();
|
||||
uint32_t feature_size = l.feature();
|
||||
uint32_t z_size = l.spatial(2);
|
||||
uint32_t y_size = l.spatial(1);
|
||||
uint32_t x_size = l.spatial(0);
|
||||
|
||||
cldnn::mem_lock<T> buff(output, get_test_stream());
|
||||
|
||||
@@ -64,13 +64,13 @@ void mvn_compute_mean_across_channels(cldnn::memory::ptr output, bool normalize_
|
||||
|
||||
template <typename T>
|
||||
void mvn_compute_mean_within_channels(cldnn::memory::ptr output, bool normalize_variance) {
|
||||
auto output_size = output->get_layout().size;
|
||||
auto l = output->get_layout();
|
||||
|
||||
uint32_t batch_size = output_size.batch[0];
|
||||
uint32_t feature_size = output_size.feature[0];
|
||||
uint32_t z_size = output_size.spatial[2];
|
||||
uint32_t y_size = output_size.spatial[1];
|
||||
uint32_t x_size = output_size.spatial[0];
|
||||
uint32_t batch_size = l.batch();
|
||||
uint32_t feature_size = l.feature();
|
||||
uint32_t z_size = l.spatial(2);
|
||||
uint32_t y_size = l.spatial(1);
|
||||
uint32_t x_size = l.spatial(0);
|
||||
|
||||
cldnn::mem_lock<T> buff(output, get_test_stream());
|
||||
|
||||
@@ -550,13 +550,13 @@ struct mvn_basic_test_params {
|
||||
struct mvn_random_test : ::testing::TestWithParam<mvn_basic_test_params> {
|
||||
template <typename T>
|
||||
void fill_data(memory::ptr mem, const tests::VVVVVF<T>& data) {
|
||||
auto size = mem->get_layout().size;
|
||||
auto l = mem->get_layout();
|
||||
cldnn::mem_lock<T> ptr(mem, get_test_stream());
|
||||
for (size_t bi = 0; bi < static_cast<size_t>(size.batch[0]); ++bi) {
|
||||
for (size_t fi = 0; fi < static_cast<size_t>(size.feature[0]); ++fi) {
|
||||
for (size_t zi = 0; zi < static_cast<size_t>(size.spatial[2]); ++zi) {
|
||||
for (size_t yi = 0; yi < static_cast<size_t>(size.spatial[1]); ++yi) {
|
||||
for (size_t xi = 0; xi < static_cast<size_t>(size.spatial[0]); ++xi) {
|
||||
for (size_t bi = 0; bi < static_cast<size_t>(l.batch()); ++bi) {
|
||||
for (size_t fi = 0; fi < static_cast<size_t>(l.feature()); ++fi) {
|
||||
for (size_t zi = 0; zi < static_cast<size_t>(l.spatial(2)); ++zi) {
|
||||
for (size_t yi = 0; yi < static_cast<size_t>(l.spatial(1)); ++yi) {
|
||||
for (size_t xi = 0; xi < static_cast<size_t>(l.spatial(0)); ++xi) {
|
||||
auto tensor_addr = tensor(batch(bi), feature(fi), spatial(xi, yi, zi, 0));
|
||||
auto offset = mem->get_layout().get_linear_offset(tensor_addr);
|
||||
ptr[offset] = data[bi][fi][xi][yi][zi];
|
||||
@@ -569,12 +569,12 @@ struct mvn_random_test : ::testing::TestWithParam<mvn_basic_test_params> {
|
||||
|
||||
template <typename T>
|
||||
void fill_random_data(memory::ptr mem, int min, int max, int k = 8) {
|
||||
auto size = mem->get_layout().size;
|
||||
auto input_data = tests::generate_random_5d<T>(size.batch[0],
|
||||
size.feature[0],
|
||||
size.spatial[0],
|
||||
size.spatial[1],
|
||||
size.spatial[2],
|
||||
auto l = mem->get_layout();
|
||||
auto input_data = tests::generate_random_5d<T>(l.batch(),
|
||||
l.feature(),
|
||||
l.spatial(0),
|
||||
l.spatial(1),
|
||||
l.spatial(2),
|
||||
min,
|
||||
max,
|
||||
k);
|
||||
@@ -718,15 +718,15 @@ INSTANTIATE_TEST_SUITE_P(extended,
|
||||
struct mvn_random_test_bsv32 : ::testing::TestWithParam<mvn_basic_test_params> {
|
||||
template <typename T>
|
||||
void fill_data(cldnn::memory::ptr mem, const tests::VVVVVF<T>& data) {
|
||||
auto size = mem->get_layout().size;
|
||||
auto l = mem->get_layout();
|
||||
cldnn::mem_lock<T> ptr(mem, get_test_stream());
|
||||
for (size_t bi = 0; bi < static_cast<size_t>(size.batch[0]); ++bi) {
|
||||
for (size_t fi = 0; fi < static_cast<size_t>(size.feature[0]); ++fi) {
|
||||
for (size_t zi = 0; zi < static_cast<size_t>(size.spatial[2]); ++zi) {
|
||||
for (size_t yi = 0; yi < static_cast<size_t>(size.spatial[1]); ++yi) {
|
||||
for (size_t bi = 0; bi < static_cast<size_t>(l.batch()); ++bi) {
|
||||
for (size_t fi = 0; fi < static_cast<size_t>(l.feature()); ++fi) {
|
||||
for (size_t zi = 0; zi < static_cast<size_t>(l.spatial(2)); ++zi) {
|
||||
for (size_t yi = 0; yi < static_cast<size_t>(l.spatial(1)); ++yi) {
|
||||
auto tensor_addr = tensor(batch(bi), feature(fi), spatial(0, yi, zi, 0));
|
||||
auto offset = mem->get_layout().get_linear_offset(tensor_addr);
|
||||
for (size_t xi = 0; xi < static_cast<size_t>(size.spatial[0]); ++xi) {
|
||||
for (size_t xi = 0; xi < static_cast<size_t>(l.spatial(0)); ++xi) {
|
||||
ptr[offset + xi] = data[bi][fi][xi][yi][zi];
|
||||
}
|
||||
}
|
||||
@@ -737,12 +737,12 @@ struct mvn_random_test_bsv32 : ::testing::TestWithParam<mvn_basic_test_params> {
|
||||
|
||||
template <typename T>
|
||||
void fill_random_data(cldnn::memory::ptr mem, int min, int max, int k = 8) {
|
||||
auto size = mem->get_layout().size;
|
||||
auto input_data = tests::generate_random_5d<T>(size.batch[0],
|
||||
size.feature[0],
|
||||
size.spatial[0],
|
||||
size.spatial[1],
|
||||
size.spatial[2],
|
||||
auto l = mem->get_layout();
|
||||
auto input_data = tests::generate_random_5d<T>(l.batch(),
|
||||
l.feature(),
|
||||
l.spatial(0),
|
||||
l.spatial(1),
|
||||
l.spatial(2),
|
||||
min,
|
||||
max,
|
||||
k);
|
||||
@@ -762,10 +762,10 @@ struct mvn_random_test_bsv32 : ::testing::TestWithParam<mvn_basic_test_params> {
|
||||
auto output_lay = out_ref->get_layout();
|
||||
auto opt_output_lay = out_opt->get_layout();
|
||||
|
||||
size_t b = output_lay.size.batch[0];
|
||||
size_t f = output_lay.size.feature[0];
|
||||
size_t x = output_lay.size.spatial[0];
|
||||
size_t y = output_lay.size.spatial[1];
|
||||
size_t b = output_lay.batch();
|
||||
size_t f = output_lay.feature();
|
||||
size_t x = output_lay.spatial(0);
|
||||
size_t y = output_lay.spatial(1);
|
||||
cldnn::mem_lock<T> ref_ptr(out_ref, get_test_stream());
|
||||
cldnn::mem_lock<T> opt_ptr(out_opt, get_test_stream());
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ TEST(permute_gpu_f32, output_ordering_test)
|
||||
for (auto const& fr : input_formats) {
|
||||
for (auto const& inp_t : input_tensors) {
|
||||
for (auto const& perm : permutations) {
|
||||
auto input = engine.allocate_memory({ data_types::f32, fr, tensor(inp_t) });
|
||||
auto input = engine.allocate_memory({ data_types::f32, fr, tensor(format::bfyx, inp_t) });
|
||||
topology topology(
|
||||
input_layout("input", input->get_layout()),
|
||||
permute("permute", "input", perm));
|
||||
@@ -63,12 +63,12 @@ TEST(permute_gpu_f32, output_ordering_test)
|
||||
auto output = outputs.at("permute");
|
||||
auto output_mem = output.get_memory();
|
||||
EXPECT_EQ(outputs.size(), size_t(1));
|
||||
auto ref_tensor = get_permutation(input->get_layout().get_dims(), perm);
|
||||
auto out_tensor = output_mem->get_layout().get_dims();
|
||||
EXPECT_EQ(out_tensor[0], ref_tensor[0]);
|
||||
EXPECT_EQ(out_tensor[1], ref_tensor[1]);
|
||||
EXPECT_EQ(out_tensor[2], ref_tensor[2]);
|
||||
EXPECT_EQ(out_tensor[3], ref_tensor[3]);
|
||||
auto ref_tensor = get_permutation(inp_t, perm);
|
||||
auto dims = output_mem->get_layout().get_dims();
|
||||
EXPECT_EQ(dims[0], ref_tensor[0]);
|
||||
EXPECT_EQ(dims[1], ref_tensor[1]);
|
||||
EXPECT_EQ(dims[2], ref_tensor[2]);
|
||||
EXPECT_EQ(dims[3], ref_tensor[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -345,11 +345,11 @@ TEST(permute_gpu_f32, basic_yxfb_permute_batch_with_feature)
|
||||
EXPECT_EQ(outputs.begin()->first, "permute");
|
||||
|
||||
auto output = outputs.begin()->second.get_memory();
|
||||
auto out_tensor = output->get_layout().size;
|
||||
EXPECT_EQ(out_tensor.batch[0], 2);
|
||||
EXPECT_EQ(out_tensor.feature[0], 8);
|
||||
EXPECT_EQ(out_tensor.spatial[0], 1);
|
||||
EXPECT_EQ(out_tensor.spatial[1], 1);
|
||||
auto l = output->get_layout();
|
||||
EXPECT_EQ(l.batch(), 2);
|
||||
EXPECT_EQ(l.feature(), 8);
|
||||
EXPECT_EQ(l.spatial(0), 1);
|
||||
EXPECT_EQ(l.spatial(1), 1);
|
||||
|
||||
float answers[16] = {
|
||||
1.0f, 3.0f,
|
||||
@@ -400,11 +400,11 @@ TEST(permute_gpu_f32, basic_bfyx_permute_batch_with_feature)
|
||||
EXPECT_EQ(outputs.begin()->first, "permute");
|
||||
|
||||
auto output = outputs.begin()->second.get_memory();
|
||||
auto out_tensor = output->get_layout().size;
|
||||
EXPECT_EQ(out_tensor.batch[0], 8);
|
||||
EXPECT_EQ(out_tensor.feature[0], 2);
|
||||
EXPECT_EQ(out_tensor.spatial[0], 1);
|
||||
EXPECT_EQ(out_tensor.spatial[1], 1);
|
||||
auto l = output->get_layout();
|
||||
EXPECT_EQ(l.batch(), 8);
|
||||
EXPECT_EQ(l.feature(), 2);
|
||||
EXPECT_EQ(l.spatial(0), 1);
|
||||
EXPECT_EQ(l.spatial(1), 1);
|
||||
|
||||
float answers[16] = {
|
||||
1.0f, 3.0f,
|
||||
@@ -609,11 +609,11 @@ TEST(fc_permute_crop_gpu, basic_permute_yxfb)
|
||||
EXPECT_EQ(outputs.begin()->first, "permute");
|
||||
|
||||
auto output = outputs.begin()->second.get_memory();
|
||||
auto out_tensor = output->get_layout().size;
|
||||
EXPECT_EQ(out_tensor.batch[0], 5);
|
||||
EXPECT_EQ(out_tensor.feature[0], 1);
|
||||
EXPECT_EQ(out_tensor.spatial[0], 1);
|
||||
EXPECT_EQ(out_tensor.spatial[1], 512);
|
||||
auto l = output->get_layout();
|
||||
EXPECT_EQ(l.batch(), 5);
|
||||
EXPECT_EQ(l.feature(), 1);
|
||||
EXPECT_EQ(l.spatial(0), 1);
|
||||
EXPECT_EQ(l.spatial(1), 512);
|
||||
EXPECT_EQ(output->get_layout().format, cldnn::format::yxfb);
|
||||
}
|
||||
|
||||
@@ -644,11 +644,11 @@ TEST(fc_permute_crop_gpu, basic_0)
|
||||
EXPECT_EQ(outputs.begin()->first, "crop");
|
||||
|
||||
auto output = outputs.begin()->second.get_memory();
|
||||
auto out_tensor = output->get_layout().size;
|
||||
EXPECT_EQ(out_tensor.batch[0], 1);
|
||||
EXPECT_EQ(out_tensor.feature[0], 1);
|
||||
EXPECT_EQ(out_tensor.spatial[0], 1);
|
||||
EXPECT_EQ(out_tensor.spatial[1], 512);
|
||||
auto l = output->get_layout();
|
||||
EXPECT_EQ(l.batch(), 1);
|
||||
EXPECT_EQ(l.feature(), 1);
|
||||
EXPECT_EQ(l.spatial(0), 1);
|
||||
EXPECT_EQ(l.spatial(1), 512);
|
||||
EXPECT_EQ(output->get_layout().format, cldnn::format::yxfb);
|
||||
}
|
||||
|
||||
@@ -674,11 +674,11 @@ TEST(fc_permute_gpu, basic_permute_bfyx)
|
||||
EXPECT_EQ(outputs.begin()->first, "permute");
|
||||
|
||||
auto output = outputs.begin()->second.get_memory();
|
||||
auto out_tensor = output->get_layout().size;
|
||||
EXPECT_EQ(out_tensor.batch[0], 5);
|
||||
EXPECT_EQ(out_tensor.feature[0], 1);
|
||||
EXPECT_EQ(out_tensor.spatial[0], 1);
|
||||
EXPECT_EQ(out_tensor.spatial[1], 256);
|
||||
auto l = output->get_layout();
|
||||
EXPECT_EQ(l.batch(), 5);
|
||||
EXPECT_EQ(l.feature(), 1);
|
||||
EXPECT_EQ(l.spatial(0), 1);
|
||||
EXPECT_EQ(l.spatial(1), 256);
|
||||
EXPECT_EQ(output->get_layout().format, cldnn::format::bfyx);
|
||||
|
||||
cldnn::mem_lock<float> input_ptr(input_mem, get_test_stream());
|
||||
@@ -734,13 +734,13 @@ TEST(permute_gpu_f32, permute_bfwzyx)
|
||||
EXPECT_EQ(outputs.begin()->first, "permute");
|
||||
|
||||
auto output = outputs.begin()->second.get_memory();
|
||||
auto out_tensor = output->get_layout().size;
|
||||
EXPECT_EQ(out_tensor.batch[0], 2);
|
||||
EXPECT_EQ(out_tensor.feature[0], 1);
|
||||
EXPECT_EQ(out_tensor.spatial[0], 6);
|
||||
EXPECT_EQ(out_tensor.spatial[1], 5);
|
||||
EXPECT_EQ(out_tensor.spatial[2], 4);
|
||||
EXPECT_EQ(out_tensor.spatial[3], 3);
|
||||
auto l = output->get_layout();
|
||||
EXPECT_EQ(l.batch(), 2);
|
||||
EXPECT_EQ(l.feature(), 1);
|
||||
EXPECT_EQ(l.spatial(0), 6);
|
||||
EXPECT_EQ(l.spatial(1), 5);
|
||||
EXPECT_EQ(l.spatial(2), 4);
|
||||
EXPECT_EQ(l.spatial(3), 3);
|
||||
EXPECT_EQ(output->get_layout().format, cldnn::format::bfwzyx);
|
||||
|
||||
cldnn::mem_lock<float> output_ptr(output, get_test_stream());
|
||||
@@ -877,12 +877,12 @@ TEST(permute_gpu_f32, basic_bfzyx_permute_0_4_1_2_3)
|
||||
EXPECT_EQ(outputs.begin()->first, "permute");
|
||||
|
||||
auto output = outputs.begin()->second.get_memory();
|
||||
auto out_tensor = output->get_layout().size;
|
||||
EXPECT_EQ(out_tensor.batch[0], 2);
|
||||
EXPECT_EQ(out_tensor.feature[0], 3);
|
||||
EXPECT_EQ(out_tensor.spatial[0], 2);
|
||||
EXPECT_EQ(out_tensor.spatial[1], 2);
|
||||
EXPECT_EQ(out_tensor.spatial[2], 2);
|
||||
auto l = output->get_layout();
|
||||
EXPECT_EQ(l.batch(), 2);
|
||||
EXPECT_EQ(l.feature(), 3);
|
||||
EXPECT_EQ(l.spatial(0), 2);
|
||||
EXPECT_EQ(l.spatial(1), 2);
|
||||
EXPECT_EQ(l.spatial(2), 2);
|
||||
|
||||
EXPECT_EQ(output->get_layout().format, cldnn::format::bfzyx);
|
||||
|
||||
|
||||
@@ -600,11 +600,11 @@ struct quantize_random_test : testing::TestWithParam<quantize_random_test_params
|
||||
{
|
||||
template <typename T>
|
||||
void fill_typed(memory::ptr src, memory::ptr dst) {
|
||||
auto size = dst->get_layout().size;
|
||||
size_t b = size.batch[0];
|
||||
size_t f = size.feature[0];
|
||||
size_t x = size.spatial[0];
|
||||
size_t y = size.spatial[1];
|
||||
auto l = dst->get_layout();
|
||||
size_t b = l.batch();
|
||||
size_t f = l.feature();
|
||||
size_t x = l.spatial(0);
|
||||
size_t y = l.spatial(1);
|
||||
|
||||
mem_lock<T> data{src, get_test_stream()};
|
||||
mem_lock<T> ptr{dst, get_test_stream()};
|
||||
@@ -624,11 +624,11 @@ struct quantize_random_test : testing::TestWithParam<quantize_random_test_params
|
||||
|
||||
template <typename T>
|
||||
void fill_random_typed(memory::ptr mem, int min, int max, int k) {
|
||||
auto size = mem->get_layout().size;
|
||||
size_t b = size.batch[0];
|
||||
size_t f = size.feature[0];
|
||||
size_t x = size.spatial[0];
|
||||
size_t y = size.spatial[1];
|
||||
auto l = mem->get_layout();
|
||||
size_t b = l.batch();
|
||||
size_t f = l.feature();
|
||||
size_t x = l.spatial(0);
|
||||
size_t y = l.spatial(1);
|
||||
|
||||
auto data = generate_random_4d<T>(b, f, y, x, min, max, k);
|
||||
mem_lock<T> ptr{mem, get_test_stream()};
|
||||
@@ -670,10 +670,10 @@ struct quantize_random_test : testing::TestWithParam<quantize_random_test_params
|
||||
auto output_lay = out_ref->get_layout();
|
||||
auto opt_output_lay = out_opt->get_layout();
|
||||
|
||||
size_t b = output_lay.size.batch[0];
|
||||
size_t f = output_lay.size.feature[0];
|
||||
size_t x = output_lay.size.spatial[0];
|
||||
size_t y = output_lay.size.spatial[1];
|
||||
size_t b = output_lay.batch();
|
||||
size_t f = output_lay.feature();
|
||||
size_t x = output_lay.spatial(0);
|
||||
size_t y = output_lay.spatial(1);
|
||||
mem_lock<T> ref_ptr{out_ref, get_test_stream()};
|
||||
mem_lock<T> opt_ptr{out_opt, get_test_stream()};
|
||||
for (size_t bi = 0; bi < b; ++bi) {
|
||||
|
||||
@@ -519,10 +519,10 @@ public:
|
||||
|
||||
ASSERT_EQ(out_lay.size.sizes()[0], reference_result.size()); // b
|
||||
ASSERT_EQ(out_lay.size.sizes()[1], reference_result[0].size()); // f
|
||||
ASSERT_EQ(out_lay.size.spatial[3], reference_result[0][0].size()); // w
|
||||
ASSERT_EQ(out_lay.size.spatial[2], reference_result[0][0][0].size()); // z
|
||||
ASSERT_EQ(out_lay.size.spatial[1], reference_result[0][0][0][0].size()); // y
|
||||
ASSERT_EQ(out_lay.size.spatial[0], reference_result[0][0][0][0][0].size()); // x
|
||||
ASSERT_EQ(out_lay.spatial(3), reference_result[0][0].size()); // w
|
||||
ASSERT_EQ(out_lay.spatial(2), reference_result[0][0][0].size()); // z
|
||||
ASSERT_EQ(out_lay.spatial(1), reference_result[0][0][0][0].size()); // y
|
||||
ASSERT_EQ(out_lay.spatial(0), reference_result[0][0][0][0][0].size()); // x
|
||||
|
||||
for (size_t bi = 0; bi < reference_result.size(); bi++)
|
||||
for (size_t fi = 0; fi < reference_result[0].size(); fi++)
|
||||
@@ -1733,10 +1733,10 @@ public:
|
||||
|
||||
ASSERT_EQ(out_lay.size.sizes()[0], reference_result.size()); // b
|
||||
ASSERT_EQ(out_lay.size.sizes()[1], reference_result[0].size()); // f
|
||||
ASSERT_EQ(out_lay.size.spatial[3], reference_result[0][0].size()); // w
|
||||
ASSERT_EQ(out_lay.size.spatial[2], reference_result[0][0][0].size()); // z
|
||||
ASSERT_EQ(out_lay.size.spatial[1], reference_result[0][0][0][0].size()); // y
|
||||
ASSERT_EQ(out_lay.size.spatial[0], reference_result[0][0][0][0][0].size()); // x
|
||||
ASSERT_EQ(out_lay.spatial(3), reference_result[0][0].size()); // w
|
||||
ASSERT_EQ(out_lay.spatial(2), reference_result[0][0][0].size()); // z
|
||||
ASSERT_EQ(out_lay.spatial(1), reference_result[0][0][0][0].size()); // y
|
||||
ASSERT_EQ(out_lay.spatial(0), reference_result[0][0][0][0][0].size()); // x
|
||||
|
||||
bool need_adjust_threshold = (typeid(output_t) == typeid(output_data_type<data_types::i8>::type));
|
||||
for (size_t bi = 0; bi < reference_result.size(); bi++)
|
||||
|
||||
@@ -523,11 +523,11 @@ struct resample_random_test_params {
|
||||
struct resample_random_test : testing::TestWithParam<resample_random_test_params>{
|
||||
template <typename T>
|
||||
void fill_random_typed(memory::ptr mem, int min, int max, int k) {
|
||||
auto size = mem->get_layout().size;
|
||||
size_t b = size.batch[0];
|
||||
size_t f = size.feature[0];
|
||||
size_t x = size.spatial[0];
|
||||
size_t y = size.spatial[1];
|
||||
auto l = mem->get_layout();
|
||||
size_t b = l.batch();
|
||||
size_t f = l.feature();
|
||||
size_t x = l.spatial(0);
|
||||
size_t y = l.spatial(1);
|
||||
|
||||
auto data = generate_random_4d<T>(b, f, y, x, min, max, k);
|
||||
cldnn::mem_lock<T> ptr(mem, get_test_stream());
|
||||
@@ -567,12 +567,12 @@ struct resample_random_test : testing::TestWithParam<resample_random_test_params
|
||||
template <typename T>
|
||||
void compare_nearest_typed(const memory::ptr input, const memory::ptr output, uint32_t align_corners) {
|
||||
auto output_lay = output->get_layout();
|
||||
size_t b = output_lay.size.batch[0];
|
||||
size_t f = output_lay.size.feature[0];
|
||||
size_t x = output_lay.size.spatial[0];
|
||||
size_t y = output_lay.size.spatial[1];
|
||||
size_t in_x = input->get_layout().size.spatial[0];
|
||||
size_t in_y = input->get_layout().size.spatial[1];
|
||||
size_t b = output_lay.batch();
|
||||
size_t f = output_lay.feature();
|
||||
size_t x = output_lay.spatial(0);
|
||||
size_t y = output_lay.spatial(1);
|
||||
size_t in_x = input->get_layout().spatial(0);
|
||||
size_t in_y = input->get_layout().spatial(1);
|
||||
float x_ratio = x > align_corners ? static_cast<float>(in_x - align_corners) / static_cast<float>(x - align_corners) : 0.f;
|
||||
float y_ratio = y > align_corners ? static_cast<float>(in_y - align_corners) / static_cast<float>(y - align_corners) : 0.f;
|
||||
|
||||
@@ -600,13 +600,13 @@ struct resample_random_test : testing::TestWithParam<resample_random_test_params
|
||||
template <typename InT, typename OutT>
|
||||
void compare_bilinear_typed(const memory::ptr input, const memory::ptr output, uint32_t align_corners) {
|
||||
auto output_lay = output->get_layout();
|
||||
size_t b = output_lay.size.batch[0];
|
||||
size_t f = output_lay.size.feature[0];
|
||||
size_t x = output_lay.size.spatial[0];
|
||||
size_t y = output_lay.size.spatial[1];
|
||||
size_t b = output_lay.batch();
|
||||
size_t f = output_lay.feature();
|
||||
size_t x = output_lay.spatial(0);
|
||||
size_t y = output_lay.spatial(1);
|
||||
auto input_lay = input->get_layout();
|
||||
size_t in_x = input_lay.size.spatial[0];
|
||||
size_t in_y = input_lay.size.spatial[1];
|
||||
size_t in_x = input_lay.spatial(0);
|
||||
size_t in_y = input_lay.spatial(1);
|
||||
float x_ratio = x > align_corners ? static_cast<float>(in_x - align_corners) / static_cast<float>(x - align_corners) : 0.f;
|
||||
float y_ratio = y > align_corners ? static_cast<float>(in_y - align_corners) / static_cast<float>(y - align_corners) : 0.f;
|
||||
|
||||
@@ -781,11 +781,11 @@ struct caffe_resample_random_test : testing::TestWithParam<caffe_resample_random
|
||||
{
|
||||
template <typename T>
|
||||
void fill_random_typed(memory::ptr mem, int min, int max, int k) {
|
||||
auto size = mem->get_layout().size;
|
||||
size_t b = size.batch[0];
|
||||
size_t f = size.feature[0];
|
||||
size_t x = size.spatial[0];
|
||||
size_t y = size.spatial[1];
|
||||
auto l = mem->get_layout();
|
||||
size_t b = l.batch();
|
||||
size_t f = l.feature();
|
||||
size_t x = l.spatial(0);
|
||||
size_t y = l.spatial(1);
|
||||
|
||||
auto data = generate_random_4d<T>(b, f, y, x, min, max, k);
|
||||
cldnn::mem_lock<T> ptr(mem, get_test_stream());
|
||||
@@ -827,10 +827,10 @@ struct caffe_resample_random_test : testing::TestWithParam<caffe_resample_random
|
||||
auto output_lay = out_ref->get_layout();
|
||||
auto opt_output_lay = out_opt->get_layout();
|
||||
|
||||
size_t b = output_lay.size.batch[0];
|
||||
size_t f = output_lay.size.feature[0];
|
||||
size_t x = output_lay.size.spatial[0];
|
||||
size_t y = output_lay.size.spatial[1];
|
||||
size_t b = output_lay.batch();
|
||||
size_t f = output_lay.feature();
|
||||
size_t x = output_lay.spatial(0);
|
||||
size_t y = output_lay.spatial(1);
|
||||
cldnn::mem_lock<T> ref_ptr(out_ref, get_test_stream());
|
||||
cldnn::mem_lock<T> opt_ptr(out_opt, get_test_stream());
|
||||
for (size_t bi = 0; bi < b; ++bi) {
|
||||
@@ -2057,11 +2057,11 @@ struct resample_opt_random_test : testing::TestWithParam<resample_opt_random_tes
|
||||
|
||||
template <typename T>
|
||||
void fill_random_typed(memory::ptr mem, int min, int max, int k) {
|
||||
auto size = mem->get_layout().size;
|
||||
size_t b = size.batch[0];
|
||||
size_t f = size.feature[0];
|
||||
size_t x = size.spatial[0];
|
||||
size_t y = size.spatial[1];
|
||||
auto l = mem->get_layout();
|
||||
size_t b = l.batch();
|
||||
size_t f = l.feature();
|
||||
size_t x = l.spatial(0);
|
||||
size_t y = l.spatial(1);
|
||||
|
||||
auto data = generate_random_4d<T>(b, f, y, x, min, max, k);
|
||||
mem_lock<T> ptr{mem, get_test_stream()};
|
||||
@@ -2103,10 +2103,10 @@ struct resample_opt_random_test : testing::TestWithParam<resample_opt_random_tes
|
||||
auto output_lay = out_ref->get_layout();
|
||||
auto opt_output_lay = out_opt->get_layout();
|
||||
|
||||
size_t b = output_lay.size.batch[0];
|
||||
size_t f = output_lay.size.feature[0];
|
||||
size_t x = output_lay.size.spatial[0];
|
||||
size_t y = output_lay.size.spatial[1];
|
||||
size_t b = output_lay.batch();
|
||||
size_t f = output_lay.feature();
|
||||
size_t x = output_lay.spatial(0);
|
||||
size_t y = output_lay.spatial(1);
|
||||
mem_lock<T> ref_ptr{out_ref, get_test_stream()};
|
||||
mem_lock<T> opt_ptr{out_opt, get_test_stream()};
|
||||
for (size_t bi = 0; bi < b; ++bi) {
|
||||
|
||||
@@ -48,10 +48,10 @@ TEST(spatial_concatenate_f32_gpu, test01) {
|
||||
auto output_mem = outputs.at("conc").get_memory();
|
||||
auto output_layout = output_mem->get_layout();
|
||||
|
||||
ASSERT_EQ(output_layout.size.batch[0], input1->get_layout().size.batch[0]);
|
||||
ASSERT_EQ(output_layout.size.feature[0], input1->get_layout().size.feature[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[1], input1->get_layout().size.spatial[1]);
|
||||
ASSERT_EQ(output_layout.size.spatial[0], input1->get_layout().size.spatial[0] + input2->get_layout().size.spatial[0]);
|
||||
ASSERT_EQ(output_layout.batch(), input1->get_layout().batch());
|
||||
ASSERT_EQ(output_layout.feature(), input1->get_layout().feature());
|
||||
ASSERT_EQ(output_layout.spatial(1), input1->get_layout().spatial(1));
|
||||
ASSERT_EQ(output_layout.spatial(0), input1->get_layout().spatial(0) + input2->get_layout().spatial(0));
|
||||
|
||||
ASSERT_EQ(output_mem->get_layout().get_linear_size(), expected_output.size());
|
||||
{
|
||||
@@ -103,10 +103,10 @@ TEST(spatial_concatenate_f32_gpu, test02) {
|
||||
auto output_mem = outputs.at("conc").get_memory();
|
||||
auto output_layout = output_mem->get_layout();
|
||||
|
||||
ASSERT_EQ(output_layout.size.batch[0], input1->get_layout().size.batch[0]);
|
||||
ASSERT_EQ(output_layout.size.feature[0], input1->get_layout().size.feature[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[0], input1->get_layout().size.spatial[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[1], input1->get_layout().size.spatial[1] + input2->get_layout().size.spatial[1]);
|
||||
ASSERT_EQ(output_layout.batch(), input1->get_layout().batch());
|
||||
ASSERT_EQ(output_layout.feature(), input1->get_layout().feature());
|
||||
ASSERT_EQ(output_layout.spatial(0), input1->get_layout().spatial(0));
|
||||
ASSERT_EQ(output_layout.spatial(1), input1->get_layout().spatial(1) + input2->get_layout().spatial(1));
|
||||
|
||||
ASSERT_EQ(output_mem->get_layout().get_linear_size(), expected_output.size());
|
||||
{
|
||||
@@ -160,10 +160,10 @@ TEST(spatial_concatenate_f32_gpu, test03) {
|
||||
auto output_mem = outputs.at("conc").get_memory();
|
||||
auto output_layout = output_mem->get_layout();
|
||||
|
||||
ASSERT_EQ(output_layout.size.batch[0], input1->get_layout().size.batch[0]);
|
||||
ASSERT_EQ(output_layout.size.feature[0], input1->get_layout().size.feature[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[0], input1->get_layout().size.spatial[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[1], input1->get_layout().size.spatial[1] + input2->get_layout().size.spatial[1]);
|
||||
ASSERT_EQ(output_layout.batch(), input1->get_layout().batch());
|
||||
ASSERT_EQ(output_layout.feature(), input1->get_layout().feature());
|
||||
ASSERT_EQ(output_layout.spatial(0), input1->get_layout().spatial(0));
|
||||
ASSERT_EQ(output_layout.spatial(1), input1->get_layout().spatial(1) + input2->get_layout().spatial(1));
|
||||
|
||||
ASSERT_EQ(output_mem->get_layout().get_linear_size(), expected_output.size());
|
||||
{
|
||||
@@ -215,10 +215,10 @@ TEST(spatial_concatenate_f32_gpu, test04) {
|
||||
auto output_mem = outputs.at("conc").get_memory();
|
||||
auto output_layout = output_mem->get_layout();
|
||||
|
||||
ASSERT_EQ(output_layout.size.batch[0], input1->get_layout().size.batch[0]);
|
||||
ASSERT_EQ(output_layout.size.feature[0], input1->get_layout().size.feature[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[1], input1->get_layout().size.spatial[1]);
|
||||
ASSERT_EQ(output_layout.size.spatial[0], input1->get_layout().size.spatial[0] + input2->get_layout().size.spatial[0]);
|
||||
ASSERT_EQ(output_layout.batch(), input1->get_layout().batch());
|
||||
ASSERT_EQ(output_layout.feature(), input1->get_layout().feature());
|
||||
ASSERT_EQ(output_layout.spatial(1), input1->get_layout().spatial(1));
|
||||
ASSERT_EQ(output_layout.spatial(0), input1->get_layout().spatial(0) + input2->get_layout().spatial(0));
|
||||
|
||||
ASSERT_EQ(output_mem->get_layout().get_linear_size(), expected_output.size());
|
||||
{
|
||||
@@ -276,10 +276,10 @@ TEST(spatial_concatenate_f32_gpu, inputs_3) {
|
||||
auto output_mem = outputs.at("conc").get_memory();
|
||||
auto output_layout = output_mem->get_layout();
|
||||
|
||||
ASSERT_EQ(output_layout.size.batch[0], input1->get_layout().size.batch[0]);
|
||||
ASSERT_EQ(output_layout.size.feature[0], input1->get_layout().size.feature[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[1], input1->get_layout().size.spatial[1]);
|
||||
ASSERT_EQ(output_layout.size.spatial[0], input1->get_layout().size.spatial[0] + input2->get_layout().size.spatial[0] + input3->get_layout().size.spatial[0]);
|
||||
ASSERT_EQ(output_layout.batch(), input1->get_layout().batch());
|
||||
ASSERT_EQ(output_layout.feature(), input1->get_layout().feature());
|
||||
ASSERT_EQ(output_layout.spatial(1), input1->get_layout().spatial(1));
|
||||
ASSERT_EQ(output_layout.spatial(0), input1->get_layout().spatial(0) + input2->get_layout().spatial(0) + input3->get_layout().spatial(0));
|
||||
|
||||
ASSERT_EQ(output_mem->get_layout().get_linear_size(), expected_output.size());
|
||||
{
|
||||
@@ -364,10 +364,10 @@ TEST(spatial_concatenate_f32_gpu, inputs_3_uneven_axis_b) {
|
||||
auto output_mem = outputs.at("conc").get_memory();
|
||||
auto output_layout = output_mem->get_layout();
|
||||
|
||||
ASSERT_EQ(output_layout.size.batch[0], input1->get_layout().size.batch[0] + input2->get_layout().size.batch[0] + input3->get_layout().size.batch[0]);
|
||||
ASSERT_EQ(output_layout.size.feature[0], input1->get_layout().size.feature[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[1], input1->get_layout().size.spatial[1]);
|
||||
ASSERT_EQ(output_layout.size.spatial[0], input1->get_layout().size.spatial[0]);
|
||||
ASSERT_EQ(output_layout.batch(), input1->get_layout().batch() + input2->get_layout().batch() + input3->get_layout().batch());
|
||||
ASSERT_EQ(output_layout.feature(), input1->get_layout().feature());
|
||||
ASSERT_EQ(output_layout.spatial(1), input1->get_layout().spatial(1));
|
||||
ASSERT_EQ(output_layout.spatial(0), input1->get_layout().spatial(0));
|
||||
|
||||
ASSERT_EQ(output_mem->get_layout().get_linear_size(), expected_output.size());
|
||||
{
|
||||
@@ -423,11 +423,11 @@ TEST(spatial_concatenate_f32_gpu, inputs3d_axis_x) {
|
||||
auto output_mem = outputs.at("conc").get_memory();
|
||||
auto output_layout = output_mem->get_layout();
|
||||
|
||||
ASSERT_EQ(output_layout.size.batch[0], input1->get_layout().size.batch[0]);
|
||||
ASSERT_EQ(output_layout.size.feature[0], input1->get_layout().size.feature[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[0], input1->get_layout().size.spatial[0] + input2->get_layout().size.spatial[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[1], input1->get_layout().size.spatial[1]);
|
||||
ASSERT_EQ(output_layout.size.spatial[2], input1->get_layout().size.spatial[2]);
|
||||
ASSERT_EQ(output_layout.batch(), input1->get_layout().batch());
|
||||
ASSERT_EQ(output_layout.feature(), input1->get_layout().feature());
|
||||
ASSERT_EQ(output_layout.spatial(0), input1->get_layout().spatial(0) + input2->get_layout().spatial(0));
|
||||
ASSERT_EQ(output_layout.spatial(1), input1->get_layout().spatial(1));
|
||||
ASSERT_EQ(output_layout.spatial(2), input1->get_layout().spatial(2));
|
||||
|
||||
ASSERT_EQ(output_mem->get_layout().get_linear_size(), expected_output.size());
|
||||
{
|
||||
@@ -487,11 +487,11 @@ TEST(spatial_concatenate_f32_gpu, inputs3d_axis_y) {
|
||||
auto output_mem = outputs.at("conc").get_memory();
|
||||
auto output_layout = output_mem->get_layout();
|
||||
|
||||
ASSERT_EQ(output_layout.size.batch[0], input1->get_layout().size.batch[0]);
|
||||
ASSERT_EQ(output_layout.size.feature[0], input1->get_layout().size.feature[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[0], input1->get_layout().size.spatial[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[1], input1->get_layout().size.spatial[1] + input2->get_layout().size.spatial[1]);
|
||||
ASSERT_EQ(output_layout.size.spatial[2], input1->get_layout().size.spatial[2]);
|
||||
ASSERT_EQ(output_layout.batch(), input1->get_layout().batch());
|
||||
ASSERT_EQ(output_layout.feature(), input1->get_layout().feature());
|
||||
ASSERT_EQ(output_layout.spatial(0), input1->get_layout().spatial(0));
|
||||
ASSERT_EQ(output_layout.spatial(1), input1->get_layout().spatial(1) + input2->get_layout().spatial(1));
|
||||
ASSERT_EQ(output_layout.spatial(2), input1->get_layout().spatial(2));
|
||||
|
||||
ASSERT_EQ(output_mem->get_layout().get_linear_size(), expected_output.size());
|
||||
{
|
||||
@@ -551,11 +551,11 @@ TEST(spatial_concatenate_f32_gpu, inputs3d_axis_z) {
|
||||
auto output_mem = outputs.at("conc").get_memory();
|
||||
auto output_layout = output_mem->get_layout();
|
||||
|
||||
ASSERT_EQ(output_layout.size.batch[0], input1->get_layout().size.batch[0]);
|
||||
ASSERT_EQ(output_layout.size.feature[0], input1->get_layout().size.feature[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[0], input1->get_layout().size.spatial[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[1], input1->get_layout().size.spatial[1]);
|
||||
ASSERT_EQ(output_layout.size.spatial[2], input1->get_layout().size.spatial[2] + input2->get_layout().size.spatial[2]);
|
||||
ASSERT_EQ(output_layout.batch(), input1->get_layout().batch());
|
||||
ASSERT_EQ(output_layout.feature(), input1->get_layout().feature());
|
||||
ASSERT_EQ(output_layout.spatial(0), input1->get_layout().spatial(0));
|
||||
ASSERT_EQ(output_layout.spatial(1), input1->get_layout().spatial(1));
|
||||
ASSERT_EQ(output_layout.spatial(2), input1->get_layout().spatial(2) + input2->get_layout().spatial(2));
|
||||
|
||||
ASSERT_EQ(output_mem->get_layout().get_linear_size(), expected_output.size());
|
||||
{
|
||||
@@ -626,11 +626,11 @@ TEST(spatial_concatenate_f32_gpu, inputs3d_axis_b) {
|
||||
auto output_mem = outputs.at("conc").get_memory();
|
||||
auto output_layout = output_mem->get_layout();
|
||||
|
||||
ASSERT_EQ(output_layout.size.batch[0], input1->get_layout().size.batch[0] + input2->get_layout().size.batch[0]);
|
||||
ASSERT_EQ(output_layout.size.feature[0], input1->get_layout().size.feature[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[0], input1->get_layout().size.spatial[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[1], input1->get_layout().size.spatial[1]);
|
||||
ASSERT_EQ(output_layout.size.spatial[2], input1->get_layout().size.spatial[2]);
|
||||
ASSERT_EQ(output_layout.batch(), input1->get_layout().batch() + input2->get_layout().batch());
|
||||
ASSERT_EQ(output_layout.feature(), input1->get_layout().feature());
|
||||
ASSERT_EQ(output_layout.spatial(0), input1->get_layout().spatial(0));
|
||||
ASSERT_EQ(output_layout.spatial(1), input1->get_layout().spatial(1));
|
||||
ASSERT_EQ(output_layout.spatial(2), input1->get_layout().spatial(2));
|
||||
|
||||
ASSERT_EQ(output_mem->get_layout().get_linear_size(), expected_output.size());
|
||||
{
|
||||
@@ -757,11 +757,11 @@ TEST(spatial_concatenate_f32_gpu, inputs3d_3_uneven_axis_b) {
|
||||
auto output_mem = outputs.at("conc").get_memory();
|
||||
auto output_layout = output_mem->get_layout();
|
||||
|
||||
ASSERT_EQ(output_layout.size.batch[0], input1->get_layout().size.batch[0] + input2->get_layout().size.batch[0] + input3->get_layout().size.batch[0]);
|
||||
ASSERT_EQ(output_layout.size.feature[0], input1->get_layout().size.feature[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[0], input1->get_layout().size.spatial[0]);
|
||||
ASSERT_EQ(output_layout.size.spatial[1], input1->get_layout().size.spatial[1]);
|
||||
ASSERT_EQ(output_layout.size.spatial[2], input1->get_layout().size.spatial[2]);
|
||||
ASSERT_EQ(output_layout.batch(), input1->get_layout().batch() + input2->get_layout().batch() + input3->get_layout().batch());
|
||||
ASSERT_EQ(output_layout.feature(), input1->get_layout().feature());
|
||||
ASSERT_EQ(output_layout.spatial(0), input1->get_layout().spatial(0));
|
||||
ASSERT_EQ(output_layout.spatial(1), input1->get_layout().spatial(1));
|
||||
ASSERT_EQ(output_layout.spatial(2), input1->get_layout().spatial(2));
|
||||
|
||||
ASSERT_EQ(output_mem->get_layout().get_linear_size(), expected_output.size());
|
||||
{
|
||||
|
||||
@@ -116,10 +116,10 @@ void split_test(int batch_num, int feature_num, int x_size, int y_size, std::vec
|
||||
cldnn::mem_lock<T> output_ptr(output, get_test_stream());
|
||||
|
||||
// Output tensor size
|
||||
auto output_batch = prim.size.batch[0];
|
||||
auto output_feature = prim.size.feature[0];
|
||||
auto output_x = prim.size.spatial[0];
|
||||
auto output_y = prim.size.spatial[1];
|
||||
auto output_batch = prim.batch();
|
||||
auto output_feature = prim.feature();
|
||||
auto output_x = prim.spatial(0);
|
||||
auto output_y = prim.spatial(1);
|
||||
|
||||
// Input offsets, starting from which we will compare the output
|
||||
auto input_batch_offset = split_offsets[splitNum].batch[0];
|
||||
|
||||
@@ -17,15 +17,15 @@ using namespace ::tests;
|
||||
template<typename data_t>
|
||||
void tile_ref(const memory::ptr input, memory::ptr output, tile::tile_axis axis, int num_tiles)
|
||||
{
|
||||
auto get_sizes = [](const tensor& size, tile::tile_axis axis) -> std::pair<int, int>
|
||||
auto get_sizes = [](const layout& l, tile::tile_axis axis) -> std::pair<int, int>
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case tile::along_b: return std::make_pair(1, size.batch[0]*size.feature[0]*size.spatial[2]*size.spatial[1]*size.spatial[0]);
|
||||
case tile::along_f: return std::make_pair(size.batch[0], size.feature[0]*size.spatial[2]*size.spatial[1]*size.spatial[0]);
|
||||
case tile::along_z: return std::make_pair(size.batch[0]*size.feature[0], size.spatial[2]*size.spatial[1]*size.spatial[0]);
|
||||
case tile::along_y: return std::make_pair(size.batch[0]*size.feature[0]*size.spatial[2], size.spatial[1]*size.spatial[0]);
|
||||
case tile::along_x: return std::make_pair(size.batch[0]*size.feature[0]*size.spatial[2]*size.spatial[1], size.spatial[0]);
|
||||
case tile::along_b: return std::make_pair(1, l.batch()*l.feature()*l.spatial(2)*l.spatial(1)*l.spatial(0));
|
||||
case tile::along_f: return std::make_pair(l.batch(), l.feature()*l.spatial(2)*l.spatial(1)*l.spatial(0));
|
||||
case tile::along_z: return std::make_pair(l.batch()*l.feature(), l.spatial(2)*l.spatial(1)*l.spatial(0));
|
||||
case tile::along_y: return std::make_pair(l.batch()*l.feature()*l.spatial(2), l.spatial(1)*l.spatial(0));
|
||||
case tile::along_x: return std::make_pair(l.batch()*l.feature()*l.spatial(2)*l.spatial(1), l.spatial(0));
|
||||
default: throw std::invalid_argument("Invalid axis(" + std::to_string(static_cast<int>(axis)) + ") in tile ref version");
|
||||
}
|
||||
};
|
||||
@@ -36,7 +36,7 @@ void tile_ref(const memory::ptr input, memory::ptr output, tile::tile_axis axis,
|
||||
const data_t* psrc = src.data();
|
||||
data_t* pdst = dst.data();
|
||||
|
||||
auto sizes = get_sizes(input->get_layout().size, axis);
|
||||
auto sizes = get_sizes(input->get_layout(), axis);
|
||||
int outer_dim = sizes.first;
|
||||
int inner_dim = sizes.second;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ void generic_test::run_single_test() {
|
||||
tests::set_random_values<FLOAT16>(input_mems[i], true, 5, 10);
|
||||
}
|
||||
} else {
|
||||
size_t size = generic_params->input_layouts[i].size.batch[0] * generic_params->input_layouts[i].size.feature[0];
|
||||
size_t size = generic_params->input_layouts[i].batch() * generic_params->input_layouts[i].feature();
|
||||
|
||||
if (generic_params->data_type == data_types::f32) {
|
||||
std::vector<float> values;
|
||||
@@ -119,12 +119,10 @@ void generic_test::compare_buffers(const memory::ptr out, const memory::ptr ref)
|
||||
EXPECT_EQ(out_layout.get_linear_size(), ref_layout.get_linear_size());
|
||||
EXPECT_EQ(out_layout.data_padding, ref_layout.data_padding);
|
||||
|
||||
auto output_size = out_layout.size;
|
||||
|
||||
int batch_size = output_size.batch[0];
|
||||
int feature_size = output_size.feature[0];
|
||||
int y_size = output_size.spatial[1];
|
||||
int x_size = output_size.spatial[0];
|
||||
int batch_size = out_layout.batch();
|
||||
int feature_size = out_layout.feature();
|
||||
int y_size = out_layout.spatial(1);
|
||||
int x_size = out_layout.spatial(0);
|
||||
|
||||
mem_lock<Type> res_data(out, get_test_stream());
|
||||
mem_lock<Type> ref_data(ref, get_test_stream());
|
||||
@@ -244,10 +242,10 @@ size_t generic_test::get_linear_index_with_broadcast(const layout& in_layout, si
|
||||
{
|
||||
return
|
||||
desc.offset +
|
||||
(b % in_layout.size.batch[0]) * desc.pitch.b +
|
||||
(f % in_layout.size.feature[0]) * desc.pitch.f +
|
||||
(y % in_layout.size.spatial[1]) * desc.pitch.y +
|
||||
(x % in_layout.size.spatial[0]) * desc.pitch.x;
|
||||
(b % in_layout.batch()) * desc.pitch.b +
|
||||
(f % in_layout.feature()) * desc.pitch.f +
|
||||
(y % in_layout.spatial(1)) * desc.pitch.y +
|
||||
(x % in_layout.spatial(0)) * desc.pitch.x;
|
||||
}
|
||||
|
||||
//Default implementation. Should be overridden in derived class otherwise.
|
||||
|
||||
@@ -270,13 +270,13 @@ template<typename T>
|
||||
void set_values_per_batch_and_feature(cldnn::memory::ptr mem, std::vector<T> args) {
|
||||
cldnn::mem_lock<T> mem_ptr(mem, get_test_stream());
|
||||
auto&& pitches = mem->get_layout().get_pitches();
|
||||
auto&& size = mem->get_layout().size;
|
||||
for (cldnn::tensor::value_type b = 0; b < size.batch[0]; ++b) {
|
||||
for (cldnn::tensor::value_type f = 0; f < size.feature[0]; ++f) {
|
||||
for (cldnn::tensor::value_type y = 0; y < size.spatial[1]; ++y) {
|
||||
for (cldnn::tensor::value_type x = 0; x < size.spatial[0]; ++x) {
|
||||
auto&& l = mem->get_layout();
|
||||
for (cldnn::tensor::value_type b = 0; b < l.batch(); ++b) {
|
||||
for (cldnn::tensor::value_type f = 0; f < l.feature(); ++f) {
|
||||
for (cldnn::tensor::value_type y = 0; y < l.spatial(1); ++y) {
|
||||
for (cldnn::tensor::value_type x = 0; x < l.spatial(0); ++x) {
|
||||
unsigned int input_it = b*pitches.batch[0] + f*pitches.feature[0] + y*pitches.spatial[1] + x*pitches.spatial[0];
|
||||
mem_ptr[input_it] = args[b*size.feature[0] + f];
|
||||
mem_ptr[input_it] = args[b*l.feature() + f];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user