code: def test_tf_lanczos_smallest_eigval(self):
      tf_num_iter = tf.placeholder(dtype=tf.int32, shape=())
      tf_matrix = tf.placeholder(dtype=tf.float32)
  
      def _vector_prod_fn(x):
          return tf.matmul(tf_matrix, tf.reshape(x, [-1, 1]))
  
      min_eigen_fn = autograph.to_graph(
          utils.tf_lanczos_smallest_eigval
      )
      init_vec_ph = tf.placeholder(
          shape=(MATRIX_DIMENTION, 1), dtype=tf.float32
      )
      tf_eigval, tf_eigvec = min_eigen_fn(
          _vector_prod_fn,
          MATRIX_DIMENTION,
          init_vec_ph,
          tf_num_iter,
          dtype=tf.float32,
      )
      eigvec = np.zeros((MATRIX_DIMENTION, 1), dtype=np.float32)
  
      with self.test_session() as sess:
          # run this test for a few random matrices
          for _ in range(NUM_RANDOM_MATRICES):
              matrix = np.random.random(
                  (MATRIX_DIMENTION, MATRIX_DIMENTION)
              )
              matrix = matrix + matrix.T  # symmetrizing matrix
              eigval, eigvec = sess.run(
                  [tf_eigval, tf_eigvec],
                  feed_dict={
                      tf_num_iter: NUM_LZS_ITERATIONS,
                      tf_matrix: matrix,
                      init_vec_ph: eigvec,
                  },
              )
  
              scipy_min_eigval, scipy_min_eigvec = eigs(
                  matrix, k=1, which="SR"
              )
              scipy_min_eigval = np.real(scipy_min_eigval)
              scipy_min_eigvec = np.real(scipy_min_eigvec)
              scipy_min_eigvec = scipy_min_eigvec / np.linalg.norm(
                  scipy_min_eigvec
              )
  
              np.testing.assert_almost_equal(
                  eigval, scipy_min_eigval, decimal=3
              )
              np.testing.assert_almost_equal(
                  np.linalg.norm(eigvec), 1.0, decimal=3
              )
              abs_dot_prod = abs(
                  np.dot(eigvec.flatten(), scipy_min_eigvec.flatten())
              )
              np.testing.assert_almost_equal(
                  abs_dot_prod, 1.0, decimal=3
              )
  
file_path: cleverhans/cleverhans/experimental/certification/tests/utils_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from scipy.sparse.linalg import eigs
  import tensorflow
  from tensorflow.contrib import autograph
  from cleverhans.experimental.certification import utils
label_desc: Use image node_id 2 for calling the UtilsTest obj's underlying member method code with example usage: obj.test_tf_lanczos_smallest_eigval() and returns: tf