docstr: Applies the given gradients to the network weights
  :param gradients: The gradients to use for the update
  :param scaler: A scaling factor that allows rescaling the gradients before applying them.
                 The gradients will be MULTIPLIED by this factor
docstr_tok: ["Applies","the","given","gradients","to","the","network","weights",":","param","gradients",":","The","gradients","to","use","for","the","update",":","param","scaler",":","A","scaling","factor","that","allows","rescaling","the","gradients","before","applying","them",".","The","gradients","will","be","MULTIPLIED","by","this","factor"]
code: def apply_gradients(
      self, gradients: List[np.ndarray], scaler: float = 1.0
  ) -> None:
      """
      Applies the given gradients to the network weights
      :param gradients: The gradients to use for the update
      :param scaler: A scaling factor that allows rescaling the gradients before applying them.
                     The gradients will be MULTIPLIED by this factor
      """
      assert self.optimizer_type != "LBFGS"
  
      batch_size = 1
      if (
          self.distributed_training
          and not self.network_parameters.async_training
      ):
          # rescale the gradients so that they average out with the gradients from the other workers
          if (
              self.network_parameters.scale_down_gradients_by_number_of_workers_for_sync_training
          ):
              batch_size = self.ap.task_parameters.num_training_tasks
  
      # set parameter gradients to gradients passed in
      for param_grad, gradient in zip(self._model_grads(-1), gradients):
          for pg in param_grad:
              pg[:] = gradient
      # update gradients
      self.trainer.update(batch_size=batch_size)
  
imports: import copy
  from typing import Any, Dict, Generator, List, Tuple, Union
  import numpy
  import mxnet
  from mxnet import autograd, gluon, nd
  from mxnet.ndarray import NDArray
  from rl_coach.architectures.architecture import Architecture
  from rl_coach.architectures.mxnet_components.heads.head import LOSS_OUT_TYPE_LOSS, LOSS_OUT_TYPE_REGULARIZATION
  from rl_coach.architectures.mxnet_components import utils
  from rl_coach.architectures.mxnet_components.savers import ParameterDictSaver, OnnxSaver
  from rl_coach.base_parameters import AgentParameters
  from rl_coach.logger import screen
  from rl_coach.saver import SaverCollection
  from rl_coach.spaces import SpacesDefinition
  from rl_coach.utils import force_list, squeeze_list
label_desc: Use image node_id 12 for calling the MxnetArchitecture obj's underlying member method code with example usage: obj.apply_gradients(gradients, scaler) without return types