docstr: Moves all model parameters and buffers to the GPU. This also makes associated parameters and buffers
  different objects. So it should be called before constructing optimizer if the module will live on GPU while
  being optimized.
  
  Arguments:
      device: If specified, all parameters will be copied to that device. If `None`, the current CUDA device
          index will be used.
  
  Returns:
      Module: self
docstr_tok: ["Moves","all","model","parameters","and","buffers","to","the","GPU",".","This","also","makes","associated","parameters","and","buffers","different","objects",".","So","it","should","be","called","before","constructing","optimizer","if","the","module","will","live","on","GPU","while","being","optimized",".","Arguments",":","device",":","If","specified",",","all","parameters","will","be","copied","to","that","device",".","If","`","None","`",",","the","current","CUDA","device","index","will","be","used",".","Returns",":","Module",":","self"]
code: def cuda(
      self, device: Optional[Union[torch.device, int]] = None
  ) -> Self:
      """Moves all model parameters and buffers to the GPU. This also makes associated parameters and buffers
      different objects. So it should be called before constructing optimizer if the module will live on GPU while
      being optimized.
  
      Arguments:
          device: If specified, all parameters will be copied to that device. If `None`, the current CUDA device
              index will be used.
  
      Returns:
          Module: self
  
      """
      if device is None:
          device = torch.device("cuda", torch.cuda.current_device())
      elif isinstance(device, int):
          device = torch.device("cuda", index=device)
      _update_properties(self, device=device)
      return super().cuda(device=device)
  
file_path: pytorch-lightning/src/lightning/fabric/utilities/device_dtype_mixin.py
imports: from typing import Any, List, Optional, Union
  import torch
  from torch.nn import Module
  from typing_extensions import Self, override
label_desc: Use image node_id 6 for calling the _DeviceDtypeModuleMixin obj's underlying member method code with example usage: obj.cuda(device) and returns: super