class_docstr: Set of common testing utils. It is meant to be subclassed by your test.
  See other tests as an example of how this is done.
code: def check_shapes(
      self,
      microbatch_grad_samples,
      opacus_grad_samples,
      loss_reduction,
  ) -> None:
      failed = []
      for name, opacus_grad_sample in opacus_grad_samples.items():
          microbatch_grad_sample = microbatch_grad_samples[name]
          msg = (
              f"Param '{name}': "
              f"from Opacus: {opacus_grad_sample.shape}, "
              f"from Microbatch: {microbatch_grad_sample.shape}. "
          )
          try:
              self.assertEqual(
                  opacus_grad_sample.shape,
                  microbatch_grad_sample.shape,
                  msg=msg,
              )
  
          except AssertionError:
              failed.append(msg)
  
      if failed:
          failed_str = "\n\t".join(
              f"{i}. {s}" for i, s in enumerate(failed, 1)
          )
          raise AssertionError(
              f"A total of {len(failed)} shapes do not match "
              f"for loss_reduction={loss_reduction}: \n\t{failed_str}"
          )
  
file_path: opacus/opacus/tests/grad_samples/common.py
imports: import unittest
  from typing import Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from opacus.utils.per_sample_gradients_utils import compute_grad_samples_microbatch_and_opacus, compute_opacus_grad_sample, is_batch_empty
  from torch.nn.utils.rnn import PackedSequence
  from torch.testing import assert_close
label_desc: Use image node_id 3 for calling the GradSampleHooks_test obj's underlying member method code with example usage: obj.check_shapes(microbatch_grad_samples, opacus_grad_samples, loss_reduction) without return types