(self, *args, **kwargs)
| 28 | def decorator(func: Callable[..., T]) -> Callable[..., T]: |
| 29 | @functools.wraps(func) |
| 30 | def wrapper(self, *args, **kwargs): |
| 31 | if not self.cpu_offload: |
| 32 | return func(self, *args, **kwargs) |
| 33 | |
| 34 | # Get the device from the class |
| 35 | device = self.device |
| 36 | # Get the model from the class attribute |
| 37 | model = getattr(self, model_attr) |
| 38 | |
| 39 | with CpuOffloader(model, device): |
| 40 | return func(self, *args, **kwargs) |
| 41 | |
| 42 | return wrapper |
| 43 | return decorator |
nothing calls this directly
no test coverage detected