code: def check_parity(torch_bn, fs_bn, x):
      yh = torch.randn_like(x)
      torch_x = x.detach()
      torch_x.requires_grad = True
      torch_y = torch_bn(torch_x)
      torch_y.backward(yh)
      fs_x = x.detach()
      fs_x.requires_grad = True
      fs_y = fs_bn(fs_x)
      fs_y.backward(yh)
      torch.testing.assert_allclose(torch_y, fs_y)
      torch.testing.assert_allclose(
          torch_bn.running_mean, fs_bn.running_mean
      )
      torch.testing.assert_allclose(
          torch_bn.running_var, fs_bn.running_var
      )
      torch.testing.assert_allclose(torch_bn.weight, fs_bn.weight)
      torch.testing.assert_allclose(torch_bn.bias, fs_bn.bias)
      torch.testing.assert_allclose(
          torch_bn.weight.grad, fs_bn.weight.grad
      )
      torch.testing.assert_allclose(torch_bn.bias.grad, fs_bn.bias.grad)
      torch.testing.assert_allclose(torch_x.grad, fs_x.grad)
  
imports: import functools
  import tempfile
  import pytest
  import torch
  import torch.distributed
  import torch.multiprocessing
  import torch.nn
  from torch.nn.parallel import DistributedDataParallel
  from fairscale.experimental.nn import SyncBatchNorm
  from fairscale.nn.checkpoint import checkpoint_wrapper
label_desc: Use image node_id 3 for calling a global function with example usage: check_parity(torch_bn, fs_bn, x) without return types