code: def test_respects_trainable_variables(self):
      # Variables not included in `trainable_variables` should stay fixed.
      x = tf.Variable(5.0)
      y = tf.Variable(2.0)
      loss_fn = lambda: tf.reduce_sum((x - y) ** 2)
  
      loss = minimize(
          loss_fn,
          num_steps=100,
          optimizer=_get_adam_optimizer(0.1),
          trainable_variables=[x],
      )
      with tf.control_dependencies([loss]):
          final_x = tf.identity(x)
          final_y = tf.identity(y)
  
      self.evaluate(tf1.global_variables_initializer())
      final_x_, final_y_ = self.evaluate((final_x, final_y))
      self.assertAllClose(final_x_, 2, atol=0.1)
      self.assertEqual(final_y_, 2.0)
  
imports: import collections
  import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python import optimizer
  from tensorflow_probability.python.distributions import normal
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.internal import tf_keras
  from tensorflow_probability.python.math.minimize import minimize
  from tensorflow_probability.python.math.minimize import minimize_stateless
label_desc: Use image node_id 3 for calling the MinimizeTests obj's underlying member method code with example usage: obj.test_respects_trainable_variables() without return types