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)
docstr_tok: [":","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,
      devices: List[mx.Context],
      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.losses = []  # type: List[HeadLoss]
      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_training = False
      self.model = None  # type: GeneralModel
      self._devices = self._sanitize_device_list(devices)
  
      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:
          mx.random.seed(self.ap.task_parameters.seed)
  
      # Call to child class to create the model
      self.construct_model()
  
      self.trainer = None
  
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 1 to create a new MxnetArchitecture object from inherited base classes: Architecture with example: obj = MxnetArchitecture(agent_parameters, spaces, devices, name, global_network, network_is_local, network_is_trainable)