class_docstr: BoltOn Optimizer tests.
class_docstr_tok: ["BoltOn","Optimizer","tests","."]
docstr: test that a fn of BoltOn optimizer is working as expected.
  
  Args:
    r: Radius value for StrongConvex loss function.
    shape: input_dimensionality
    n_out: output dimensionality
    init_value: the initial value for 'constant' kernel initializer
    result: the expected output after projection.
docstr_tok: ["test","that","a","fn","of","BoltOn","optimizer","is","working","as","expected",".","Args",":","r",":","Radius","value","for","StrongConvex","loss","function",".","shape",":","input_dimensionality","n_out",":","output","dimensionality","init_value",":","the","initial","value","for","'constant","'","kernel","initializer","result",":","the","expected","output","after","projection","."]
code: def test_project(self, r, shape, n_out, init_value, result):
      """test that a fn of BoltOn optimizer is working as expected.
  
      Args:
        r: Radius value for StrongConvex loss function.
        shape: input_dimensionality
        n_out: output dimensionality
        init_value: the initial value for 'constant' kernel initializer
        result: the expected output after projection.
      """
      tf.random.set_seed(1)
  
      def project_fn(r):
          loss = TestLoss(1, 1, r)
          bolton = opt.BoltOn(TestOptimizer(), loss)
          model = TestModel(n_out, shape, init_value)
          model.compile(bolton, loss)
          model.layers[0].kernel = model.layers[0].kernel_initializer(
              (model.layer_input_shape[0], model.n_outputs)
          )
          bolton._is_init = True  # pylint: disable=protected-access
          bolton.layers = model.layers
          bolton.epsilon = 2
          bolton.noise_distribution = "laplace"
          bolton.n_outputs = 1
          bolton.n_samples = 1
          bolton.project_weights_to_r()
          return _ops.convert_to_tensor_v2(
              bolton.layers[0].kernel, tf.float32
          )
  
      res = project_fn(r)
      self.assertAllClose(res, result)
  
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 2 for calling the BoltonOptimizerTest obj's underlying member method code with example usage: obj.test_project(r, shape, n_out, init_value, result) and returns: _ops