Add DWConvClass() (#4274)

* Add `DWConvClass()`

* Cleanup

* Cleanup2
This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-08-02 15:36:30 +02:00
1 parent 9c6732f61c
commit 587c4b4b81
3 files changed
+12 -5

No files matched your search

+2 -2
View File
@@ -202,10 +202,10 @@ class Model(nn.Module):
def fuse(self): # fuse model Conv2d() + BatchNorm2d() layers
LOGGER.info('Fusing layers... ')
for m in self.model.modules():
if type(m) is Conv and hasattr(m, 'bn'):
if isinstance(m, (Conv, DWConvClass)) and hasattr(m, 'bn'):
m.conv = fuse_conv_and_bn(m.conv, m.bn) # update conv
delattr(m, 'bn') # remove batchnorm
m.forward = m.fuseforward # update forward
m.forward = m.forward_fuse # update forward
self.info()
return self