class_docstr: Main entry point to the Opacus API - use ``PrivacyEngine``  to enable differential
  privacy for your model training.
  
  ``PrivacyEngine`` object encapsulates current privacy state (privacy budget +
  method it's been calculated) and exposes ``make_private`` method to wrap your
  PyTorch training objects with their private counterparts.
  
  Example:
      >>> dataloader = demo_dataloader
      >>> model = MyCustomModel()
      >>> optimizer = torch.optim.SGD(model.parameters(), lr=0.05)
      >>> privacy_engine = PrivacyEngine()
      >>>
      >>> model, optimizer, dataloader = privacy_engine.make_private(
      ...    module=model,
      ...    optimizer=optimizer,
      ...    data_loader=dataloader,
      ...    noise_multiplier=1.0,
      ...    max_grad_norm=1.0,
      ... )
      >>> # continue training as normal
class_docstr_tok: ["Main","entry","point","to","the","Opacus","API","-","use","``","PrivacyEngine","``","to","enable","differential","privacy","for","your","model","training",".","``","PrivacyEngine","``","object","encapsulates","current","privacy","state","(","privacy","budget","+","method","it","'s","been","calculated",")","and","exposes","``","make_private","``","method","to","wrap","your","PyTorch","training","objects","with","their","private","counterparts",".","Example",":",">",">",">","dataloader","=","demo_dataloader",">",">",">","model","=","MyCustomModel","(",")",">",">",">","optimizer","=","torch.optim.SGD","(","model.parameters","(",")",",","lr=0.05",")",">",">",">","privacy_engine","=","PrivacyEngine","(",")",">",">",">",">",">",">","model",",","optimizer",",","dataloader","=","privacy_engine.make_private","(","...","module=model",",","...","optimizer=optimizer",",","...","data_loader=dataloader",",","...","noise_multiplier=1.0",",","...","max_grad_norm=1.0",",","...",")",">",">",">","#","continue","training","as","normal"]
docstr: Saves the state_dict of module, optimizer, and accountant at path.
  Args:
      path: Path to save the state dict objects.
      module: GradSampleModule to save; wrapped module's state_dict is saved.
      optimizer: DPOptimizer to save; wrapped optimizer's state_dict is saved.
      noise_scheduler: _NoiseScheduler whose state we should save.
      grad_clip_scheduler: _GradClipScheduler whose state we should save.
      checkpoint_dict: Dict[str, Any]; an already-filled checkpoint dict.
      module_state_dict_kwargs: dict of kwargs to pass to ``module.state_dict()``
      torch_save_kwargs: dict of kwargs to pass to ``torch.save()``
docstr_tok: ["Saves","the","state_dict","of","module",",","optimizer",",","and","accountant","at","path",".","Args",":","path",":","Path","to","save","the","state","dict","objects",".","module",":","GradSampleModule","to","save",";","wrapped","module","'s","state_dict","is","saved",".","optimizer",":","DPOptimizer","to","save",";","wrapped","optimizer","'s","state_dict","is","saved",".","noise_scheduler",":","_NoiseScheduler","whose","state","we","should","save",".","grad_clip_scheduler",":","_GradClipScheduler","whose","state","we","should","save",".","checkpoint_dict",":","Dict","[","str",",","Any","]",";","an","already-filled","checkpoint","dict",".","module_state_dict_kwargs",":","dict","of","kwargs","to","pass","to","``","module.state_dict","(",")","``","torch_save_kwargs",":","dict","of","kwargs","to","pass","to","``","torch.save","(",")","``"]
code: def save_checkpoint(
      self,
      *,
      path: Union[str, os.PathLike, BinaryIO, IO[bytes]],
      module: GradSampleModule,
      optimizer: Optional[DPOptimizer] = None,
      noise_scheduler: Optional[_NoiseScheduler] = None,
      grad_clip_scheduler: Optional[_GradClipScheduler] = None,
      checkpoint_dict: Optional[Dict[str, Any]] = None,
      module_state_dict_kwargs: Optional[Dict[str, Any]] = None,
      torch_save_kwargs: Optional[Dict[str, Any]] = None,
  ):
      """
      Saves the state_dict of module, optimizer, and accountant at path.
      Args:
          path: Path to save the state dict objects.
          module: GradSampleModule to save; wrapped module's state_dict is saved.
          optimizer: DPOptimizer to save; wrapped optimizer's state_dict is saved.
          noise_scheduler: _NoiseScheduler whose state we should save.
          grad_clip_scheduler: _GradClipScheduler whose state we should save.
          checkpoint_dict: Dict[str, Any]; an already-filled checkpoint dict.
          module_state_dict_kwargs: dict of kwargs to pass to ``module.state_dict()``
          torch_save_kwargs: dict of kwargs to pass to ``torch.save()``
  
      """
      checkpoint_dict = checkpoint_dict or {}
      checkpoint_dict["module_state_dict"] = module.state_dict(
          **(module_state_dict_kwargs or {})
      )
      checkpoint_dict[
          "privacy_accountant_state_dict"
      ] = self.accountant.state_dict()
      if optimizer is not None:
          checkpoint_dict[
              "optimizer_state_dict"
          ] = optimizer.state_dict()
      if noise_scheduler is not None:
          checkpoint_dict[
              "noise_scheduler_state_dict"
          ] = noise_scheduler.state_dict()
      if grad_clip_scheduler is not None:
          checkpoint_dict[
              "grad_clip_scheduler_state_dict"
          ] = grad_clip_scheduler.state_dict()
  
      torch.save(checkpoint_dict, path, **(torch_save_kwargs or {}))
  
imports: import os
  import warnings
  from itertools import chain
  from typing import IO, Any, BinaryIO, Dict, List, Optional, Tuple, Union
  import torch
  from opacus.accountants import create_accountant
  from opacus.accountants.utils import get_noise_multiplier
  from opacus.data_loader import DPDataLoader, switch_generator
  from opacus.distributed import DifferentiallyPrivateDistributedDataParallel
  from opacus.grad_sample import AbstractGradSampleModule, GradSampleModule, get_gsm_class, wrap_model
  from opacus.optimizers import DPOptimizer, get_optimizer_class
  from opacus.schedulers import _GradClipScheduler, _NoiseScheduler
  from opacus.validators.module_validator import ModuleValidator
  from torch import nn, optim
  from torch.nn.parallel import DistributedDataParallel
  from torch.utils.data import DataLoader
label_desc: Use image node_id 11 for calling the PrivacyEngine obj's underlying member method code with example usage: obj.save_checkpoint() without return types