code: def run_rnn_layers(dtype, dtype2):
      device = default_device()
  
      check_rnn_layer_forward(
          gluon.rnn.RNN(10, 2, dtype=dtype),
          mx.np.ones((8, 3, 20), dtype=dtype),
          device=device,
      )
      check_rnn_layer_forward(
          gluon.rnn.RNN(10, 2, dtype=dtype, bidirectional=True),
          mx.np.ones((8, 3, 20), dtype=dtype),
          mx.np.ones((4, 3, 10), dtype=dtype),
          device=device,
      )
      check_rnn_layer_forward(
          gluon.rnn.LSTM(10, 2, dtype=dtype),
          mx.np.ones((8, 3, 20), dtype=dtype),
          device=device,
      )
      check_rnn_layer_forward(
          gluon.rnn.LSTM(10, 2, dtype=dtype, bidirectional=True),
          mx.np.ones((8, 3, 20), dtype=dtype),
          [
              mx.np.ones((4, 3, 10), dtype=dtype),
              mx.np.ones((4, 3, 10), dtype=dtype),
          ],
          device=device,
      )
      check_rnn_layer_forward(
          gluon.rnn.GRU(
              10,
              2,
              dtype=dtype,
          ),
          mx.np.ones((8, 3, 20), dtype=dtype),
          device=device,
      )
      check_rnn_layer_forward(
          gluon.rnn.GRU(10, 2, dtype=dtype, bidirectional=True),
          mx.np.ones((8, 3, 20), dtype=dtype),
          mx.np.ones((4, 3, 10), dtype=dtype),
          device=device,
      )
  
      check_rnn_layer_forward(
          gluon.rnn.RNN(10, 2, dtype=dtype, dropout=0.5),
          mx.np.ones((8, 3, 20), dtype=dtype),
          run_only=True,
          device=device,
      )
      check_rnn_layer_forward(
          gluon.rnn.RNN(
              10, 2, bidirectional=True, dropout=0.5, dtype=dtype
          ),
          mx.np.ones((8, 3, 20), dtype=dtype),
          mx.np.ones((4, 3, 10), dtype=dtype),
          run_only=True,
          device=device,
      )
      check_rnn_layer_forward(
          gluon.rnn.LSTM(10, 2, dropout=0.5, dtype=dtype),
          mx.np.ones((8, 3, 20), dtype=dtype),
          run_only=True,
          device=device,
      )
      check_rnn_layer_forward(
          gluon.rnn.LSTM(
              10, 2, bidirectional=True, dropout=0.5, dtype=dtype
          ),
          mx.np.ones((8, 3, 20), dtype=dtype),
          [
              mx.np.ones((4, 3, 10), dtype=dtype),
              mx.np.ones((4, 3, 10), dtype=dtype),
          ],
          run_only=True,
          device=device,
      )
      check_rnn_layer_forward(
          gluon.rnn.GRU(10, 2, dropout=0.5, dtype=dtype),
          mx.np.ones((8, 3, 20), dtype=dtype),
          run_only=True,
          device=device,
      )
      check_rnn_layer_forward(
          gluon.rnn.GRU(
              10, 2, bidirectional=True, dropout=0.5, dtype=dtype
          ),
          mx.np.ones((8, 3, 20), dtype=dtype),
          mx.np.ones((4, 3, 10), dtype=dtype),
          run_only=True,
          device=device,
      )
  
      net = gluon.nn.Sequential()
      net.add(gluon.rnn.LSTM(10, bidirectional=True, dtype=dtype2))
      net.add(gluon.nn.BatchNorm(axis=2))
      net.add(gluon.nn.Flatten())
      net.add(gluon.nn.Dense(3, activation="relu"))
      net.initialize(device=device)
      net.cast(dtype)
      with mx.autograd.record():
          out = net(mx.np.ones((2, 3, 10), dtype=dtype, device=device))
          out.backward()
          out = out.asnumpy()
  
      net2 = gluon.nn.HybridSequential()
      net2.add(gluon.rnn.LSTM(10, bidirectional=True, dtype=dtype2))
      net2.add(gluon.nn.BatchNorm(axis=2))
      net2.add(gluon.nn.Flatten())
      net2.add(gluon.nn.Dense(3, activation="relu"))
      net2.hybridize()
      net2.initialize(device=device)
      net2.cast(dtype)
      with mx.autograd.record():
          out = net2(mx.np.ones((2, 3, 10), dtype=dtype, device=device))
          out.backward()
          out = out.asnumpy()
  
      net3 = gluon.nn.HybridSequential()
      net3.add(gluon.rnn.LSTM(10, bidirectional=True, dtype=dtype))
      net3.add(gluon.nn.BatchNorm(axis=2))
      net3.add(gluon.nn.Flatten())
      net3.add(gluon.nn.Dense(3, activation="relu"))
      net3.hybridize()
      net3.initialize(device=device)
      net3.cast(dtype2)
      with mx.autograd.record():
          out = net3(
              mx.np.ones((2, 3, 10), dtype=dtype2, device=device)
          )
          out.backward()
          out = out.asnumpy()
  
imports: import mxnet
  from mxnet import gluon, np
  import numpy
  import copy
  from functools import partial
  from numpy.testing import assert_allclose
  from mxnet.gluon.utils import split_rnn_params
  import pytest
  from mxnet.test_utils import almost_equal, assert_almost_equal, default_device
  from common import assert_raises_cudnn_not_satisfied, retry
label_desc: Use image node_id 20 for calling a global function with example usage: run_rnn_layers(dtype, dtype2) without return types