Fix PyTorch Hub export inference shapes
diff --git a/models/common.py b/models/common.py
index 70ee7105abf..ac3af20d533 100644
--- a/models/common.py
+++ b/models/common.py
@@ -544,10 +544,9 @@ def forward(self, imgs, size=640, augment=False, profile=False):
             g = (size / max(s))  # gain
             shape1.append([y * g for y in s])
             imgs[i] = im if im.data.contiguous else np.ascontiguousarray(im)  # update
-        shape1 = [make_divisible(x, self.stride) for x in np.stack(shape1, 0).max(0)]  # inference shape
-        x = [letterbox(im, new_shape=shape1 if self.pt else size, auto=False)[0] for im in imgs]  # pad
-        x = np.stack(x, 0) if n > 1 else x[0][None]  # stack
-        x = np.ascontiguousarray(x.transpose((0, 3, 1, 2)))  # BHWC to BCHW
+        shape1 = [make_divisible(x, self.stride) if self.pt else size for x in np.array(shape1).max(0)]  # inf shape
+        x = [letterbox(im, new_shape=shape1, auto=False)[0] for im in imgs]  # pad
+        x = np.ascontiguousarray(np.array(x).transpose((0, 3, 1, 2)))  # stack and BHWC to BCHW
         x = torch.from_numpy(x).to(p.device).type_as(p) / 255  # uint8 to fp16/32
         t.append(time_sync())
 

May resolve https://github.com/ultralytics/yolov5/issues/6947



## 🛠️ PR Summary

<sub>Made with ❤️ by [Ultralytics Actions](https://github.com/ultralytics/actions)<sub>

### 🌟 Summary
Simplified image preprocessing in the YOLOv5 forward pass method.

### 📊 Key Changes
- Removed conditional logic for different inference shapes based on `self.pt`.
- Streamlined the process for making inference shape divisible by the stride and applying letterbox padding to images.
- Improved image stacking and format conversion (BHWC to BCHW) process.

### 🎯 Purpose & Impact
- Enhances code readability and maintainability by reducing complexity.
- Ensures consistent image preprocessing regardless of the PyTorch (`self.pt`) presence.
- Potentially increases efficiency during the image preprocessing step, leading to faster image handling in the forward pass.

These changes can provide a smoother and more understandable experience for developers working with the YOLOv5 codebase, while end-users might benefit from slight performance improvements during model inference. 🚀