From 07a5ff9ddca487581035b61ff7678c0f7e0f40d9 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Thu, 19 Sep 2024 21:22:55 +0200 Subject: [PATCH] `ultralytics 8.2.98` faster `fuse()` operations (#16375) Co-authored-by: UltralyticsAssistant --- ultralytics/__init__.py | 2 +- ultralytics/utils/torch_utils.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index 34c099b7..b3e0acfb 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = "8.2.97" +__version__ = "8.2.98" import os diff --git a/ultralytics/utils/torch_utils.py b/ultralytics/utils/torch_utils.py index 75a90b76..824e1e82 100644 --- a/ultralytics/utils/torch_utils.py +++ b/ultralytics/utils/torch_utils.py @@ -251,7 +251,7 @@ def fuse_conv_and_bn(conv, bn): ) # Prepare filters - w_conv = conv.weight.clone().view(conv.out_channels, -1) + w_conv = conv.weight.view(conv.out_channels, -1) w_bn = torch.diag(bn.weight.div(torch.sqrt(bn.eps + bn.running_var))) fusedconv.weight.copy_(torch.mm(w_bn, w_conv).view(fusedconv.weight.shape)) @@ -282,7 +282,7 @@ def fuse_deconv_and_bn(deconv, bn): ) # Prepare filters - w_deconv = deconv.weight.clone().view(deconv.out_channels, -1) + w_deconv = deconv.weight.view(deconv.out_channels, -1) w_bn = torch.diag(bn.weight.div(torch.sqrt(bn.eps + bn.running_var))) fuseddconv.weight.copy_(torch.mm(w_bn, w_deconv).view(fuseddconv.weight.shape))