code: def test_AffineDeterministicModel(self):
      # test error on bad shape of a
      with self.assertRaises(ValueError):
          AffineDeterministicModel(torch.rand(2))
      # test error on bad shape of b
      with self.assertRaises(ValueError):
          AffineDeterministicModel(torch.rand(2, 1), torch.rand(2, 1))
      # test one-dim output
      a = torch.rand(3, 1)
      model = AffineDeterministicModel(a)
      self.assertEqual(model.num_outputs, 1)
      for shape in ((4, 3), (1, 4, 3)):
          X = torch.rand(*shape)
          p = model.posterior(X)
          mean_exp = model.b + (X.unsqueeze(-1) * a).sum(dim=-2)
          self.assertAllClose(p.mean, mean_exp)
      # # test two-dim output
      a = torch.rand(3, 2)
      model = AffineDeterministicModel(a)
      self.assertEqual(model.num_outputs, 2)
      for shape in ((4, 3), (1, 4, 3)):
          X = torch.rand(*shape)
          p = model.posterior(X)
          mean_exp = model.b + (X.unsqueeze(-1) * a).sum(dim=-2)
          self.assertAllClose(p.mean, mean_exp)
      # test subset output
      X = torch.rand(4, 3)
      subset_model = model.subset_output([0])
      self.assertIsInstance(subset_model, AffineDeterministicModel)
      p = model.posterior(X)
      p_sub = subset_model.posterior(X)
      self.assertTrue(torch.equal(p_sub.mean, p.mean[..., [0]]))
  
imports: import warnings
  import torch
  from botorch.acquisition.objective import ScalarizedPosteriorTransform
  from botorch.exceptions.errors import UnsupportedError
  from botorch.models.deterministic import AffineDeterministicModel, DeterministicModel, FixedSingleSampleModel, GenericDeterministicModel, PosteriorMeanModel
  from botorch.models.gp_regression import SingleTaskGP
  from botorch.models.transforms.input import Normalize
  from botorch.models.transforms.outcome import Standardize
  from botorch.posteriors.ensemble import EnsemblePosterior
  from botorch.utils.testing import BotorchTestCase
label_desc: Use image node_id 3 for calling the TestDeterministicModels obj's underlying member method code with example usage: obj.test_AffineDeterministicModel() without return types