class_docstr: Implements a natural gradient descent step.
  It **can only** be used in conjunction with a :obj:`~gpytorch.variational._NaturalVariationalDistribution`.
  
  .. seealso::
      - :obj:`gpytorch.variational.NaturalVariationalDistribution`
      - :obj:`gpytorch.variational.TrilNaturalVariationalDistribution`
      - The `natural gradient descent tutorial
        <examples/04_Variational_and_Approximate_GPs/Natural_Gradient_Descent.ipynb>`_
        for use instructions.
  
  Example:
      >>> ngd_optimizer = torch.optim.NGD(model.variational_parameters(), num_data=train_y.size(0), lr=0.1)
      >>> ngd_optimizer.zero_grad()
      >>> mll(gp_model(input), target).backward()
      >>> ngd_optimizer.step()
class_docstr_tok: ["Implements","a","natural","gradient","descent","step",".","It","*","*","can","only","*","*","be","used","in","conjunction","with","a",":","obj",":","`","~gpytorch.variational._NaturalVariationalDistribution","`",".","..","seealso",":",":","-",":","obj",":","`","gpytorch.variational.NaturalVariationalDistribution","`","-",":","obj",":","`","gpytorch.variational.TrilNaturalVariationalDistribution","`","-","The","`","natural","gradient","descent","tutorial","<","examples\/04_Variational_and_Approximate_GPs\/Natural_Gradient_Descent.ipynb",">","`","_","for","use","instructions",".","Example",":",">",">",">","ngd_optimizer","=","torch.optim.NGD","(","model.variational_parameters","(",")",",","num_data=train_y.size","(","0",")",",","lr=0.1",")",">",">",">","ngd_optimizer.zero_grad","(",")",">",">",">","mll","(","gp_model","(","input",")",",","target",")",".backward","(",")",">",">",">","ngd_optimizer.step","(",")"]
docstr: Performs a single optimization step.
  
  (Note that the :attr:`closure` argument is not used by this optimizer; it is simply included to be
  compatible with the PyTorch optimizer API.)
docstr_tok: ["Performs","a","single","optimization","step",".","(","Note","that","the",":","attr",":","`","closure","`","argument","is","not","used","by","this","optimizer",";","it","is","simply","included","to","be","compatible","with","the","PyTorch","optimizer","API",".",")"]
code: def step(self, closure: Optional[Callable] = None) -> None:
      """
      Performs a single optimization step.
  
      (Note that the :attr:`closure` argument is not used by this optimizer; it is simply included to be
      compatible with the PyTorch optimizer API.)
      """
      for group in self.param_groups:
          for p in group["params"]:
              if p.grad is None:
                  continue
              p.add_(p.grad, alpha=(-group["lr"] * self.num_data))
  
      return None
  
imports: from typing import Callable, Iterable, Optional, Union
  import torch
label_desc: Use image node_id 2 for calling the NGD obj's underlying member method code with example usage: obj.step(closure) and returns: None