Tensor initialization on device improvements (#6959)
* Update common.py speed improvements Eliminate .to() ops where possible for reduced data transfer overhead. Primarily affects warmup and PyTorch Hub inference. * Updates * Updates * Update detect.py * Update val.py
This commit is contained in:
1 parent
52c1399fdc
commit
701e1177ac
2 files changed
+4
-4
No files matched your search
+1
-1
@@ -466,7 +466,7 @@ class DetectMultiBackend(nn.Module):
|
||||
# Warmup model by running inference once
|
||||
if self.pt or self.jit or self.onnx or self.engine: # warmup types
|
||||
if isinstance(self.device, torch.device) and self.device.type != 'cpu': # only warmup GPU models
|
||||
im = torch.zeros(*imgsz).to(self.device).type(torch.half if self.fp16 else torch.float) # input image
|
||||
im = torch.zeros(*imgsz, dtype=torch.half if self.fp16 else torch.float, device=self.device) # input
|
||||
self.forward(im) # warmup
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in new issue
Block a user