code: def object_from_json(
      # pyre-fixme[2]: Parameter annotation cannot be `Any`.
      object_json: Any,
      # pyre-fixme[24]: Generic type `type` expects 1 type parameter, use
      #  `typing.Type` to avoid runtime subscripting errors.
      decoder_registry: Dict[str, Type] = CORE_DECODER_REGISTRY,
      # pyre-fixme[2]: Parameter annotation cannot contain `Any`.
      class_decoder_registry: Dict[
          str, Callable[[Dict[str, Any]], Any]
      ] = CORE_CLASS_DECODER_REGISTRY,
  ) -> Any:
      """Recursively load objects from a JSON-serializable dictionary."""
      if type(object_json) in (
          str,
          int,
          float,
          bool,
          type(None),
      ) or isinstance(object_json, Enum):
          return object_json
      elif isinstance(object_json, list):
          return [
              object_from_json(
                  i,
                  decoder_registry=decoder_registry,
                  class_decoder_registry=class_decoder_registry,
              )
              for i in object_json
          ]
      elif isinstance(object_json, tuple):
          return tuple(
              object_from_json(
                  i,
                  decoder_registry=decoder_registry,
                  class_decoder_registry=class_decoder_registry,
              )
              for i in object_json
          )
      elif isinstance(object_json, dict):
          if "__type" not in object_json:
              # this is just a regular dictionary, e.g. the one in Parameter
              # containing parameterizations
              return {
                  k: object_from_json(
                      v,
                      decoder_registry=decoder_registry,
                      class_decoder_registry=class_decoder_registry,
                  )
                  for k, v in object_json.items()
              }
  
          _type = object_json.pop("__type")
  
          if _type == "datetime":
              return datetime.datetime.strptime(
                  object_json["value"], "%Y-%m-%d %H:%M:%S.%f"
              )
          elif _type == "OrderedDict":
              return OrderedDict(
                  [
                      (
                          k,
                          object_from_json(
                              v,
                              decoder_registry=decoder_registry,
                              class_decoder_registry=class_decoder_registry,
                          ),
                      )
                      for k, v in object_json["value"]
                  ]
              )
          elif _type == "DataFrame":
              # Need dtype=False, otherwise infers arm_names like "4_1"
              # should be int 41
              return pd.read_json(object_json["value"], dtype=False)
          elif _type == "ndarray":
              return np.array(object_json["value"])
          elif _type == "Tensor":
              return tensor_from_json(json=object_json)
          elif _type.startswith("torch"):
              # Torch types will be encoded as "torch_<type_name>", so we drop prefix
              return torch_type_from_str(
                  identifier=object_json["value"], type_name=_type[6:]
              )
  
          elif _type == "ListSurrogate":
              return surrogate_from_list_surrogate_json(
                  list_surrogate_json=object_json,
                  decoder_registry=decoder_registry,
                  class_decoder_registry=class_decoder_registry,
              )
          elif _type == "set":
              return set(object_json["value"])
          # Used for decoding classes (not objects).
          elif _type in class_decoder_registry:
              return class_decoder_registry[_type](object_json)
  
          elif _type not in decoder_registry:
              err = (
                  f"The JSON dictionary passed to `object_from_json` has a type "
                  f"{_type} that is not registered with a corresponding class in "
                  f"DECODER_REGISTRY."
              )
              raise JSONDecodeError(err)
  
          _class = decoder_registry[_type]
  
          if isclass(_class) and issubclass(_class, Enum):
              # to access enum members by name, use item access
              return _class[object_json["name"]]
          elif isclass(_class) and issubclass(_class, torch.nn.Module):
              return botorch_component_from_json(
                  botorch_class=_class, json=object_json
              )
          elif _class == GeneratorRun:
              return generator_run_from_json(
                  object_json=object_json,
                  decoder_registry=decoder_registry,
                  class_decoder_registry=class_decoder_registry,
              )
          elif _class == GenerationStep:
              return generation_step_from_json(
                  generation_step_json=object_json,
                  decoder_registry=decoder_registry,
                  class_decoder_registry=class_decoder_registry,
              )
          elif _class == GenerationNode:
              return generation_node_from_json(
                  generation_node_json=object_json,
                  decoder_registry=decoder_registry,
                  class_decoder_registry=class_decoder_registry,
              )
          elif _class == ModelSpec:
              return model_spec_from_json(
                  model_spec_json=object_json,
                  decoder_registry=decoder_registry,
                  class_decoder_registry=class_decoder_registry,
              )
          elif _class == GenerationStrategy:
              return generation_strategy_from_json(
                  generation_strategy_json=object_json,
                  decoder_registry=decoder_registry,
                  class_decoder_registry=class_decoder_registry,
              )
          elif _class == MultiTypeExperiment:
              return multi_type_experiment_from_json(
                  object_json=object_json,
                  decoder_registry=decoder_registry,
                  class_decoder_registry=class_decoder_registry,
              )
          elif _class == Experiment:
              return experiment_from_json(
                  object_json=object_json,
                  decoder_registry=decoder_registry,
                  class_decoder_registry=class_decoder_registry,
              )
          elif _class == SearchSpace:
              return search_space_from_json(
                  search_space_json=object_json,
                  decoder_registry=decoder_registry,
                  class_decoder_registry=class_decoder_registry,
              )
          elif _class == TorchvisionBenchmarkProblem:
              return TorchvisionBenchmarkProblem.from_dataset_name(
                  name=object_json["name"],
                  num_trials=object_json["num_trials"],
                  infer_noise=object_json["infer_noise"],
              )
          elif _class in (SurrogateSpec, Surrogate):
              if "input_transform" in object_json:
                  (
                      input_transform_classes_json,
                      input_transform_options_json,
                  ) = get_input_transform_json_components(
                      input_transforms_json=object_json.pop(
                          "input_transform"
                      ),
                      decoder_registry=decoder_registry,
                      class_decoder_registry=class_decoder_registry,
                  )
                  object_json[
                      "input_transform_classes"
                  ] = input_transform_classes_json
                  object_json[
                      "input_transform_options"
                  ] = input_transform_options_json
              if "outcome_transform" in object_json:
                  (
                      outcome_transform_classes_json,
                      outcome_transform_options_json,
                  ) = get_outcome_transform_json_components(
                      outcome_transforms_json=object_json.pop(
                          "outcome_transform"
                      ),
                      decoder_registry=decoder_registry,
                      class_decoder_registry=class_decoder_registry,
                  )
                  object_json[
                      "outcome_transform_classes"
                  ] = outcome_transform_classes_json
                  object_json[
                      "outcome_transform_options"
                  ] = outcome_transform_options_json
          elif isclass(_class) and issubclass(
              _class, SerializationMixin
          ):
              return _class(
                  **_class.deserialize_init_args(
                      args=object_json,
                      decoder_registry=decoder_registry,
                      class_decoder_registry=class_decoder_registry,
                  )
              )
  
          return ax_class_from_json_dict(
              _class=_class,
              object_json=object_json,
              decoder_registry=decoder_registry,
              class_decoder_registry=class_decoder_registry,
          )
      else:
          err = (
              f"The object {object_json} passed to `object_from_json` has an "
              f"unsupported type: {type(object_json)}."
          )
          raise JSONDecodeError(err)
  
