code: def testGradWrtRef(self):
      if tf.executing_eagerly():
          return
  
      for dtype in [tf.half, tf.float32, tf.float64]:
          with self.cached_session():
              opt = sgld.StochasticGradientLangevinDynamics(3.0)
              values = [1.0, 3.0]
              vars_ = [tf.Variable([v], dtype=dtype) for v in values]
              loss = (
                  lambda: vars_[0] + vars_[1]
              )  # pylint: disable=cell-var-from-loop
              grads_and_vars = opt._compute_gradients(loss, vars_)
              self.evaluate(tf1.global_variables_initializer())
              for grad, _ in grads_and_vars:
                  self.assertAllCloseAccordingToType(
                      [1.0], self.evaluate(grad)
                  )
  
file_path: probability/tensorflow_probability/python/optimizer/sgld_test.py
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.distributions import mvn_tril
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.math.diag_jacobian import diag_jacobian
  from tensorflow_probability.python.optimizer import sgld
  from tensorflow.python.framework import test_util
label_desc: Use image node_id 4 for calling the StochasticGradientLangevinDynamicsOptimizerTest obj's underlying member method code with example usage: obj.testGradWrtRef() without return types