code: def test_roundtrip(self):
      for dtype in (torch.float, torch.double):
          train_X = torch.rand(10, 2, device=self.device, dtype=dtype)
          train_Y1 = train_X.sum(dim=-1)
          train_Y2 = train_X[:, 0] - train_X[:, 1]
          train_Y = torch.stack([train_Y1, train_Y2], dim=-1)
          # SingleTaskGP
          batch_gp = SingleTaskGP(train_X, train_Y)
          list_gp = batched_to_model_list(batch_gp)
          batch_gp_recov = model_list_to_batched(list_gp)
          sd_orig = batch_gp.state_dict()
          sd_recov = batch_gp_recov.state_dict()
          self.assertTrue(set(sd_orig) == set(sd_recov))
          self.assertTrue(
              all(torch.equal(sd_orig[k], sd_recov[k]) for k in sd_orig)
          )
          # Observed noise
          batch_gp = SingleTaskGP(
              train_X, train_Y, torch.rand_like(train_Y)
          )
          list_gp = batched_to_model_list(batch_gp)
          batch_gp_recov = model_list_to_batched(list_gp)
          sd_orig = batch_gp.state_dict()
          sd_recov = batch_gp_recov.state_dict()
          self.assertTrue(set(sd_orig) == set(sd_recov))
          self.assertTrue(
              all(torch.equal(sd_orig[k], sd_recov[k]) for k in sd_orig)
          )
          # SingleTaskMultiFidelityGP
          for lin_trunc in (False, True):
              batch_gp = SingleTaskMultiFidelityGP(
                  train_X,
                  train_Y,
                  iteration_fidelity=1,
                  linear_truncated=lin_trunc,
              )
              list_gp = batched_to_model_list(batch_gp)
              batch_gp_recov = model_list_to_batched(list_gp)
              sd_orig = batch_gp.state_dict()
              sd_recov = batch_gp_recov.state_dict()
              self.assertTrue(set(sd_orig) == set(sd_recov))
              self.assertTrue(
                  all(
                      torch.equal(sd_orig[k], sd_recov[k])
                      for k in sd_orig
                  )
              )
  
file_path: botorch/test/models/test_converter.py
imports: import torch
  from botorch.exceptions import UnsupportedError
  from botorch.models import HeteroskedasticSingleTaskGP, ModelListGP, SingleTaskGP, SingleTaskMultiFidelityGP
  from botorch.models.converter import batched_multi_output_to_single_output, batched_to_model_list, model_list_to_batched
  from botorch.models.transforms.input import AppendFeatures, Normalize
  from botorch.models.transforms.outcome import Standardize
  from botorch.utils.test_helpers import SimpleGPyTorchModel
  from botorch.utils.testing import BotorchTestCase
  from gpytorch.kernels import RBFKernel
  from gpytorch.likelihoods import GaussianLikelihood
  from gpytorch.likelihoods.gaussian_likelihood import FixedNoiseGaussianLikelihood
label_desc: Use image node_id 3 for calling the TestConverters obj's underlying member method code with example usage: obj.test_roundtrip() without return types