class_docstr: A special kind of evaluator that does not run real training, but queries a database.
docstr: Validate the search space. Raise exception if invalid. Returns the validated space.
  
  By default, it will cross-check with the :meth:`default_space`, and return the default space.
  Differences in common scope names will be ignored.
  
  I think the default implementation should work for most cases.
  But subclass can still override this method for looser or tighter validation.
docstr_tok: ["Validate","the","search","space",".","Raise","exception","if","invalid",".","Returns","the","validated","space",".","By","default",",","it","will","cross-check","with","the",":","meth",":","`","default_space","`",",","and","return","the","default","space",".","Differences","in","common","scope","names","will","be","ignored",".","I","think","the","default","implementation","should","work","for","most","cases",".","But","subclass","can","still","override","this","method","for","looser","or","tighter","validation","."]
code: def validate_space(self, space: Mutable) -> dict[str, LabeledMutable]:
      """Validate the search space. Raise exception if invalid. Returns the validated space.
  
      By default, it will cross-check with the :meth:`default_space`, and return the default space.
      Differences in common scope names will be ignored.
  
      I think the default implementation should work for most cases.
      But subclass can still override this method for looser or tighter validation.
      """
      current_space = space.simplify()
  
      scope_name = _common_label_scope(list(current_space))
      if not scope_name:
          default_space = self.default_space()
      else:
          with label_scope(scope_name.rstrip("/")):
              default_space = self.default_space()
  
      if SlimBenchmarkSpace(current_space) != default_space:
          raise ValueError(
              f"Expect space to be {default_space}, got {current_space}"
          )
  
      return current_space
  
imports: from __future__ import annotations
  import itertools
  import logging
  import random
  import warnings
  from typing import Any, cast
  import nni
  from nni.mutable import Sample, Mutable, LabeledMutable, Categorical, CategoricalMultiple, label_scope
  from nni.nas.evaluator import Evaluator
  from nni.nas.space import ExecutableModelSpace
  from .space import SlimBenchmarkSpace
label_desc: Use image node_id 2 for calling the BenchmarkEvaluator obj's underlying member method code with example usage: obj.validate_space(space) and returns: current_space