Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GPU] Handle negative axis in concat op #6839

Merged
merged 4 commits into from
Aug 4, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions inference-engine/src/cldnn_engine/ops/concat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
namespace CLDNNPlugin {

static cldnn::concatenation::concatenation_axis GetConcatAxis(int32_t axis, size_t rank) {
if (axis >= rank)
unsigned cldnn_axis = axis >= 0 ? axis : axis + static_cast<int32_t>(rank);
mateusztabaka marked this conversation as resolved.
Show resolved Hide resolved
if (cldnn_axis >= rank)
IE_THROW() << "Concatenation axis exceeds number of dimensions";

// Difference in dimension ordering between IE and clDNN,
// reverse spatial dimensions after batch and feature.
unsigned cldnn_axis = axis;
if (axis >= 2) {
auto spatial_axis = axis - 2;
if (cldnn_axis >= 2) {
auto spatial_axis = cldnn_axis - 2;
// Default and minimum number of dimensions is 4
auto spatial_size = std::max<size_t>(rank, 4) - 2;
cldnn_axis = spatial_size - spatial_axis - 1 + 2;
Expand Down