[Bugfix] Optimize CpuGpuBuffer initialization (#25447)

Signed-off-by: Naman Lalit <nl2688@nyu.edu>
This commit is contained in:
Naman Lalit 2025-09-26 17:07:36 -07:00 committed by GitHub
parent dc48ba0c75
commit 4e33a7ea85
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -117,7 +117,7 @@ class CpuGpuBuffer:
dtype=dtype,
device="cpu",
pin_memory=pin_memory)
self.gpu = self.cpu.to(device)
self.gpu = torch.zeros_like(self.cpu, device=device)
self.np: np.ndarray
# To keep type hints simple (avoiding generics and subclasses), we
# only conditionally create the numpy array attribute. This can cause