code: def testL2Regularization(self):
      # Define Loss(x) := ||x - a||_2**2, where a is a constant.
      # Set l1_regularizer = 0 and l2_regularizer = 1.
      # Then the regularized loss is
      #
      #     ||x - a||_2**2 + ||x||_2**2
      #
      # And the true optimum is x = 0.5 * a.
      n = 100
      np.random.seed(42)
      a_ = np.random.random(size=(n,))
      a = self._adjust_dtype_and_shape_hints(a_)
  
      def _grad_and_hessian_unregularized_loss_fn(x):
          grad = 2 * (x - a)
          hessian_outer = tf.eye(n, dtype=a.dtype)
          hessian_middle = 2.0 * tf.ones_like(a)
          return grad, hessian_outer, hessian_middle
  
      w, is_converged, num_iter = proximal_hessian_sparse.minimize(
          _grad_and_hessian_unregularized_loss_fn,
          x_start=tf.zeros_like(a_, dtype=self.dtype),
          l1_regularizer=0.0,
          l2_regularizer=1.0,
          maximum_iterations=4,
          maximum_full_sweeps_per_iteration=4,
          tolerance=1e-5,
          learning_rate=1.0,
      )
  
      w_, is_converged_, _ = self.evaluate([w, is_converged, num_iter])
  
      expected_w = 0.5 * a
      self.assertAllEqual(is_converged_, True)
      self.assertAllClose(w_, expected_w, atol=0.0, rtol=0.03)
  
imports: import numpy
  import tensorflow.compat.v1
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import test_util
  from tensorflow_probability.python.optimizer import proximal_hessian_sparse
label_desc: Use image node_id 7 for calling the _ProximalHessianTest obj's underlying member method code with example usage: obj.testL2Regularization() and returns: grad,  hessian_outer,  hessian_middle