def prepare_optimizer(self, optimizer, model, loss=None):
    (bn_params, other_params) = split_batchnorm_params(model)
    if (loss is not None):
        (bn_params_loss, params_loss) = split_batchnorm_params(loss)
        bn_params = (bn_params + bn_params_loss)
        other_params = (other_params + params_loss)
    bn_schedulers = self.optimizer_schedulers.copy()
    if (not self.bn_weight_decay):
        bn_schedulers['weight_decay'] = 0
    param_groups = [{'params': other_params, **self.optimizer_schedulers}]
    if (len(bn_params) > 0):
        param_groups.append({'params': bn_params, **bn_schedulers})
    self.optimizer.set_param_groups(param_groups)
def prepare_optimizer(self, optimizer, model, loss=None):
    (bn_params, other_params) = split_batchnorm_params(model)
    if (loss is not None):
        (bn_params_loss, params_loss) = split_batchnorm_params(loss)
        bn_params = (bn_params + bn_params_loss)
        other_params = (other_params + params_loss)
    bn_schedulers = self.optimizer_schedulers.copy()
    if (not self.bn_weight_decay):
        bn_schedulers['weight_decay'] = 0
    param_groups = [{'params': other_params, **self.optimizer_schedulers}]
    if (len(bn_params) > 0):
        param_groups.append({'params': bn_params, **bn_schedulers})
    self.optimizer.set_param_groups(param_groups)