Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
baoachun committed Apr 21, 2022
1 parent 19f9f81 commit db80221
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ class FlattenContiguousRangeOpConverter : public OpConverter {
if (stop_axis < 0) stop_axis += dims;

int dim_prod = 1;
int dim_negative = 0;
nvinfer1::Dims flatten_dim;
flatten_dim.nbDims = dims - (stop_axis - start_axis);
bool need_slice = false;
for (int i = 0, j = 0; i < dims; ++i) {
int dim_i = input_dim.d[i];
if (start_axis <= i && i <= stop_axis) {
int dim_i = input_dim.d[i];
if (dim_i < 0) {
need_slice = true;
break;
Expand All @@ -83,6 +84,11 @@ class FlattenContiguousRangeOpConverter : public OpConverter {
flatten_dim.d[j++] = dim_prod;
}
} else {
if (dim_i < 0) dim_negative++;
if (dim_negative > 1) {
need_slice = true;
break;
}
flatten_dim.d[j++] = input_dim.d[i];
}
}
Expand Down

1 comment on commit db80221

@paddle-bot-old
Copy link

@paddle-bot-old paddle-bot-old bot commented on db80221 Apr 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵️ CI failures summary

🔍 PR: #42087 Commit ID: db80221 contains failed CI.

🔹 Failed: PR-CI-Coverage

Unknown Failed
Unknown Failed

Please sign in to comment.