class_docstr: Holds state for running optimizer in-line after DDP communication hook.
  
  Currently contains only optimizer class which must have a method `step_param`.
class_docstr_tok: ["Holds","state","for","running","optimizer","in-line","after","DDP","communication","hook",".","Currently","contains","only","optimizer","class","which","must","have","a","method","`","step_param","`","."]
code: def _set_params_to_optimize(self, params):
      if params is not None:
          self.params_to_optimize = set(params)
  
file_path: pytorch/torch/distributed/algorithms/ddp_comm_hooks/optimizer_overlap_hooks.py
imports: from typing import Any, Callable, List, no_type_check
  import torch
  import torch.distributed
  from torch.autograd import Variable
  from functools import partial
  from dataclasses import dataclass
label_desc: Use image node_id 2 for calling the _OptimizerHookState obj's underlying member method code with example usage: obj._set_params_to_optimize(params) without return types