docstr: Create tensorflow ops for applying the gradients to the network weights according to the training scheme
  (distributed training - local or global network, shared optimizer, etc.)
  :return: None
code: def _create_gradient_applying_ops(self):
      """
      Create tensorflow ops for applying the gradients to the network weights according to the training scheme
      (distributed training - local or global network, shared optimizer, etc.)
      :return: None
      """
      if (
          self.network_is_global
          and self.network_parameters.shared_optimizer
          and not self.network_parameters.async_training
      ):
          # synchronous training with shared optimizer? -> create an operation for applying the gradients
          # accumulated in the shared gradients accumulator
          self.update_weights_from_shared_gradients = (
              self.optimizer.apply_gradients(
                  zip(self.shared_accumulated_gradients, self.weights),
                  global_step=self.global_step,
              )
          )
  
      elif self.distributed_training and self.network_is_local:
          # distributed training but independent optimizer? -> create an operation for applying the gradients
          # to the global weights
          self.update_weights_from_batch_gradients = (
              self.optimizer.apply_gradients(
                  zip(
                      self.weights_placeholders,
                      self.global_network.weights,
                  ),
                  global_step=self.global_step,
              )
          )
  
      elif self.network_is_trainable:
          # not any of the above but is trainable? -> create an operation for applying the gradients to
          # this network weights
          update_ops = tf.get_collection(
              tf.GraphKeys.UPDATE_OPS, scope=self.full_name
          )
  
          with tf.control_dependencies(update_ops):
              self.update_weights_from_batch_gradients = (
                  self.optimizer.apply_gradients(
                      zip(self.weights_placeholders, self.weights),
                      global_step=self.global_step,
                  )
              )
  
imports: import os
  import time
  from typing import Any, List, Tuple, Dict
  import numpy
  import tensorflow
  from rl_coach.architectures.architecture import Architecture
  from rl_coach.architectures.tensorflow_components.savers import GlobalVariableSaver
  from rl_coach.base_parameters import AgentParameters, DistributedTaskParameters
  from rl_coach.core_types import GradientClippingMethod
  from rl_coach.saver import SaverCollection
  from rl_coach.spaces import SpacesDefinition
  from rl_coach.utils import force_list, squeeze_list, start_shell_command_and_wait
label_desc: Use image node_id 8 for calling the TensorFlowArchitecture obj's underlying member method code with example usage: obj._create_gradient_applying_ops() without return types