code: def test_deferred_batch_norm(checkpoint):
      bn = nn.BatchNorm2d(3)
      pipe_bn = deepcopy(bn)
      pipe = Pipe(
          nn.Sequential(pipe_bn),
          balance=[1],
          devices=["cpu"],
          chunks=2,
          checkpoint=checkpoint,
          deferred_batch_norm=True,
      )
  
      x = torch.rand(4, 3, 10, 10)
      pipe(x).mean().backward()
      bn(x).mean().backward()
  
      assert torch.allclose(
          pipe[0].running_mean, bn.running_mean, atol=1e-4
      )
      assert torch.allclose(
          pipe[0].running_var, bn.running_var, atol=1e-4
      )
  
imports: from collections import OrderedDict
  from copy import deepcopy
  import time
  import pytest
  import torch
  from torch import nn
  from fairscale.nn.pipe import Pipe
label_desc: Use image node_id 23 for calling a global function with example usage: test_deferred_batch_norm(checkpoint) without return types