code: def main(args):
      #
      # PART1
      #
  
      torch.manual_seed(args.seed)
  
      model = build_model(args).cuda()
      one_ll = next(model.children()).weight
      optimizer = FusedAdam(model.parameters())
      ASP.init_model_for_pruning(
          model,
          args.pattern,
          whitelist=args.whitelist,
          allow_recompute_mask=args.allow_recompute_mask,
      )
      ASP.init_optimizer_for_pruning(optimizer)
  
      step = 0
  
      # train for a few steps with dense weights
      print("DENSE :: ", one_ll)
      step = train_loop(
          args, model, optimizer, step, args.num_dense_steps
      )
  
      # simulate sparsity by inserting zeros into existing dense weights
      ASP.compute_sparse_masks()
  
      # train for a few steps with sparse weights
      print("SPARSE :: ", one_ll)
      step = train_loop(
          args, model, optimizer, step, args.num_sparse_steps
      )
  
      #
      # PART 2
      #
  
      torch.manual_seed(args.seed2)
  
      # train for a few steps with sparse weights
      print("SPARSE :: ", one_ll)
      step = train_loop(
          args, model, optimizer, step, args.num_sparse_steps_2
      )
  
file_path: apex/apex/contrib/sparsity/test/checkpointing_test_reference.py
imports: from collections import OrderedDict
  import torch
  from apex.optimizers import FusedAdam
  from apex.contrib.sparsity import ASP
label_desc: Use image node_id 4 for calling a global function with example usage: main(args) without return types