mirror of
https://github.com/opencv/opencv.git
synced 2025-06-12 20:42:53 +08:00
Merge pull request #23707 from Orange-OpenSource:ONNX_Squeeze_negative_index_for_the_axes_attribute
Addition of normalize_axis to ONNXImporter::parseSqueeze
This commit is contained in:
commit
c55aee1e79
@ -2147,6 +2147,7 @@ void ONNXImporter::parseSqueeze(LayerParams& layerParams, const opencv_onnx::Nod
|
|||||||
for (int i = 0; i < axes_dict.size(); ++i)
|
for (int i = 0; i < axes_dict.size(); ++i)
|
||||||
{
|
{
|
||||||
int axis = axes_dict.getIntValue(i);
|
int axis = axes_dict.getIntValue(i);
|
||||||
|
axis = normalize_axis(axis, inpShape.size());
|
||||||
CV_CheckLE(axis, static_cast<int>(inpShape.size()), "Squeeze axis");
|
CV_CheckLE(axis, static_cast<int>(inpShape.size()), "Squeeze axis");
|
||||||
maskedAxes[axis] = inpShape[axis] == 1;
|
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++)
|
for (int i = 0; i < axesLen; i++)
|
||||||
{
|
{
|
||||||
int axis = axesMat.at<int>(i);
|
int axis = axesMat.at<int>(i);
|
||||||
|
axis = normalize_axis(axis, inpShape.size());
|
||||||
CV_CheckLE(axis, static_cast<int>(inpShape.size()), "Squeeze axis");
|
CV_CheckLE(axis, static_cast<int>(inpShape.size()), "Squeeze axis");
|
||||||
maskedAxes[axis] = inpShape[axis] == 1;
|
maskedAxes[axis] = inpShape[axis] == 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user