class_docstr: Example of weight sharing between two different TFModelV2s.
  
  NOTE: This will only work for tf2.x. When running with config.framework=tf,
  use SharedWeightsModel1 and SharedWeightsModel2 below, instead!
  
  The shared (single) layer is simply defined outside of the two Models,
  then used by both Models in their forward pass.
class_docstr_tok: ["Example","of","weight","sharing","between","two","different","TFModelV2s",".","NOTE",":","This","will","only","work","for","tf2.x",".","When","running","with","config.framework=tf",",","use","SharedWeightsModel1","and","SharedWeightsModel2","below",",","instead","!","The","shared","(","single",")","layer","is","simply","defined","outside","of","the","two","Models",",","then","used","by","both","Models","in","their","forward","pass","."]
code: def __init__(
      self,
      observation_space,
      action_space,
      num_outputs,
      model_config,
      name,
  ):
      super().__init__(
          observation_space,
          action_space,
          num_outputs,
          model_config,
          name,
      )
  
      global TF2_GLOBAL_SHARED_LAYER
      # The global, shared layer to be used by both models.
      if TF2_GLOBAL_SHARED_LAYER is None:
          TF2_GLOBAL_SHARED_LAYER = tf.keras.layers.Dense(
              units=64, activation=tf.nn.relu, name="fc1"
          )
  
      inputs = tf.keras.layers.Input(observation_space.shape)
      last_layer = TF2_GLOBAL_SHARED_LAYER(inputs)
      output = tf.keras.layers.Dense(
          units=num_outputs, activation=None, name="fc_out"
      )(last_layer)
      vf = tf.keras.layers.Dense(
          units=1, activation=None, name="value_out"
      )(last_layer)
      self.base_model = tf.keras.models.Model(inputs, [output, vf])
  
imports: import numpy
  from ray.rllib.models.modelv2 import ModelV2
  from ray.rllib.models.tf.tf_modelv2 import TFModelV2
  from ray.rllib.models.torch.misc import SlimFC
  from ray.rllib.models.torch.torch_modelv2 import TorchModelV2
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.framework import try_import_tf, try_import_torch
label_desc: Use image node_id 1 to create a new TF2SharedWeightsModel object from inherited base classes: TFModelV2 with example: obj = TF2SharedWeightsModel(observation_space, action_space, num_outputs, model_config, name)