class_docstr: Tests for get_gradient method.
  
  Since get_gradients must run in graph mode, the method is tested within
  the Estimator framework.
class_docstr_tok: ["Tests","for","get_gradient","method",".","Since","get_gradients","must","run","in","graph","mode",",","the","method","is","tested","within","the","Estimator","framework","."]
code: def testLargeBatchEmulationNoNoise(self):
      # Test for emulation of large batch training.
      # It tests that updates are only done every gradient_accumulation_steps
      # steps.
      # In this test we set noise multiplier to zero and clipping norm to high
      # value, such that optimizer essentially behave as non-DP optimizer.
      # This makes easier to check how values of variables are changing.
      #
      # This test optimizes loss var0*x + var1
      # Gradients of this loss are computed as:
      # d(loss)/d(var0) = x
      # d(loss)/d(var1) = 1
      var0 = tf.Variable([[1.0, 2.0]], dtype=tf.float32)
      var1 = tf.Variable([3.0], dtype=tf.float32)
      x1 = tf.constant([[2.0, 0.0], [0.0, 1.0]], dtype=tf.float32)
      loss1 = lambda: tf.matmul(var0, x1, transpose_b=True) + var1
      x2 = tf.constant([[4.0, 2.0], [2.0, 1.0]], dtype=tf.float32)
      loss2 = lambda: tf.matmul(var0, x2, transpose_b=True) + var1
  
      optimizer = dp_optimizer_keras.DPKerasSGDOptimizer(
          l2_norm_clip=100.0,
          noise_multiplier=0.0,
          gradient_accumulation_steps=2,
          learning_rate=1.0,
      )
  
      # before any call to optimizer
      self.assertAllCloseAccordingToType([[1.0, 2.0]], var0)
      self.assertAllCloseAccordingToType([3.0], var1)
  
      optimizer.minimize(loss1, [var0, var1])
      # After first call to optimizer values didn't change
      self.assertAllCloseAccordingToType([[1.0, 2.0]], var0)
      self.assertAllCloseAccordingToType([3.0], var1)
  
      optimizer.minimize(loss2, [var0, var1])
      # After second call to optimizer updates were applied
      self.assertAllCloseAccordingToType([[-1.0, 1.0]], var0)
      self.assertAllCloseAccordingToType([2.0], var1)
  
      optimizer.minimize(loss2, [var0, var1])
      # After third call to optimizer values didn't change
      self.assertAllCloseAccordingToType([[-1.0, 1.0]], var0)
      self.assertAllCloseAccordingToType([2.0], var1)
  
      optimizer.minimize(loss2, [var0, var1])
      # After fourth call to optimizer updates were applied again
      self.assertAllCloseAccordingToType([[-4.0, -0.5]], var0)
      self.assertAllCloseAccordingToType([1.0], var1)
  
imports: from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow import estimator
  from tensorflow_privacy.privacy.optimizers import dp_optimizer_keras
  from tensorflow_privacy.privacy.optimizers import dp_optimizer_keras_vectorized
label_desc: Use image node_id 6 for calling the DPOptimizerGetGradientsTest obj's underlying member method code with example usage: obj.testLargeBatchEmulationNoNoise() without return types