code: def get_sgd_optimizer(
      parameters,
      lr,
      momentum,
      weight_decay,
      nesterov=False,
      bn_weight_decay=False,
  ):
      if bn_weight_decay:
          print(" ! Weight decay applied to BN parameters ")
          params = [v for n, v in parameters]
      else:
          print(" ! Weight decay NOT applied to BN parameters ")
          bn_params = [v for n, v in parameters if "bn" in n]
          rest_params = [v for n, v in parameters if not "bn" in n]
          print(len(bn_params))
          print(len(rest_params))
  
          params = [
              {"params": bn_params, "weight_decay": 0},
              {"params": rest_params, "weight_decay": weight_decay},
          ]
  
      optimizer = torch.optim.SGD(
          params,
          lr,
          momentum=momentum,
          weight_decay=weight_decay,
          nesterov=nesterov,
      )
  
      return optimizer
  
file_path: DALI/docs/examples/use_cases/pytorch/efficientnet/image_classification/optimizers.py
imports: import math
  import numpy
  import torch
  from torch import optim
label_desc: Use image node_id 2 for calling a global function with example usage: get_sgd_optimizer(parameters, lr, momentum, weight_decay, nesterov, bn_weight_decay) and returns: optimizer