code: def test_bn(self):
      class Model(chainer.link.Chain):
          def __init__(self, link_name, finetune, forget=False):
              super(Model, self).__init__()
              with self.init_scope():
                  if link_name == "bn":
                      self.link = links.BatchNormalization(3)
                  elif link_name == "brn":
                      # defaults rmax=1, dmax=0 are so trivial that BRN
                      # becomes BN
                      self.link = links.BatchRenormalization(
                          3, rmax=2.0, dmax=1.0
                      )
                  elif link_name == "dbn":
                      self.link = links.DecorrelatedBatchNormalization(
                          3, groups=3
                      )
              self.forget = forget
              self.finetune = finetune
  
          def forward(self, x):
              if self.forget:
                  return functions.forget(
                      functools.partial(
                          self.link, finetune=self.finetune
                      ),
                      x,
                  )
              else:
                  return self.link(x, finetune=self.finetune)
  
      x = numpy.random.uniform(-1, 1, (4, 3)).astype(numpy.float32)
      gy = numpy.random.uniform(-1, 1, (4, 3)).astype(numpy.float32)
  
      model1 = Model(self.link_name, self.finetune, forget=False)
      model2 = Model(self.link_name, self.finetune, forget=True)
  
      # Update the models' internal statistics
      x1 = chainer.Variable(x)
      y = model1(x1)
      y.grad = gy
      y.backward()
  
      x2 = chainer.Variable(x)
      y = model2(x2)
      y.grad = gy
      y.backward()
  
      numpy.testing.assert_almost_equal(x1.grad, x2.grad)
  
      # Check if the outputs of the models are the same during test time
      with chainer.using_config("train", False):
          y1 = model1(x)
          y2 = model2(x)
          numpy.testing.assert_almost_equal(y1.data, y2.data)
  
      if self.finetune:
          assert model1.link.N == 1
          assert model2.link.N == 1
  
imports: import functools
  import unittest
  import numpy
  import six
  import chainer
  from chainer import cuda
  from chainer import functions
  from chainer import gradient_check
  from chainer import links
  from chainer import testing
  from chainer.testing import attr
  from chainer import variable
label_desc: Use image node_id 1 for calling the TestBatchNormalization obj's underlying member method code with example usage: obj.test_bn() and returns: functions, self