code: def verify_group_norm(
      self,
      tst_func,
      N=32,
      C=128,
      H=256,
      W=256,
      G=32,
      ref_func=torch_group_norm,
      xdtype=torch.float16,
      wdtype=torch.float32,
      eps=1e-5,
      memory_format=torch.channels_last,
      device="cuda",
      act="",
  ):
      # create data
      x_shape = (N, C, H, W)
      w_shape = (C,)
      weight = torch.rand(
          w_shape, dtype=wdtype, device="cuda", requires_grad=True
      )
      bias = torch.rand(
          w_shape, dtype=wdtype, device="cuda", requires_grad=True
      )
      x = -2.3 + 0.5 * torch.randn(x_shape, dtype=xdtype, device="cuda")
      x = x.to(memory_format=memory_format)
      dy = 0.1 * torch.randn_like(x)
      x.requires_grad_(True)
  
      # forward pass
      y_ref = ref_func(x, G, weight, bias, eps, act)
      if tst_func is GroupNorm:
          gn = GroupNorm(
              G, C, eps, device=device, dtype=wdtype, act=act
          )
          with torch.no_grad():
              gn.weight = torch.nn.Parameter(weight)
              gn.bias = torch.nn.Parameter(bias)
          y_tst = gn(x)
      else:
          y_tst = tst_func(x, G, weight, bias, eps, act)
  
      # backward pass
      y_ref.backward(dy, retain_graph=True)
      dx_ref, dw_ref, db_ref = [
          t.grad.clone() for t in [x, weight, bias]
      ]
      x.grad.zero_()
      weight.grad.zero_()
      bias.grad.zero_()
      y_tst.backward(dy, retain_graph=True)
      if tst_func is GroupNorm:
          dx_tst, dw_tst, db_tst = x.grad, gn.weight.grad, gn.bias.grad
      else:
          dx_tst, dw_tst, db_tst = [
              t.grad.clone() for t in [x, weight, bias]
          ]
  
      # compare
      torch.testing.assert_close(y_tst, y_ref, atol=4e-2, rtol=0)
      torch.testing.assert_close(dx_tst, dx_ref, atol=4e-2, rtol=0)
      torch.testing.assert_close(dw_tst, dw_ref, atol=4e-2, rtol=0)
      torch.testing.assert_close(db_tst, db_ref, atol=4e-2, rtol=0)
  
imports: import torch
  import unittest
label_desc: Use image node_id 2 for calling the GroupNormTest obj's underlying member method code with example usage: obj.verify_group_norm(tst_func, N, C, H, W, G, ref_func, xdtype, wdtype, eps, memory_format, device, act) without return types