code: def test_batchnorm2d(self, training=False):
      with Tensor.train(training):
          szs = [4, 8, 16, 32]
          for sz in szs:
              # create in tinygrad
              bn = BatchNorm2d(
                  sz, eps=1e-5, track_running_stats=training
              )
              bn.weight = Tensor.randn(sz)
              bn.bias = Tensor.randn(sz)
              bn.running_mean = Tensor.randn(sz)
              bn.running_var = Tensor.randn(sz)
              bn.running_var.numpy()[bn.running_var.numpy() < 0] = 0
  
              # create in torch
              with torch.no_grad():
                  tbn = torch.nn.BatchNorm2d(sz).eval()
                  tbn.training = training
                  tbn.weight[:] = torch.tensor(bn.weight.numpy())
                  tbn.bias[:] = torch.tensor(bn.bias.numpy())
                  tbn.running_mean[:] = torch.tensor(
                      bn.running_mean.numpy()
                  )
                  tbn.running_var[:] = torch.tensor(
                      bn.running_var.numpy()
                  )
  
              np.testing.assert_allclose(
                  bn.running_mean.numpy(),
                  tbn.running_mean.detach().numpy(),
                  rtol=1e-5,
                  atol=1e-6,
              )
              np.testing.assert_allclose(
                  bn.running_var.numpy(),
                  tbn.running_var.detach().numpy(),
                  rtol=1e-5,
                  atol=1e-6,
              )
  
              # trial
              inn = Tensor.randn(2, sz, 3, 3)
  
              # in tinygrad
              outt = bn(inn)
  
              # in torch
              toutt = tbn(torch.tensor(inn.numpy()))
  
              # close
              np.testing.assert_allclose(
                  outt.numpy(),
                  toutt.detach().numpy(),
                  rtol=5e-4,
                  atol=1e-6,
              )
              np.testing.assert_allclose(
                  bn.running_mean.numpy(),
                  tbn.running_mean.detach().numpy(),
                  rtol=1e-5,
                  atol=1e-6,
              )
              np.testing.assert_allclose(
                  bn.running_var.numpy(),
                  tbn.running_var.detach().numpy(),
                  rtol=1e-5,
                  atol=1e-6,
              )
  
imports: import unittest
  import numpy
  import torch
  from tinygrad import Tensor, Device, TinyJit
  from tinygrad.helpers import CI
  from tinygrad.nn import BatchNorm2d, Conv1d, ConvTranspose1d, Conv2d, ConvTranspose2d, Linear, GroupNorm, LayerNorm, LayerNorm2d, Embedding, InstanceNorm
label_desc: Use image node_id 2 for calling the TestNN obj's underlying member method code with example usage: obj.test_batchnorm2d(training) without return types