code: def test_multi_output_risk_measure_mc_objective(self):
      # abstract raises
      with self.assertRaises(TypeError):
          MultiOutputRiskMeasureMCObjective(n_w=3)
  
      for dtype in (torch.float, torch.double):
          samples = torch.tensor(
              [
                  [
                      [1.0, 1.2],
                      [0.5, 0.7],
                      [2.0, 2.2],
                      [3.0, 3.4],
                      [1.0, 1.2],
                      [5.0, 5.6],
                  ]
              ],
              device=self.device,
              dtype=dtype,
          )
          obj = NotSoAbstractMORiskMeasure(n_w=3)
          # test _prepare_samples
          expected_samples = samples.view(1, 2, 3, 2)
          prepared_samples = obj._prepare_samples(samples)
          self.assertTrue(
              torch.equal(prepared_samples, expected_samples)
          )
          # test batches
          samples = torch.rand(
              5, 3, 6, 3, device=self.device, dtype=dtype
          )
          expected_samples = samples.view(5, 3, 2, 3, 3)
          prepared_samples = obj._prepare_samples(samples)
          self.assertTrue(
              torch.equal(prepared_samples, expected_samples)
          )
          # negating with preprocessing function
          obj = NotSoAbstractMORiskMeasure(
              n_w=3,
              preprocessing_function=WeightedMCMultiOutputObjective(
                  weights=torch.tensor(
                      [-1.0, -1.0, -1.0],
                      device=self.device,
                      dtype=dtype,
                  )
              ),
          )
          prepared_samples = obj._prepare_samples(samples)
          self.assertTrue(
              torch.equal(prepared_samples, -expected_samples)
          )
  
imports: import warnings
  from typing import Optional
  import torch
  from botorch import settings
  from botorch.acquisition.multi_objective.multi_output_risk_measures import IndependentCVaR, IndependentVaR, MARS, MultiOutputExpectation, MultiOutputRiskMeasureMCObjective, MultiOutputWorstCase, MVaR
  from botorch.acquisition.multi_objective.objective import IdentityMCMultiOutputObjective, WeightedMCMultiOutputObjective
  from botorch.exceptions.errors import UnsupportedError
  from botorch.exceptions.warnings import BotorchWarning
  from botorch.models.deterministic import GenericDeterministicModel
  from botorch.models.transforms.input import InputPerturbation
  from botorch.utils.multi_objective.pareto import is_non_dominated
  from botorch.utils.testing import BotorchTestCase
  from torch import Tensor
label_desc: Use image node_id 1 for calling the TestMultiOutputRiskMeasureMCObjective obj's underlying member method code with example usage: obj.test_multi_output_risk_measure_mc_objective() without return types