code: def test_dynamic_rnn_with_fake_data(self):
      class CustomisedModel(tl.models.Model):
          def __init__(self):
              super(CustomisedModel, self).__init__()
              self.rnnlayer = tl.layers.LSTMRNN(
                  units=8,
                  dropout=0.1,
                  in_channels=4,
                  return_last_output=True,
                  return_last_state=False,
              )
              self.dense = tl.layers.Dense(in_channels=8, n_units=1)
  
          def forward(self, x):
              z = self.rnnlayer(
                  x,
                  sequence_length=tl.layers.retrieve_seq_length_op3(x),
              )
              z = self.dense(z[:, :])
              return z
  
      rnn_model = CustomisedModel()
      print(rnn_model)
      optimizer = tf.optimizers.Adam(learning_rate=0.01)
      rnn_model.train()
  
      for epoch in range(50):
          with tf.GradientTape() as tape:
              pred_y = rnn_model(self.data_x)
              loss = tl.cost.mean_squared_error(pred_y, self.data_y)
  
          gradients = tape.gradient(loss, rnn_model.trainable_weights)
          optimizer.apply_gradients(
              zip(gradients, rnn_model.trainable_weights)
          )
  
          if (epoch + 1) % 10 == 0:
              print("epoch %d, loss %f" % (epoch, loss))
  
      filename = "dynamic_rnn.h5"
      rnn_model.save_weights(filename)
  
      # Testing saving and restoring of RNN weights
      rnn_model2 = CustomisedModel()
      rnn_model2.eval()
      pred_y = rnn_model2(self.data_x)
      loss = tl.cost.mean_squared_error(pred_y, self.data_y)
      print("MODEL INIT loss %f" % (loss))
  
      rnn_model2.load_weights(filename)
      pred_y = rnn_model2(self.data_x)
      loss = tl.cost.mean_squared_error(pred_y, self.data_y)
      print("MODEL RESTORE W loss %f" % (loss))
  
      import os
  
      os.remove(filename)
  
imports: import os
  import unittest
  import numpy
  import tensorflow
  import tensorlayer
  from tests.utils import CustomTestCase
label_desc: Use image node_id 30 for calling the Layer_RNN_Test obj's underlying member method code with example usage: obj.test_dynamic_rnn_with_fake_data() and returns: z