code: def class_test(self, data, classes, x_sizes):
      summarizer = ClassSummarizer(stats=CommonStats())
      for x, y in data:
          summarizer.update(x, y)
  
      summ = summarizer.summary
      self.assertIsNotNone(summ)
      self.assertIsInstance(summ, list)
      for s, size in zip(summ, x_sizes):
          self.assertIsInstance(s, dict)
          for key in s:
              self.assertEqual(s[key].size(), size)
  
      self.assertIsNotNone(summarizer.class_summaries)
      all_classes = torch.zeros(len(classes))
      class_summaries = summarizer.class_summaries
      all_keys = set(class_summaries.keys())
      for i, clazz in enumerate(classes):
          self.assertTrue(clazz in class_summaries)
          all_keys.remove(clazz)
          all_classes[i] = 1
  
          summ = class_summaries[clazz]
          self.assertIsNotNone(summ)
          self.assertIsInstance(summ, list)
  
          for s, size in zip(summ, x_sizes):
              self.assertIsInstance(s, dict)
              for key in s:
                  self.assertEqual(s[key].size(), size)
  
      self.assertEqual(len(all_keys), 0)
      self.assertEqual(all_classes.sum(), len(classes))
  
file_path: captum/tests/attr/test_class_summarizer.py
imports: import torch
  from captum.attr import ClassSummarizer, CommonStats
  from tests.helpers.basic import BaseTest
label_desc: Use image node_id 1 for calling the Test obj's underlying member method code with example usage: obj.class_test(data, classes, x_sizes) without return types