Skip to content

Commit

Permalink
Suppress torch 1.9.0 max_pool2d() warning (ultralytics#4227)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Jul 29, 2021
1 parent 7a072f6 commit 6d2ff63
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion models/common.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# YOLOv5 common modules

import logging
import warnings
from copy import copy
from pathlib import Path

Expand Down Expand Up @@ -158,7 +159,9 @@ def __init__(self, c1, c2, k=(5, 9, 13)):

def forward(self, x):
x = self.cv1(x)
return self.cv2(torch.cat([x] + [m(x) for m in self.m], 1))
with warnings.catch_warnings():
warnings.simplefilter('ignore') # suppress torch 1.9.0 max_pool2d() warning
return self.cv2(torch.cat([x] + [m(x) for m in self.m], 1))


class Focus(nn.Module):
Expand Down

0 comments on commit 6d2ff63

Please sign in to comment.