class_docstr: Wrapper for fused forward and backward closures.
class_docstr_tok: ["Wrapper","for","fused","forward","and","backward","closures","."]
code: def __call__(
      self, **kwargs: Any
  ) -> Tuple[Tensor, Tuple[Optional[Tensor], ...]]:
      with self.context_manager():
          values = self.forward(**kwargs)
          value = (
              values if self.reducer is None else self.reducer(values)
          )
          self.backward(value)
  
          grads = tuple(
              param.grad for param in self.parameters.values()
          )
          if self.callback:
              self.callback(value, grads)
  
          return value, grads
  
file_path: botorch/botorch/optim/closures/core.py
imports: from __future__ import annotations
  from functools import partial
  from typing import Any, Callable, Dict, Optional, Sequence, Tuple
  import torch
  from botorch.optim.utils import _handle_numerical_errors, get_tensors_as_ndarray_1d, set_tensors_from_ndarray_1d
  from botorch.optim.utils.numpy_utils import as_ndarray
  from botorch.utils.context_managers import zero_grad_ctx
  from numpy import float64, full, ndarray, zeros
  from torch import Tensor
label_desc: Use image node_id 2 for calling the ForwardBackwardClosure obj's underlying member method code with example usage: obj.__call__() and returns: value,  grads