class_docstr: Mutates graphs in model to generate new model.
  
  By default, mutator simplifies to a single-value dict with its own label as key, and itself as value.
  At freeze, the strategy should provide a :class:`MutationSampler` in the dict.
  This is because the freezing of mutator is dynamic
  (i.e., requires a variational number of random numbers, dynamic ranges for each random number),
  and the :class:`MutationSampler` here can be considered as some random number generator
  to produce a random sequence based on the asks in :meth:`Mutator.mutate`.
  
  On the other hand, a subclass mutator should implement :meth:`Mutator.mutate`, which calls :meth:`Mutator.choice` inside,
  and :meth:`Mutator.choice` invokes the bounded sampler to "random" a choice.
  
  The label of the mutator in most cases is the label of the nodes on which the mutator is applied to.
  
  I imagine that mutating any model space (other than graph) might be useful,
  but we would postpone the support to when we actually need it.
class_docstr_tok: ["Mutates","graphs","in","model","to","generate","new","model",".","By","default",",","mutator","simplifies","to","a","single-value","dict","with","its","own","label","as","key",",","and","itself","as","value",".","At","freeze",",","the","strategy","should","provide","a",":","class",":","`","MutationSampler","`","in","the","dict",".","This","is","because","the","freezing","of","mutator","is","dynamic","(","i.e.",",","requires","a","variational","number","of","random","numbers",",","dynamic","ranges","for","each","random","number",")",",","and","the",":","class",":","`","MutationSampler","`","here","can","be","considered","as","some","random","number","generator","to","produce","a","random","sequence","based","on","the","asks","in",":","meth",":","`","Mutator.mutate","`",".","On","the","other","hand",",","a","subclass","mutator","should","implement",":","meth",":","`","Mutator.mutate","`",",","which","calls",":","meth",":","`","Mutator.choice","`","inside",",","and",":","meth",":","`","Mutator.choice","`","invokes","the","bounded","sampler","to","``","random","''","a","choice",".","The","label","of","the","mutator","in","most","cases","is","the","label","of","the","nodes","on","which","the","mutator","is","applied","to",".","I","imagine","that","mutating","any","model","space","(","other","than","graph",")","might","be","useful",",","but","we","would","postpone","the","support","to","when","we","actually","need","it","."]
docstr: Apply this mutator on a model.
  The model will be copied before mutation and the original model will not be modified.
  
  Returns
  -------
  The mutated model.
code: def apply(self, model: GraphModelSpace) -> GraphModelSpace:
      """
      Apply this mutator on a model.
      The model will be copied before mutation and the original model will not be modified.
  
      Returns
      -------
      The mutated model.
      """
      assert self.sampler is not None
      copy = model.fork()
      copy.status = ModelStatus.Mutating
      self._cur_model = copy
      self._cur_choice_idx = 0
      self._cur_samples = []
  
      # Some mutate() requires a full mutation history of the model.
      # Therefore, parent needs to be set before the mutation.
      copy.parent = Mutation(self, self._cur_samples, model, copy)
      self.sampler.mutation_start(self, copy)
      self.mutate(copy)
      self.sampler.mutation_end(self, copy)
      self._cur_model = None
      self._cur_choice_idx = None
      return copy
  
imports: from __future__ import annotations
  from contextlib import contextmanager
  from typing import Any, Callable, Iterable, List, Optional, TYPE_CHECKING, Iterator
  from numpy.random import RandomState
  from nni.mutable import LabeledMutable, MutableList, MutableDict, Categorical, Mutable, SampleValidationError, Sample, SampleMissingError, label_scope, auto_label, frozen_context
  from .space import ModelStatus
label_desc: Use image node_id 8 for calling the Mutator obj's underlying member method code with example usage: obj.apply(model) and returns: copy