MCPcopy
hub / github.com/ultralytics/yolov5 / warmup

Method warmup

models/common.py:591–597  ·  view source on GitHub ↗
(self, imgsz=(1, 3, 640, 640))

Source from the content-addressed store, hash-verified

589 return torch.from_numpy(x).to(self.device) if isinstance(x, np.ndarray) else x
590
591 def warmup(self, imgsz=(1, 3, 640, 640)):
592 # Warmup model by running inference once
593 warmup_types = self.pt, self.jit, self.onnx, self.engine, self.saved_model, self.pb, self.triton
594 if any(warmup_types) and (self.device.type != 'cpu' or self.triton):
595 im = torch.empty(*imgsz, dtype=torch.half if self.fp16 else torch.float, device=self.device) # input
596 for _ in range(2 if self.jit else 1): #
597 self.forward(im) # warmup
598
599 @staticmethod
600 def _model_type(p='path/to/model.pt'):

Callers 5

runFunction · 0.95
runFunction · 0.95
runFunction · 0.95
runFunction · 0.95
runFunction · 0.95

Calls 1

forwardMethod · 0.95

Tested by

no test coverage detected