class_docstr: A conv. + recurrent keras net example using a pre-trained MobileNet.
class_docstr_tok: ["A","conv",".","+","recurrent","keras","net","example","using","a","pre-trained","MobileNet","."]
code: def __init__(
      self,
      obs_space,
      action_space,
      num_outputs,
      model_config,
      name,
      cnn_shape,
  ):
      super(MobileV2PlusRNNModel, self).__init__(
          obs_space, action_space, num_outputs, model_config, name
      )
  
      self.cell_size = 16
      visual_size = cnn_shape[0] * cnn_shape[1] * cnn_shape[2]
  
      state_in_h = tf.keras.layers.Input(
          shape=(self.cell_size,), name="h"
      )
      state_in_c = tf.keras.layers.Input(
          shape=(self.cell_size,), name="c"
      )
      seq_in = tf.keras.layers.Input(
          shape=(), name="seq_in", dtype=tf.int32
      )
  
      inputs = tf.keras.layers.Input(
          shape=(None, visual_size), name="visual_inputs"
      )
  
      input_visual = inputs
      input_visual = tf.reshape(
          input_visual, [-1, cnn_shape[0], cnn_shape[1], cnn_shape[2]]
      )
      cnn_input = tf.keras.layers.Input(
          shape=cnn_shape, name="cnn_input"
      )
  
      cnn_model = tf.keras.applications.mobilenet_v2.MobileNetV2(
          alpha=1.0,
          include_top=True,
          weights=None,
          input_tensor=cnn_input,
          pooling=None,
      )
      vision_out = cnn_model(input_visual)
      vision_out = tf.reshape(
          vision_out,
          [-1, tf.shape(inputs)[1], vision_out.shape.as_list()[-1]],
      )
  
      lstm_out, state_h, state_c = tf.keras.layers.LSTM(
          self.cell_size,
          return_sequences=True,
          return_state=True,
          name="lstm",
      )(
          inputs=vision_out,
          mask=tf.sequence_mask(seq_in),
          initial_state=[state_in_h, state_in_c],
      )
  
      # Postprocess LSTM output with another hidden layer and compute values.
      logits = tf.keras.layers.Dense(
          self.num_outputs,
          activation=tf.keras.activations.linear,
          name="logits",
      )(lstm_out)
      values = tf.keras.layers.Dense(1, activation=None, name="values")(
          lstm_out
      )
  
      # Create the RNN model
      self.rnn_model = tf.keras.Model(
          inputs=[inputs, seq_in, state_in_h, state_in_c],
          outputs=[logits, values, state_h, state_c],
      )
      self.rnn_model.summary()
  
file_path: ray/python/ray/rllib/examples/models/mobilenet_v2_with_lstm_models.py
imports: import numpy
  from ray.rllib.models.modelv2 import ModelV2
  from ray.rllib.models.tf.recurrent_net import RecurrentNetwork
  from ray.rllib.models.torch.misc import SlimFC
  from ray.rllib.models.torch.recurrent_net import RecurrentNetwork
  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 MobileV2PlusRNNModel object from inherited base classes: RecurrentNetwork with example: obj = MobileV2PlusRNNModel(obs_space, action_space, num_outputs, model_config, name, cnn_shape)