code: def __call__(self, x):
      neg_value = np.float64(self.logp_func(pm.floatX(x)))
      value = -1.0 * neg_value
      if self.use_gradient:
          neg_grad = self.dlogp_func(pm.floatX(x))
          if np.all(np.isfinite(neg_grad)):
              self.previous_x = x
          grad = -1.0 * neg_grad
          grad = grad.astype(np.float64)
      else:
          self.previous_x = x
          grad = None
  
      if self.n_eval % 10 == 0:
          self.update_progress_desc(neg_value, grad)
  
      if self.n_eval > self.maxeval:
          self.update_progress_desc(neg_value, grad)
          raise StopIteration
  
      self.n_eval += 1
      if self.progressbar:
          assert isinstance(self.progress, ProgressBar)
          self.progress.update_bar(self.n_eval)
  
      if self.use_gradient:
          return value, grad
      else:
          return value
  
imports: import sys
  import warnings
  from typing import Optional, Sequence
  import numpy
  import pytensor.gradient
  from fastprogress.fastprogress import ProgressBar, progress_bar
  from numpy import isfinite
  from pytensor import Variable
  from scipy.optimize import minimize
  import pymc
  from pymc.blocking import DictToArrayBijection, RaveledVars
  from pymc.initial_point import make_initial_point_fn
  from pymc.model import modelcontext
  from pymc.util import get_default_varnames, get_value_vars_from_user_vars
  from pymc.vartypes import discrete_types, typefilter
label_desc: Use image node_id 2 for calling the CostFuncWrapper obj's underlying member method code with example usage: obj.__call__(x) and returns: value,  grad, value