Method
__init__
(self, numel: int, numel_padded: int, dtype: torch.dtype, source: Optional[torch.Tensor] = None)
Source from the content-addressed store, hash-verified
| 28 | """ |
| 29 | |
| 30 | def __init__(self, numel: int, numel_padded: int, dtype: torch.dtype, source: Optional[torch.Tensor] = None): |
| 31 | self.numel = numel |
| 32 | self.numel_padded = numel_padded |
| 33 | self.dtype = dtype |
| 34 | if source is not None: |
| 35 | self.data = source |
| 36 | else: |
| 37 | self.data = torch.zeros(self.numel_padded, dtype=self.dtype, device='cuda', requires_grad=False) |
| 38 | |
| 39 | def zero(self): |
| 40 | """Reset the buffer to zero.""" |
Tested by
no test coverage detected