From 18f6ba77cfbbf060a25d32a657629c2c1d419a49 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 30 Jul 2021 00:37:55 +0200 Subject: [PATCH] Suppress torch 1.9.0 max_pool2d() warning (#4227) --- models/common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/models/common.py b/models/common.py index fc085e22b16b..24f02c2a584c 100644 --- a/models/common.py +++ b/models/common.py @@ -1,6 +1,7 @@ # YOLOv5 common modules import logging +import warnings from copy import copy from pathlib import Path @@ -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):