docstr: :param agent_parameters: the agent parameters
  :param spaces: the spaces definition of the agent
  :param name: the name of the network
  :param global_network: the global network replica that is shared between all the workers
  :param network_is_local: is the network global (shared between workers) or local (dedicated to the worker)
  :param network_is_trainable: is the network trainable (we can apply gradients on it)
code: def __init__(
      self,
      agent_parameters: AgentParameters,
      spaces: SpacesDefinition,
      name: str = "",
      global_network=None,
      network_is_local: bool = True,
      network_is_trainable: bool = False,
  ):
      """
      :param agent_parameters: the agent parameters
      :param spaces: the spaces definition of the agent
      :param name: the name of the network
      :param global_network: the global network replica that is shared between all the workers
      :param network_is_local: is the network global (shared between workers) or local (dedicated to the worker)
      :param network_is_trainable: is the network trainable (we can apply gradients on it)
      """
      super().__init__(agent_parameters, spaces, name)
      self.middleware = None
      self.network_is_local = network_is_local
      self.global_network = global_network
      if not self.network_parameters.tensorflow_support:
          raise ValueError("TensorFlow is not supported for this agent")
      self.sess = None
      self.inputs = {}
      self.outputs = []
      self.targets = []
      self.importance_weights = []
      self.losses = []
      self.total_loss = None
      self.trainable_weights = []
      self.weights_placeholders = []
      self.shared_accumulated_gradients = []
      self.curr_rnn_c_in = None
      self.curr_rnn_h_in = None
      self.gradients_wrt_inputs = []
      self.train_writer = None
      self.accumulated_gradients = None
      self.network_is_trainable = network_is_trainable
  
      self.is_chief = self.ap.task_parameters.task_index == 0
      self.network_is_global = (
          not self.network_is_local and global_network is None
      )
      self.distributed_training = (
          self.network_is_global
          or self.network_is_local
          and global_network is not None
      )
  
      self.optimizer_type = self.network_parameters.optimizer_type
      if self.ap.task_parameters.seed is not None:
          tf.set_random_seed(self.ap.task_parameters.seed)
      with tf.variable_scope(
          "/".join(self.name.split("/")[1:]),
          initializer=tf.contrib.layers.xavier_initializer(),
          custom_getter=local_getter
          if network_is_local and global_network
          else None,
      ):
          self.global_step = tf.train.get_or_create_global_step()
  
          # build the network
          self.weights = self.get_model()
  
          # create the placeholder for the assigning gradients and some tensorboard summaries for the weights
          for idx, var in enumerate(self.weights):
              placeholder = tf.placeholder(
                  tf.float32,
                  shape=var.get_shape(),
                  name=str(idx) + "_holder",
              )
              self.weights_placeholders.append(placeholder)
              if self.ap.visualization.tensorboard:
                  variable_summaries(var)
  
          # create op for assigning a list of weights to the network weights
          self.update_weights_from_list = [
              weights.assign(holder)
              for holder, weights in zip(
                  self.weights_placeholders, self.weights
              )
          ]
  
          # locks for synchronous training
          if self.network_is_global:
              self._create_locks_for_synchronous_training()
  
          # gradients ops
          self._create_gradient_ops()
  
          self.inc_step = self.global_step.assign_add(1)
  
          # reset LSTM hidden cells
          self.reset_internal_memory()
  
          if self.ap.visualization.tensorboard:
              current_scope_summaries = tf.get_collection(
                  tf.GraphKeys.SUMMARIES,
                  scope=tf.contrib.framework.get_name_scope(),
              )
              self.merged = tf.summary.merge(current_scope_summaries)
  
          # initialize or restore model
          self.init_op = tf.group(
              tf.global_variables_initializer(),
              tf.local_variables_initializer(),
          )
  
          # set the fetches for training
          self._set_initial_fetch_list()
  
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 1 to create a new TensorFlowArchitecture object from inherited base classes: Architecture with example: obj = TensorFlowArchitecture(agent_parameters, spaces, name, global_network, network_is_local, network_is_trainable)