docstr: Setup the buffers if they are not allocated.
  
  Using ``setup`` and ``teardown``, we can ensure that the bucket
  buffers are only allocated during the backward pass, hence saving more
  memory to other parts of the training process, such as the forward pass
  for activation memory.
docstr_tok: ["Setup","the","buffers","if","they","are","not","allocated",".","Using","``","setup","``","and","``","teardown","``",",","we","can","ensure","that","the","bucket","buffers","are","only","allocated","during","the","backward","pass",",","hence","saving","more","memory","to","other","parts","of","the","training","process",",","such","as","the","forward","pass","for","activation","memory","."]
code: def setup(self) -> None:
      """Setup the buffers if they are not allocated.
  
      Using ``setup`` and ``teardown``, we can ensure that the bucket
      buffers are only allocated during the backward pass, hence saving more
      memory to other parts of the training process, such as the forward pass
      for activation memory.
      """
      for tensor in [self.data, self.output_shard]:
          if tensor.storage().size() == 0:
              tensor.storage().resize_(tensor.size().numel())
  
file_path: fairscale/fairscale/internal/reduce_scatter_bucketer.py
imports: import functools
  import os
  from typing import TYPE_CHECKING, Callable, Dict, List, Optional, Tuple
  import torch
  from torch import Tensor
  import torch.distributed
label_desc: Use image node_id 3 for calling the Bucket obj's underlying member method code with example usage: obj.setup() without return types