code: def set_attribute(obj, attr: str, val):
      """Like `setattr` but works with hierarchical attribute specification.
      E.g. if obj=Zoo(), and attr="tiger.age", set_attribute(obj, attr, 3),
      would set the Zoo's tiger's age to three.
      """
      path_to_leaf, _, attr_name = attr.rpartition(".")
      leaf = get_attribute(obj, path_to_leaf) if path_to_leaf else obj
      setattr(leaf, attr_name, val)
  
imports: from __future__ import annotations
  from copy import deepcopy
  from typing import Dict, Optional, Set, Tuple
  import torch
  from botorch.exceptions import UnsupportedError
  from botorch.models.gp_regression import HeteroskedasticSingleTaskGP
  from botorch.models.gp_regression_fidelity import SingleTaskMultiFidelityGP
  from botorch.models.gp_regression_mixed import MixedSingleTaskGP
  from botorch.models.gpytorch import BatchedMultiOutputGPyTorchModel
  from botorch.models.model_list_gp_regression import ModelListGP
  from botorch.models.transforms.input import InputTransform
  from botorch.models.transforms.outcome import OutcomeTransform
  from gpytorch.likelihoods.gaussian_likelihood import FixedNoiseGaussianLikelihood
  from torch import Tensor
  from torch.nn import Module
label_desc: Use image node_id 5 for calling a global function with example usage: set_attribute(obj, attr, val) without return types