class_docstr: Evaluators with tunable parameters by itself (e.g., learning rate).
  
  The tunable parameters must be an argument of the evaluator's instantiation,
  or an argument of the arguments' instantiation and etc.
  
  To use this feature, there are two requirements:
  
  1. The evaluator must inherit :class:`MutableEvaluator` rather than :class:`Evaluator`.
  2. Make sure the init arguments have been saved in ``trace_kwargs``,
     and the instance can be cloned with ``trace_copy``.
     The easiest way is to wrap the evaluator with :func:`nni.trace`.
     If the mutable parameter exists somewhere in the nested instantiation.
     All the levels must all be wrapped with :func:`nni.trace`.
  
  Examples
  --------
  >>> def get_data(shuffle): ...
  ...
  >>> @nni.trace                                  # 1. must wrap here
  ... class MyOwnEvaluator(MutableEvaluator):     # 2. must inherit MutableEvaluator
  ...     def __init__(self, lr, data): ...
  ...
  >>> evaluator = MyOwnEvaluator(
  ...     lr=Categorical([0.1, 0.01]),      # the argument can be tunable
  ...     data=nni.trace(get_data)(         # if there is mutable parameters inside, this must also have nni.trace
  ...         shuffle=Categorical([False, True])
  ...     )
  ... )
  >>> evaluator.simplify()
  {'global/1': Categorical([0.1, 0.01], label='global/1'), 'global/2': Categorical([False, True], label='global/2')}
class_docstr_tok: ["Evaluators","with","tunable","parameters","by","itself","(","e.g.",",","learning","rate",")",".","The","tunable","parameters","must","be","an","argument","of","the","evaluator","'s","instantiation",",","or","an","argument","of","the","arguments","'","instantiation","and","etc",".","To","use","this","feature",",","there","are","two","requirements",":","1",".","The","evaluator","must","inherit",":","class",":","`","MutableEvaluator","`","rather","than",":","class",":","`","Evaluator","`",".","2",".","Make","sure","the","init","arguments","have","been","saved","in","``","trace_kwargs","``",",","and","the","instance","can","be","cloned","with","``","trace_copy","``",".","The","easiest","way","is","to","wrap","the","evaluator","with",":","func",":","`","nni.trace","`",".","If","the","mutable","parameter","exists","somewhere","in","the","nested","instantiation",".","All","the","levels","must","all","be","wrapped","with",":","func",":","`","nni.trace","`",".","Examples","--","--","--","--",">",">",">","def","get_data","(","shuffle",")",":","...","...",">",">",">","@","nni.trace","#","1.","must","wrap","here","...","class","MyOwnEvaluator","(","MutableEvaluator",")",":","#","2.","must","inherit","MutableEvaluator","...","def","__init__","(","self",",","lr",",","data",")",":","...","...",">",">",">","evaluator","=","MyOwnEvaluator","(","...","lr=Categorical","(","[","0.1",",","0.01","]",")",",","#","the","argument","can","be","tunable","...","data=nni.trace","(","get_data",")","(","#","if","there","is","mutable","parameters","inside",",","this","must","also","have","nni.trace","...","shuffle=Categorical","(","[","False",",","True","]",")","...",")","...",")",">",">",">","evaluator.simplify","(",")","{","'global\/1","'",":","Categorical","(","[","0.1",",","0.01","]",",","label='global\/1","'",")",",","'global\/2","'",":","Categorical","(","[","False",",","True","]",",","label='global\/2","'",")","}"]
code: def leaf_mutables(
      self, is_leaf: Callable[[Mutable], bool]
  ) -> Iterable[LabeledMutable]:
      for param in self.expand_trace_kwargs(self):
          yield from param.leaf_mutables(is_leaf)
  
imports: from __future__ import annotations
  import logging
  from contextlib import contextmanager
  from typing import Any, Callable, Iterator, Iterable, Generator, TYPE_CHECKING, cast
  from typing_extensions import Literal
  import nni
  from nni.common.serializer import is_traceable, SerializableObject
  from nni.mutable import Mutable, Sample, LabeledMutable, SampleValidationError
  from nni.mutable.mutable import _mutable_equal
  from nni.runtime.trial_command_channel import TrialCommandChannel, set_default_trial_command_channel, get_default_trial_command_channel
  from nni.typehint import ParameterRecord, TrialMetric, Parameters
label_desc: Use image node_id 4 for calling the MutableEvaluator obj's underlying member method code with example usage: obj.leaf_mutables(is_leaf) without return types