<h1 dir="auto">System information (version)</h1>
<ul dir="auto">
<li>OpenCV = 4.5.5.dev</li>
<li>torch = 1.6.0</li>
</ul>
<h1 dir="auto">Steps to reproduce</h1>
<p dir="auto">net = cv2.dnn.readNetFromONNX(onnx_path)</p>
<h1 dir="auto">Issue</h1>
<p dir="auto">I am getting the following error. when I updated the PyTorch to the latest version like 1.12.0 I am getting a new error <code class="notranslate">(-215:Assertion failed) inputs.size() in function 'getMemoryShapes'</code> .  Any help on this would be appreciated.</p>
<p dir="auto">`cv2.error: OpenCV(4.5.5-dev) /home/nsight/YOLOX/opencv/modules/dnn/src/onnx/onnx_importer.cpp:1021: error: (-2:Unspecified error) in function 'handleNode'</p>
<blockquote>
<p dir="auto">Node [<a href="mailto:Range@ai.onnx">Range@ai.onnx</a>]:(Range_404) parse error: OpenCV(4.5.5-dev) /home/nsight/YOLOX/opencv/modules/dnn/src/layer_internals.hpp:110: error: (-2:Unspecified error) Can't create layer "Range_404" of type "Range" in function 'getLayerInstance'<br>
`<br>
Here is a snapshot of layer 404 in ONNX <a href="https://drive.google.com/file/d/1OtCxb3kP_cBmh5Geb3vWl4Tn2TKND-Vj/view?usp=sharing" rel="nofollow">graph</a></p>
</blockquote>
<h5 dir="auto">System information (version)</h5>
<ul dir="auto">
<li>OpenCV =&gt; 4.2</li>
<li>Operating System / Platform =&gt; MacOS Catalina v.10.15.3</li>
<li>IDE =&gt; Spyder 4.1.0</li>
<li>Compiler =&gt; python3.7</li>
</ul>
<h5 dir="auto">Detailed description</h5>
<p dir="auto">I can open images and process them with  openCV, but when it comes to destroying windows shown with cv2.imshow() using cv2.destroyAllWindows() script stops execution in console, but that pop up window is just hangs/freezes<br>
With video it’s even worse - i can capture from camera and/or file, but i can’t modify video properties or save capture to file (file is created but 8k size)<br>
So, it’s like partially broken and yet at the same time it gives no exceptions.</p>
<h5 dir="auto">Steps to reproduce</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import cv2

cap = cv2.VideoCapture(0) #capture frame from built-in video camera 
#print frame properties - width / height
print(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
print(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))

### That part breaks execution (if removed all works well.) ###
cap.set(3,1208) #set width property to 1208
cap.set(4,720) #set height property to 720

print(cap.get(3))
print(cap.get(4))
###.... ### 

while(cap.isOpened()):#run loop if file/device is open
    ret,frame = cap.read() #read frames continiously until break

    if ret:
        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) #convert image to gray-scale
        cv2.imshow('DisplayWindow', gray) #display frames readed from camera and show in window named &quot;frame&quot;
    
        if cv2.waitKey(1) &amp; 0xFF  == ord('q'):#break from loop on 'q' pressed
            break
    else:
        break

cap.release() #release camera
cv2.destroyAllWindows()# should destroy all windows, but Window stop showing camera capture and just freezes and stays."><pre class="notranslate"><code class="notranslate">import cv2

cap = cv2.VideoCapture(0) #capture frame from built-in video camera 
#print frame properties - width / height
print(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
print(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))

### That part breaks execution (if removed all works well.) ###
cap.set(3,1208) #set width property to 1208
cap.set(4,720) #set height property to 720

print(cap.get(3))
print(cap.get(4))
###.... ### 

while(cap.isOpened()):#run loop if file/device is open
    ret,frame = cap.read() #read frames continiously until break

    if ret:
        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) #convert image to gray-scale
        cv2.imshow('DisplayWindow', gray) #display frames readed from camera and show in window named "frame"
    
        if cv2.waitKey(1) &amp; 0xFF  == ord('q'):#break from loop on 'q' pressed
            break
    else:
        break

cap.release() #release camera
cv2.destroyAllWindows()# should destroy all windows, but Window stop showing camera capture and just freezes and stays.
</code></pre></div>
<h5 dir="auto">Issue submission checklist</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I report the issue, it's not a question

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I checked the problem with documentation, FAQ, open issues,<br>
answers.opencv.org, Stack Overflow, etc and have not found solution

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I updated to latest OpenCV version and the issue is still there

</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> There is reproducer code and related data files: videos, images, onnx, etc

</li>
</ul>