The original code is like this:
net = cv.dnn.readNet("gpt2.onnx")
input_token_size = net.getLayerShape([], 0, 0)[0][0][1]
Before update the new engine(core), getLayerShape
returns a 3-dim tuple with item int-type.
And after update, it changes the last dim to cv.MatShape, which means getLayerShape([], [], 0)[0][0]
is type cv.MatShape
.
And I don’t know how to get the item within MatShape, because I only have C++ code of OpenCV but don’t know how to use in Python(I try some function in cv::MatShape
but python said that MatShape dosn’t have these attributes).
Additionally, eager for a OpenCV python tutorial(it must be a hard work).