class_docstr: Helper class for construction loss and updates for variational inference
  
  Parameters
  ----------
  op: :class:`KSD`
      OPVI Functional operator
  tf: :class:`TestFunction`
      OPVI TestFunction
class_docstr_tok: ["Helper","class","for","construction","loss","and","updates","for","variational","inference","Parameters","--","--","--","--","--","op",":",":","class",":","`","KSD","`","OPVI","Functional","operator","tf",":",":","class",":","`","TestFunction","`","OPVI","TestFunction"]
code: def __call__(self, nmc, **kwargs) -> list[Variable]:
      op: KSD = self.op
      grad = op.apply(self.tf)
      if self.approx.all_histograms:
          z = self.approx.joint_histogram
      else:
          z = self.approx.symbolic_random
      if "more_obj_params" in kwargs:
          params = self.obj_params + kwargs["more_obj_params"]
      else:
          params = self.test_params + kwargs["more_tf_params"]
          grad *= pm.floatX(-1)
      grads = pytensor.grad(None, params, known_grads={z: grad})
      return self.approx.set_size_and_deterministic(
          grads, nmc, 0, kwargs.get("more_replacements")
      )
  
file_path: pymc/pymc/variational/operators.py
imports: from __future__ import annotations
  import pytensor
  from pytensor.graph.basic import Variable
  import pymc
  from pymc.variational import opvi
  from pymc.variational.opvi import NotImplementedInference, ObjectiveFunction, Operator, _known_scan_ignored_inputs
  from pymc.variational.stein import Stein
label_desc: Use image node_id 2 for calling the KSDObjective obj's underlying member method code with example usage: obj.__call__(nmc) and returns: self