Skip to content

Commit a900cd9

Browse files
committed
fix the expand_nd negative axis case
1 parent 5cd6c36 commit a900cd9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/caffe/layers/expand_dims_nd_layer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ void ExpandDimsNDLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
1919
{
2020
CHECK_LE(axis[i], bottom[0]->num_axes())
2121
<< "Newly inserted axis index should not be greater than bottom axis count!";
22-
if(axis[i] != bottom[0]->num_axes())
23-
axis[i] = bottom[0]->CanonicalAxisIndex(axis[i]);
22+
if(axis[i] < 0)
23+
axis[i] = bottom[0]->CanonicalAxisIndex(axis[i]) + 1;
2424
}
2525
vector<int> top_shape;
2626
/*

0 commit comments

Comments
 (0)