class_docstr: Helper class to simplify the handling of buckets, which unify the underlying storage of multiple tensors
class_docstr_tok: ["Helper","class","to","simplify","the","handling","of","buckets",",","which","unify","the","underlying","storage","of","multiple","tensors"]
code: def __init__(
      self, size: int, dtype: torch.dtype, device: torch.device
  ) -> None:
      self._params: List[torch.Tensor] = []
      self._param_ids: List[int] = []
      self._fill = 0
  
      # The actual flat tensor
      self.buffer: torch.Tensor = torch.zeros(
          size, dtype=dtype, device=device
      )
  
imports: from typing import Any, Callable, List, Optional, Union
  import torch
label_desc: Use image node_id 1 to create a new Bucket object  with example: obj = Bucket(size, dtype, device)