class_docstr: BoltOn Optimizer tests.
class_docstr_tok: ["BoltOn","Optimizer","tests","."]
docstr: Tests the context manager functionality of the optimizer.
  
  Args:
    noise: noise distribution to pick
    epsilon: epsilon privacy parameter to use
    class_weights: class_weights to use
docstr_tok: ["Tests","the","context","manager","functionality","of","the","optimizer",".","Args",":","noise",":","noise","distribution","to","pick","epsilon",":","epsilon","privacy","parameter","to","use","class_weights",":","class_weights","to","use"]
code: def test_context_manager(self, noise, epsilon, class_weights):
      """Tests the context manager functionality of the optimizer.
  
      Args:
        noise: noise distribution to pick
        epsilon: epsilon privacy parameter to use
        class_weights: class_weights to use
      """
  
      @tf.function
      def test_run():
          loss = TestLoss(1, 1, 1)
          bolton = opt.BoltOn(TestOptimizer(), loss)
          model = TestModel(1, (1,), 1)
          model.compile(bolton, loss)
          model.layers[0].kernel = model.layers[0].kernel_initializer(
              (model.layer_input_shape[0], model.n_outputs)
          )
          with bolton(
              noise, epsilon, model.layers, class_weights, 1, 1
          ) as _:
              pass
          return _ops.convert_to_tensor_v2(
              bolton.epsilon, dtype=tf.float32
          )
  
      epsilon = test_run()
      self.assertEqual(epsilon.numpy(), -1)
  
imports: import unittest
  from absl.testing import parameterized
  import tensorflow.compat.v1
  from tensorflow.compat.v1.python import ops
  from tensorflow.compat.v1.python.framework import test_util
  from tensorflow.compat.v1.python.keras import keras_parameterized
  from tensorflow.compat.v1.python.keras import losses
  from tensorflow.compat.v1.python.keras.initializers import constant
  from tensorflow.compat.v1.python.keras.models import Model
  from tensorflow.compat.v1.python.keras.optimizer_v2.optimizer_v2 import OptimizerV2
  from tensorflow.compat.v1.python.keras.regularizers import L1L2
  from tensorflow.compat.v1.python.platform import test
  from tensorflow_privacy.privacy.bolt_on import optimizers
  from tensorflow_privacy.privacy.bolt_on.losses import StrongConvexMixin
label_desc: Use image node_id 3 for calling the BoltonOptimizerTest obj's underlying member method code with example usage: obj.test_context_manager(noise, epsilon, class_weights) and returns: _ops