code: def __call__(self, X):
      XY = X.dot(X.T)
      x2 = pt.sum(X**2, axis=1).dimshuffle(0, "x")
      X2e = pt.repeat(x2, X.shape[0], axis=1)
      H = X2e + X2e.T - 2.0 * XY
  
      V = pt.sort(H.flatten())
      length = V.shape[0]
      # median distance
      m = pt.switch(
          pt.eq((length % 2), 0),
          # if even vector
          pt.mean(V[((length // 2) - 1) : ((length // 2) + 1)]),
          # if odd vector
          V[length // 2],
      )
  
      h = 0.5 * m / pt.log(floatX(H.shape[0]) + floatX(1))
  
      #  RBF
      Kxy = pt.exp(-H / h / 2.0)
  
      # Derivative
      dxkxy = -pt.dot(Kxy, X)
      sumkxy = pt.sum(Kxy, axis=-1, keepdims=True)
      dxkxy = pt.add(dxkxy, pt.mul(X, sumkxy)) / h
  
      return Kxy, dxkxy
  
file_path: pymc/pymc/variational/test_functions.py
imports: from pytensor import tensor
  from pymc.pytensorf import floatX
  from pymc.variational.opvi import TestFunction
label_desc: Use image node_id 1 for calling the RBF obj's underlying member method code with example usage: obj.__call__(X) and returns: Kxy,  dxkxy