class_docstr: Helper class to simplify the handling of gradient buckets
class_docstr_tok: ["Helper","class","to","simplify","the","handling","of","gradient","buckets"]
docstr: Given the parameters gradients which have been registered previously, rebuild the whole bucket
docstr_tok: ["Given","the","parameters","gradients","which","have","been","registered","previously",",","rebuild","the","whole","bucket"]
code: def _reattach_grads(self) -> None:
      """
      Given the parameters gradients which have been registered previously, rebuild the whole bucket
      """
      assert len(self._params) > 0
  
      self._fill = 0
      for p in self._params:
          self._add_grad_as_view(p, keep_existing_value=False)
  
imports: from typing import Any, Callable, List, Optional, Union
  import torch
label_desc: Use image node_id 11 for calling the GradBucket obj's underlying member method code with example usage: obj._reattach_grads() without return types