code: def test_get_model_state_iterator(self):
      device = "gpu" if torch.cuda.is_available() else "cpu"
      model = TestModel().to(device=self._map_device_string(device))
      decay = 0.5
      # test that we pick up the right parameters in the iterator
      for consider_bn_buffers in [True, False]:
          exponential_moving_average_hook = (
              ExponentialMovingAverageModelHook(
                  decay=decay,
                  consider_bn_buffers=consider_bn_buffers,
                  device=device,
              )
          )
          iterable = (
              exponential_moving_average_hook.get_model_state_iterator(
                  model
              )
          )
          fc_found = False
          bn_found = False
          bn_buffer_found = False
          for _, param in iterable:
              if any(param is item for item in model.fc.parameters()):
                  fc_found = True
              if any(param is item for item in model.bn.parameters()):
                  bn_found = True
              if any(param is item for item in model.bn.buffers()):
                  bn_buffer_found = True
          self.assertTrue(fc_found)
          self.assertTrue(bn_found)
          self.assertEqual(bn_buffer_found, consider_bn_buffers)
  
imports: import copy
  import math
  import unittest
  import unittest.mock
  import torch
  import torch.nn
  from classy_vision.hooks import ExponentialMovingAverageModelHook
  from classy_vision.models import ClassyModel
  from test.generic.hook_test_utils import HookTestBase
label_desc: Use image node_id 4 for calling the TestExponentialMovingAverageModelHook obj's underlying member method code with example usage: obj.test_get_model_state_iterator() without return types