code: def test_generic(self, m: int = 3, n: int = 4):
      for dtype in (torch.float32, torch.float64):
          # Test forward
          x = torch.rand(
              n, m, dtype=dtype, requires_grad=True, device=self.device
          )
          y = self.safe_op(x)
  
          _x = x.detach().clone().requires_grad_(True)
          _y = self.op(_x)
          self.assertTrue(y.equal(_y))
  
          # Test backward
          y.sum().backward()
          _y.sum().backward()
          self.assertTrue(x.grad.equal(_x.grad))
  
          # Test passing in pre-allocated `out`
          with torch.no_grad():
              y.zero_()
              self.safe_op(x, out=y)
              self.assertTrue(y.equal(_y))
  
imports: from __future__ import annotations
  import itertools
  import math
  from abc import abstractmethod
  from itertools import combinations, product
  from typing import Callable
  import torch
  from botorch.exceptions import UnsupportedError
  from botorch.utils import safe_math
  from botorch.utils.constants import get_constants_like
  from botorch.utils.objective import compute_smoothed_feasibility_indicator
  from botorch.utils.safe_math import _pareto, cauchy, fatmax, fatmaximum, fatminimum, fatmoid, fatplus, log_fatmoid, log_fatplus, log_softplus, logdiffexp, logexpit, logmeanexp, logplusexp, sigmoid, smooth_amax
  from botorch.utils.testing import BotorchTestCase
  from torch import finfo, Tensor
  from torch.nn.functional import softplus
label_desc: Use image node_id 2 for calling the UnaryOpTestMixin obj's underlying member method code with example usage: obj.test_generic(m, n) without return types