glenn-jocher commited on
Commit
18f6ba7
1 Parent(s): c2c958c

Suppress torch 1.9.0 max_pool2d() warning (#4227)

Browse files
Files changed (1) hide show
  1. models/common.py +4 -1
models/common.py CHANGED
@@ -1,6 +1,7 @@
1
  # YOLOv5 common modules
2
 
3
  import logging
 
4
  from copy import copy
5
  from pathlib import Path
6
 
@@ -158,7 +159,9 @@ class SPP(nn.Module):
158
 
159
  def forward(self, x):
160
  x = self.cv1(x)
161
- return self.cv2(torch.cat([x] + [m(x) for m in self.m], 1))
 
 
162
 
163
 
164
  class Focus(nn.Module):
 
1
  # YOLOv5 common modules
2
 
3
  import logging
4
+ import warnings
5
  from copy import copy
6
  from pathlib import Path
7
 
 
159
 
160
  def forward(self, x):
161
  x = self.cv1(x)
162
+ with warnings.catch_warnings():
163
+ warnings.simplefilter('ignore') # suppress torch 1.9.0 max_pool2d() warning
164
+ return self.cv2(torch.cat([x] + [m(x) for m in self.m], 1))
165
 
166
 
167
  class Focus(nn.Module):