mirror of
https://github.com/opencv/opencv.git
synced 2024-11-28 05:06:29 +08:00
Addition of normalize_axis to ONNXImporter::parseSqueeze to support negative values for the axes attribut.
Negative values are part of the ONNX optset>=11. Signed-off-by: Olivier Hotel <olivier.hotel@orange.com>
This commit is contained in:
parent
1457320702
commit
0442c6fa81
@ -2147,6 +2147,7 @@ void ONNXImporter::parseSqueeze(LayerParams& layerParams, const opencv_onnx::Nod
|
||||
for (int i = 0; i < axes_dict.size(); ++i)
|
||||
{
|
||||
int axis = axes_dict.getIntValue(i);
|
||||
axis = normalize_axis(axis, inpShape.size());
|
||||
CV_CheckLE(axis, static_cast<int>(inpShape.size()), "Squeeze axis");
|
||||
maskedAxes[axis] = inpShape[axis] == 1;
|
||||
}
|
||||
@ -2162,6 +2163,7 @@ void ONNXImporter::parseSqueeze(LayerParams& layerParams, const opencv_onnx::Nod
|
||||
for (int i = 0; i < axesLen; i++)
|
||||
{
|
||||
int axis = axesMat.at<int>(i);
|
||||
axis = normalize_axis(axis, inpShape.size());
|
||||
CV_CheckLE(axis, static_cast<int>(inpShape.size()), "Squeeze axis");
|
||||
maskedAxes[axis] = inpShape[axis] == 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user