class_docstr: Tests clip_and_aggreate_gradients.
docstr: Tests target gets vectorized regardless of their original shape.
docstr_tok: ["Tests","target","gets","vectorized","regardless","of","their","original","shape","."]
code: def testTargetShape(self, n, keepdims):
      """Tests target gets vectorized regardless of their original shape."""
      true_grads = self._get_true_grads(n)
  
      with tf.GradientTape() as tape:
          loss, test_vars = self._get_loss_and_vars(n, keepdims)
          results = cag.clip_and_aggregate_gradients(
              tape, loss, test_vars
          )
      for r, t in zip(results, true_grads):
          if t is None:
              self.assertIsNone(r)
          else:
              r = self._to_dense_array(r)
              self.assertAllCloseAccordingToType(r, t)
  
file_path: privacy/tensorflow_privacy/privacy/optimizers/clip_and_aggregate_gradients_test.py
imports: from absl.testing import parameterized
  import numpy
  import tensorflow
  from tensorflow_privacy.privacy.optimizers import clip_and_aggregate_gradients
label_desc: Use image node_id 6 for calling the ClipAndAggregateGradientsTest obj's underlying member method code with example usage: obj.testTargetShape(n, keepdims) without return types