class_docstr: Traverse the search space and try all the possible combinations one by one.
  
  Parameters
  ----------
  shuffle
      Shuffle the order in a candidate list, so that they are tried in a random order.
      Currently, the implementation is a pseudo-random shuffle, which only shuffles the order of every 100 candidates.
  seed
      Random seed.
class_docstr_tok: ["Traverse","the","search","space","and","try","all","the","possible","combinations","one","by","one",".","Parameters","--","--","--","--","--","shuffle","Shuffle","the","order","in","a","candidate","list",",","so","that","they","are","tried","in","a","random","order",".","Currently",",","the","implementation","is","a","pseudo-random","shuffle",",","which","only","shuffles","the","order","of","every","100","candidates",".","seed","Random","seed","."]
code: def _grid_generator(
      self, model_space: ExecutableModelSpace
  ) -> Iterator[ExecutableModelSpace]:
      if self._no_sample_found_counter >= self._granularity_patience:
          _logger.info(
              "Patience already run out (%d > %d). Nothing to search.",
              self._no_sample_found_counter,
              self._granularity_patience,
          )
          return
  
      finite = self._space_validation(model_space)
  
      while True:
          new_sample_found = False
          for model in model_space.grid(granularity=self._granularity):
              if self._dedup is not None and not self._dedup.dedup(
                  model.sample
              ):
                  continue
  
              new_sample_found = True
              yield model
  
          if not new_sample_found:
              self._no_sample_found_counter += 1
              _logger.info(
                  "No new sample found when granularity is %d. Current patience: %d.",
                  self._granularity,
                  self._no_sample_found_counter,
              )
              if (
                  self._no_sample_found_counter
                  >= self._granularity_patience
              ):
                  _logger.info(
                      "No new sample found for %d times. Stop increasing granularity.",
                      self._granularity_patience,
                  )
                  break
          else:
              self._no_sample_found_counter = 0
  
          if finite:
              _logger.info(
                  "Space is finite. Grid generation is complete."
              )
              break
  
          self._granularity += 1
          _logger.info(
              "Space is infinite. Increasing granularity to %d.",
              self._granularity,
          )
  
imports: from __future__ import annotations
  import logging
  import warnings
  from typing import Iterator, Any
  from numpy.random import RandomState
  from nni.mutable import Sample
  from nni.nas.space import ExecutableModelSpace
  from .base import Strategy
  from .utils import DeduplicationHelper, RetrySamplingHelper
label_desc: Use image node_id 3 for calling the GridSearch obj's underlying member method code with example usage: obj._grid_generator(model_space) without return types