class_docstr: A generalized version of all possible networks implemented using tensorflow.
class_docstr_tok: ["A","generalized","version","of","all","possible","networks","implemented","using","tensorflow","."]
docstr: Construct a network class using the provided variable scope and on requested devices
  :param variable_scope: string specifying variable scope under which to create network variables
  :param devices: list of devices (can be list of Device objects, or string for TF distributed)
  :param args: all other arguments for class initializer
  :param kwargs: all other keyword arguments for class initializer
  :return: a GeneralTensorFlowNetwork object
docstr_tok: ["Construct","a","network","class","using","the","provided","variable","scope","and","on","requested","devices",":","param","variable_scope",":","string","specifying","variable","scope","under","which","to","create","network","variables",":","param","devices",":","list","of","devices","(","can","be","list","of","Device","objects",",","or","string","for","TF","distributed",")",":","param","args",":","all","other","arguments","for","class","initializer",":","param","kwargs",":","all","other","keyword","arguments","for","class","initializer",":","return",":","a","GeneralTensorFlowNetwork","object"]
code: def construct(
      variable_scope: str, devices: List[str], *args, **kwargs
  ) -> "GeneralTensorFlowNetwork":
      """
      Construct a network class using the provided variable scope and on requested devices
      :param variable_scope: string specifying variable scope under which to create network variables
      :param devices: list of devices (can be list of Device objects, or string for TF distributed)
      :param args: all other arguments for class initializer
      :param kwargs: all other keyword arguments for class initializer
      :return: a GeneralTensorFlowNetwork object
      """
      if len(devices) > 1:
          screen.warning(
              "Tensorflow implementation only support a single device. Using {}".format(
                  devices[0]
              )
          )
  
      def construct_on_device():
          with tf.device(
              GeneralTensorFlowNetwork._tf_device(devices[0])
          ):
              return GeneralTensorFlowNetwork(*args, **kwargs)
  
      # If variable_scope is in our dictionary, then this is not the first time that this variable_scope
      # is being used with construct(). So to avoid TF adding an incrementing number to the end of the
      # variable_scope to uniquify it, we have to both pass the previous variable_scope object to the new
      # variable_scope() call and also recover the name space using name_scope
      if (
          variable_scope
          in GeneralTensorFlowNetwork.variable_scopes_dict
      ):
          variable_scope = (
              GeneralTensorFlowNetwork.variable_scopes_dict[
                  variable_scope
              ]
          )
          with tf.variable_scope(
              variable_scope, auxiliary_name_scope=False
          ) as vs:
              with tf.name_scope(vs.original_name_scope):
                  return construct_on_device()
      else:
          with tf.variable_scope(
              variable_scope, auxiliary_name_scope=True
          ) as vs:
              # Add variable_scope object to dictionary for next call to construct
              GeneralTensorFlowNetwork.variable_scopes_dict[
                  variable_scope
              ] = vs
              return construct_on_device()
  
imports: import copy
  from types import MethodType
  from typing import Dict, List, Union
  import numpy
  import tensorflow
  from rl_coach.architectures.embedder_parameters import InputEmbedderParameters
  from rl_coach.architectures.head_parameters import HeadParameters
  from rl_coach.architectures.middleware_parameters import MiddlewareParameters
  from rl_coach.architectures.tensorflow_components.architecture import TensorFlowArchitecture
  from rl_coach.architectures.tensorflow_components import utils
  from rl_coach.base_parameters import AgentParameters, Device, DeviceType, EmbeddingMergerType
  from rl_coach.core_types import PredictionType
  from rl_coach.logger import screen
  from rl_coach.spaces import SpacesDefinition, PlanarMapsObservationSpace, TensorObservationSpace
  from rl_coach.utils import get_all_subclasses, dynamic_import_and_instantiate_module_from_params, indent_string
label_desc: Use image node_id 1 for calling the GeneralTensorFlowNetwork obj's underlying member method code with example usage: obj.construct(variable_scope, devices) and returns: GeneralTensorFlowNetwork, construct_on_device, construct_on_device