code: def update_loss_weights(self):
      self.do_metric_alone = self.epoch <= self.metric_alone_epochs
      self.do_adv_alone = (
          self.metric_alone_epochs
          < self.epoch
          <= self.metric_alone_epochs + self.g_alone_epochs
      )
      self.do_both = not self.do_adv_alone and not self.do_metric_alone
      self.do_adv = self.do_adv_alone or self.do_both
      self.do_metric = self.do_metric_alone or self.do_both
  
      non_zero_weight_list = []
      if self.do_adv:
          non_zero_weight_list += [
              "g_hard_loss",
              "g_reg_loss",
              "g_adv_loss",
          ]
      if self.do_metric:
          non_zero_weight_list += ["metric_loss", "classifier_loss"]
      if self.do_both:
          non_zero_weight_list += ["synth_loss"]
  
      for k in self.loss_weights.keys():
          if k in non_zero_weight_list:
              self.loss_weights[k] = self.original_loss_weights[k]
          else:
              self.loss_weights[k] = 0
  
      self.maybe_exclude_networks_from_gradient()
  
imports: import copy
  import torch
  from ..distances import LpDistance
  from ..losses import TripletMarginLoss
  from ..miners import EmbeddingsAlreadyPackagedAsTriplets
  from ..utils import common_functions
  from ..utils import loss_and_miner_utils
  from .train_with_classifier import TrainWithClassifier
label_desc: Use image node_id 4 for calling the DeepAdversarialMetricLearning obj's underlying member method code with example usage: obj.update_loss_weights() without return types