class_docstr: EXPERIMENTAL Discrete Cosine Transform-augmented
  :class:`~pyro.optim.clipped_adam.ClippedAdam` optimizer.
  
  This acts like :class:`~pyro.optim.clipped_adam.ClippedAdam` on most
  parameters, but if a parameter has an attribute ``._pyro_dct_dim``
  indicating a time dimension, this creates a secondary optimize in the
  frequency domain. This is useful for parameters of time series models.
  
  :param params: iterable of parameters to optimize or dicts defining parameter groups
  :param float lr: learning rate (default: 1e-3)
  :param tuple betas: coefficients used for computing
      running averages of gradient and its square (default: (0.9, 0.999))
  :param float eps: term added to the denominator to improve
      numerical stability (default: 1e-8)
  :param float clip_norm: magnitude of norm to which gradients are clipped (default: 10.0)
  :param float lrd: rate at which learning rate decays (default: 1.0)
  :param bool subsample_aware: whether to update gradient statistics only for
      those elements that appear in a subsample (default: False).
class_docstr_tok: ["EXPERIMENTAL","Discrete","Cosine","Transform-augmented",":","class",":","`","~pyro.optim.clipped_adam.ClippedAdam","`","optimizer",".","This","acts","like",":","class",":","`","~pyro.optim.clipped_adam.ClippedAdam","`","on","most","parameters",",","but","if","a","parameter","has","an","attribute","``","._pyro_dct_dim","``","indicating","a","time","dimension",",","this","creates","a","secondary","optimize","in","the","frequency","domain",".","This","is","useful","for","parameters","of","time","series","models",".",":","param","params",":","iterable","of","parameters","to","optimize","or","dicts","defining","parameter","groups",":","param","float","lr",":","learning","rate","(","default",":","1e-3",")",":","param","tuple","betas",":","coefficients","used","for","computing","running","averages","of","gradient","and","its","square","(","default",":","(","0.9",",","0.999",")",")",":","param","float","eps",":","term","added","to","the","denominator","to","improve","numerical","stability","(","default",":","1e-8",")",":","param","float","clip_norm",":","magnitude","of","norm","to","which","gradients","are","clipped","(","default",":","10.0",")",":","param","float","lrd",":","rate","at","which","learning","rate","decays","(","default",":","1.0",")",":","param","bool","subsample_aware",":","whether","to","update","gradient","statistics","only","for","those","elements","that","appear","in","a","subsample","(","default",":","False",")","."]
docstr: :param closure: An optional closure that reevaluates the model and returns the loss.
  
  Performs a single optimization step.
docstr_tok: [":","param","closure",":","An","optional","closure","that","reevaluates","the","model","and","returns","the","loss",".","Performs","a","single","optimization","step","."]
code: def step(self, closure: Optional[Callable] = None) -> Optional[float]:
      """
      :param closure: An optional closure that reevaluates the model and returns the loss.
  
      Performs a single optimization step.
      """
      loss = None
      if closure is not None:
          loss = closure()
  
      for group in self.param_groups:
          group["lr"] *= group["lrd"]
  
          for p in group["params"]:
              if p.grad is None:
                  continue
  
              subsample = getattr(p, "_pyro_subsample", {})
              if subsample and group["subsample_aware"]:
                  self._step_param_subsample(group, p, subsample)
              else:
                  self._step_param(group, p)
  
      return loss
  
file_path: pyro/pyro/optim/dct_adam.py
imports: import math
  from typing import Callable, Dict, Optional, Tuple
  import torch
  from torch.nn.functional import pad
  from torch.optim.optimizer import Optimizer
  from pyro.ops.tensor_utils import dct, idct, next_fast_len
label_desc: Use image node_id 2 for calling the DCTAdam obj's underlying member method code with example usage: obj.step(closure) and returns: loss