docstr: Construct a general Optimizer. This is an abstract class, and must
  be derived.
  
  Parameters
  ----------
  lr
      Learning rate.
  inplace
      Whether to update the variables in-place, or to create new variable handles.
      This is only relevant for frameworks with stateful variables such as
      PyTorch.
      Default is ``True``, provided the backend framework supports it.
  stop_gradients
      Whether to stop the gradients of the variables after each gradient step.
      Default is ``True``.
  init_on_first_step
      Whether the optimizer is initialized on the first step.
      Default is ``False``.
  trace_on_next_step
      Whether to trace the optimizer on the next step. Default is ``False``.
  fallback_to_non_traced
      Whether to fall back to non-traced forward call in the case that an error
      is raised during the traced forward pass. Default is ``True``.
  device
      Device on which to create the layer's variables 'cuda:0', 'cuda:1', 'cpu'
      etc. (Default value = None)
docstr_tok: ["Construct","a","general","Optimizer",".","This","is","an","abstract","class",",","and","must","be","derived",".","Parameters","--","--","--","--","--","lr","Learning","rate",".","inplace","Whether","to","update","the","variables","in-place",",","or","to","create","new","variable","handles",".","This","is","only","relevant","for","frameworks","with","stateful","variables","such","as","PyTorch",".","Default","is","``","True","``",",","provided","the","backend","framework","supports","it",".","stop_gradients","Whether","to","stop","the","gradients","of","the","variables","after","each","gradient","step",".","Default","is","``","True","``",".","init_on_first_step","Whether","the","optimizer","is","initialized","on","the","first","step",".","Default","is","``","False","``",".","trace_on_next_step","Whether","to","trace","the","optimizer","on","the","next","step",".","Default","is","``","False","``",".","fallback_to_non_traced","Whether","to","fall","back","to","non-traced","forward","call","in","the","case","that","an","error","is","raised","during","the","traced","forward","pass",".","Default","is","``","True","``",".","device","Device","on","which","to","create","the","layer","'s","variables","'cuda:0","'",",","'cuda:1","'",",","'cpu'","etc",".","(","Default","value","=","None",")"]
code: def __init__(
      self,
      lr: Union[float, Callable],
      inplace: bool = True,
      stop_gradients: bool = True,
      init_on_first_step: bool = False,
      trace_on_next_step: bool = False,
      fallback_to_non_traced: bool = False,
      device: Optional[Union[ivy.Device, ivy.NativeDevice]] = None,
  ):
      """Construct a general Optimizer. This is an abstract class, and must
      be derived.
  
      Parameters
      ----------
      lr
          Learning rate.
      inplace
          Whether to update the variables in-place, or to create new variable handles.
          This is only relevant for frameworks with stateful variables such as
          PyTorch.
          Default is ``True``, provided the backend framework supports it.
      stop_gradients
          Whether to stop the gradients of the variables after each gradient step.
          Default is ``True``.
      init_on_first_step
          Whether the optimizer is initialized on the first step.
          Default is ``False``.
      trace_on_next_step
          Whether to trace the optimizer on the next step. Default is ``False``.
      fallback_to_non_traced
          Whether to fall back to non-traced forward call in the case that an error
          is raised during the traced forward pass. Default is ``True``.
      device
          Device on which to create the layer's variables 'cuda:0', 'cuda:1', 'cpu'
          etc. (Default value = None)
      """
      self._lr = lr
      self._inplace = inplace
      self._stop_gradients = stop_gradients
      self._init_on_first_step = init_on_first_step
      self._initialized = not init_on_first_step
      self._trace_on_next_step = trace_on_next_step
      self._fallback_to_non_traced = fallback_to_non_traced
      self._dev = ivy.default(device, ivy.default_device())
      self._count = ivy.array([0], device=self._dev)
      self._traced_step_fn = None
      self._traced = False
  
imports: import abc
  from typing import Union, Optional, Callable
  import ivy
label_desc: Use image node_id 1 to create a new Optimizer object from inherited base classes: abc with example: obj = Optimizer(lr, inplace, stop_gradients, init_on_first_step, trace_on_next_step, fallback_to_non_traced, device)