code: def test_GenericCostAwareUtility(self):
      def cost(X, deltas, **kwargs):
          return deltas.mean(dim=-1) / X[..., 1].sum(dim=-1)
  
      for dtype in (torch.float, torch.double):
          u = GenericCostAwareUtility(cost)
          X = torch.rand(3, 2, device=self.device, dtype=dtype)
          deltas = torch.rand(5, 3, device=self.device, dtype=dtype)
          self.assertIsInstance(u, GenericCostAwareUtility)
          self.assertTrue(torch.equal(u(X, deltas), cost(X, deltas)))
          X = torch.rand(4, 3, 2, device=self.device, dtype=dtype)
          deltas = torch.rand(5, 4, 3, device=self.device, dtype=dtype)
          self.assertIsInstance(u, GenericCostAwareUtility)
          self.assertTrue(torch.equal(u(X, deltas), cost(X, deltas)))
  
file_path: botorch/test/acquisition/test_cost_aware.py
imports: import warnings
  import torch
  from botorch import settings
  from botorch.acquisition.cost_aware import CostAwareUtility, GenericCostAwareUtility, InverseCostWeightedUtility
  from botorch.exceptions.warnings import CostAwareWarning
  from botorch.models.deterministic import GenericDeterministicModel
  from botorch.sampling import IIDNormalSampler
  from botorch.utils.testing import BotorchTestCase, MockModel, MockPosterior
label_desc: Use image node_id 2 for calling the TestCostAwareUtilities obj's underlying member method code with example usage: obj.test_GenericCostAwareUtility() and returns: unknown