class_docstr: Abstract base class for optimizer closures in Lightning.
  
  Formally, a closure is binding variables from an external scope to a function that does a computation on these
  variables without taking them explicitly as input. This has the benefit that a closure can be passed to an object
  which later can call it like a function but without requiring to pass in any arguments.
  
  This class provides a simple abstraction making the instance of this class callable like a function while capturing
  the closure result and caching it.
class_docstr_tok: ["Abstract","base","class","for","optimizer","closures","in","Lightning",".","Formally",",","a","closure","is","binding","variables","from","an","external","scope","to","a","function","that","does","a","computation","on","these","variables","without","taking","them","explicitly","as","input",".","This","has","the","benefit","that","a","closure","can","be","passed","to","an","object","which","later","can","call","it","like","a","function","but","without","requiring","to","pass","in","any","arguments",".","This","class","provides","a","simple","abstraction","making","the","instance","of","this","class","callable","like","a","function","while","capturing","the","closure","result","and","caching","it","."]
code: def __init__(self) -> None:
      super().__init__()
      self._result: Optional[T] = None
  
file_path: pytorch-lightning/src/lightning/pytorch/loops/optimization/closure.py
imports: from abc import ABC, abstractmethod
  from dataclasses import dataclass
  from typing import Any, Dict, Generic, Optional, TypeVar
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
label_desc: Use image node_id 1 to create a new AbstractClosure object from inherited base classes: ABC, Generic with example: obj = AbstractClosure()