code: def convert_splitbn_model(module, num_splits=2):
      """
      Recursively traverse module and its children to replace all instances of
      ``torch.nn.modules.batchnorm._BatchNorm`` with `SplitBatchnorm2d`.
      Args:
          module (torch.nn.Module): input module
          num_splits: number of separate batchnorm layers to split input across
      Example::
          >>> # model is an instance of torch.nn.Module
          >>> model = timm.models.convert_splitbn_model(model, num_splits=2)
      """
      mod = module
      if isinstance(
          module, torch.nn.modules.instancenorm._InstanceNorm
      ):
          return module
      if isinstance(module, torch.nn.modules.batchnorm._BatchNorm):
          mod = SplitBatchNorm2d(
              module.num_features,
              module.eps,
              module.momentum,
              module.affine,
              module.track_running_stats,
              num_splits=num_splits,
          )
          mod.running_mean = module.running_mean
          mod.running_var = module.running_var
          mod.num_batches_tracked = module.num_batches_tracked
          if module.affine:
              mod.weight.data = module.weight.data.clone().detach()
              mod.bias.data = module.bias.data.clone().detach()
          for aux in mod.aux_bn:
              aux.running_mean = module.running_mean.clone()
              aux.running_var = module.running_var.clone()
              aux.num_batches_tracked = (
                  module.num_batches_tracked.clone()
              )
              if module.affine:
                  aux.weight.data = module.weight.data.clone().detach()
                  aux.bias.data = module.bias.data.clone().detach()
      for name, child in module.named_children():
          mod.add_module(
              name, convert_splitbn_model(child, num_splits=num_splits)
          )
      del module
      return mod
  
imports: import torch
  import torch.nn
label_desc: Use image node_id 1 for calling a global function with example usage: convert_splitbn_model(module, num_splits) and returns: mod, module