code: def test_approximate_round(self):
      for dtype in (torch.float, torch.double):
          X = torch.linspace(
              -2.5, 2.5, 11, device=self.device, dtype=dtype
          )
          exact_rounded_X = X.round()
          approx_rounded_X = approximate_round(X)
          # check that approximate rounding is closer to rounded values than
          # the original inputs
          rounded_diffs = (approx_rounded_X - exact_rounded_X).abs()
          diffs = (X - exact_rounded_X).abs()
          self.assertTrue((rounded_diffs <= diffs).all())
          # check that not all gradients are zero
          X.requires_grad_(True)
          approximate_round(X).sum().backward()
          self.assertTrue((X.grad.abs() != 0).any())
  
file_path: botorch/test/utils/test_rounding.py
imports: import torch
  from botorch.utils.rounding import approximate_round, IdentitySTEFunction, OneHotArgmaxSTE, RoundSTE
  from botorch.utils.testing import BotorchTestCase
  from torch.nn.functional import one_hot
label_desc: Use image node_id 1 for calling the TestApproximateRound obj's underlying member method code with example usage: obj.test_approximate_round() without return types