code: def test_fixed_rank_BotorchModel(
      self, dtype: torch.dtype = torch.float, cuda: bool = False
  ) -> None:
      (
          Xs1,
          Ys1,
          Yvars1,
          bounds,
          _,
          feature_names,
          metric_names,
      ) = get_torch_test_data(
          dtype=dtype, cuda=cuda, constant_noise=True
      )
      Xs2, Ys2, Yvars2, _, _, _, _ = get_torch_test_data(
          dtype=dtype, cuda=cuda, constant_noise=True
      )
      model = BotorchModel(multitask_gp_ranks={"y": 2, "w": 1})
      datasets = [
          SupervisedDataset(
              X=Xs1[0],
              Y=Ys1[0],
              Yvar=Yvars1[0],
              feature_names=feature_names,
              outcome_names=metric_names,
          ),
          SupervisedDataset(
              X=Xs2[0],
              Y=Ys2[0],
              Yvar=Yvars2[0],
              feature_names=feature_names,
              outcome_names=metric_names,
          ),
      ]
      with self.assertRaisesRegex(
          RuntimeError, "Please fit the model first"
      ):
          model.model
  
      with self.assertRaisesRegex(
          RuntimeError, "Please fit the model first"
      ):
          model.search_space_digest
  
      search_space_digest = SearchSpaceDigest(
          feature_names=feature_names,
          bounds=bounds,
          task_features=[0],
      )
      with self.assertRaisesRegex(
          RuntimeError, "manually is disallowed"
      ):
          model.search_space_digest = search_space_digest
  
      with mock.patch(FIT_MODEL_MO_PATH) as _mock_fit_model:
          model.fit(
              datasets=datasets,
              metric_names=["y", "w"],
              search_space_digest=search_space_digest,
          )
          self.assertTrue(
              isinstance(model.search_space_digest, SearchSpaceDigest)
          )
          self.assertEqual(
              model.search_space_digest, search_space_digest
          )
          _mock_fit_model.assert_called_once()
  
      model.model = model.model  # property assignment isn't blocked
      # Check ranks
      model_list = cast(ModelListGP, model.model).models
      self.assertEqual(model_list[0]._rank, 2)
      self.assertEqual(model_list[1]._rank, 1)
  
imports: import dataclasses
  from itertools import chain, product
  from typing import Any, cast, Dict
  from unittest import mock
  import numpy
  import torch
  from ax.core.search_space import SearchSpaceDigest
  from ax.exceptions.core import DataRequiredError
  from ax.models.torch.botorch import BotorchModel, get_feature_importances_from_botorch_model, get_rounding_func
  from ax.models.torch.botorch_defaults import get_and_fit_model, get_chebyshev_scalarization, recommend_best_out_of_sample_point
  from ax.models.torch.utils import sample_simplex
  from ax.models.torch_base import TorchOptConfig
  from ax.utils.common.testutils import TestCase
  from ax.utils.testing.mock import fast_botorch_optimize
  from ax.utils.testing.torch_stubs import get_torch_test_data
  from botorch.acquisition.utils import get_infeasible_cost
  from botorch.models import ModelListGP, SingleTaskGP
  from botorch.models.transforms.input import Warp
  from botorch.utils.datasets import SupervisedDataset
  from botorch.utils.objective import get_objective_weights_transform
  from gpytorch.likelihoods import _GaussianLikelihoodBase
  from gpytorch.likelihoods.gaussian_likelihood import FixedNoiseGaussianLikelihood
  from gpytorch.mlls import ExactMarginalLogLikelihood, LeaveOneOutPseudoLikelihood
  from gpytorch.priors import GammaPrior
  from gpytorch.priors.lkj_prior import LKJCovariancePrior
label_desc: Use image node_id 1 for calling the BotorchModelTest obj's underlying member method code with example usage: obj.test_fixed_rank_BotorchModel(dtype, cuda) without return types