imports: import datetime
  from collections import OrderedDict
  from enum import Enum
  from inspect import isclass
  from logging import Logger
  from typing import Any, Callable, Dict, List, Optional, Tuple, Type
  import numpy
  import pandas
  import torch
  from ax.benchmark.problems.hpo.torchvision import PyTorchCNNTorchvisionBenchmarkProblem
  from ax.core.base_trial import BaseTrial
  from ax.core.data import Data
  from ax.core.experiment import Experiment
  from ax.core.generator_run import GeneratorRun
  from ax.core.multi_type_experiment import MultiTypeExperiment
  from ax.core.parameter import Parameter
  from ax.core.parameter_constraint import OrderConstraint, ParameterConstraint, SumConstraint
  from ax.core.search_space import SearchSpace
  from ax.exceptions.storage import JSONDecodeError
  from ax.modelbridge.generation_strategy import GenerationNode, GenerationStep, GenerationStrategy
  from ax.modelbridge.model_spec import ModelSpec
  from ax.modelbridge.registry import _decode_callables_from_references
  from ax.modelbridge.transition_criterion import MaxGenerationParallelism, MaxTrials, MinimumPreferenceOccurances, MinimumTrialsInStatus, MinTrials, TransitionCriterion
  from ax.models.torch.botorch_modular.model import SurrogateSpec
  from ax.models.torch.botorch_modular.surrogate import Surrogate
  from ax.storage.json_store.decoders import batch_trial_from_json, botorch_component_from_json, tensor_from_json, trial_from_json
  from ax.storage.json_store.registry import CORE_CLASS_DECODER_REGISTRY, CORE_DECODER_REGISTRY
  from ax.utils.common.logger import get_logger
  from ax.utils.common.serialization import SerializationMixin
  from ax.utils.common.typeutils import checked_cast, not_none
  from ax.utils.common.typeutils_torch import torch_type_from_str
label_desc: Use image node_id 1 for calling a global function with example usage: object_from_json(object_json, decoder_registry, class_decoder_registry) and returns: object_json, unknown, tuple, ax_class_from_json_dict, unknown, datetime, _class, OrderedDict, botorch_component_from_json, pd, generator_run_from_json, np, generation_step_from_json, tensor_from_json, generation_node_from_json, torch_type_from_str, model_spec_from_json, surrogate_from_list_surrogate_json, generation_strategy_from_json, set, multi_type_experiment_from_json, class_decoder_registry, experiment_from_json, search_space_from_json, TorchvisionBenchmarkProblem, _class