class_docstr: Helper class to simplify the handling of gradient buckets
class_docstr_tok: ["Helper","class","to","simplify","the","handling","of","gradient","buckets"]
docstr: Move the underlying buffer
docstr_tok: ["Move","the","underlying","buffer"]
code: def to(  # type: ignore
      self,
      device: Optional[Union[int, torch.device]],
      dtype: Optional[torch.dtype] = None,
      non_blocking: bool = False,
      keep_param_alignment: bool = True,
  ) -> "GradBucket":
      """
      Move the underlying buffer
      """
      if self._is_collapsed:
          self.rebuild()
  
      super().to(device, dtype, non_blocking)
  
      if keep_param_alignment:
          self._reattach_grads()
  
imports: from typing import Any, Callable, List, Optional, Union
  import torch
label_desc: Use image node_id 5 for calling the GradBucket obj's underlying member method code with example usage: obj.to(device, dtype, non_blocking, keep_param_alignment) without return types