code: def test_rnn_cells_export_import():
      class RNNLayer(gluon.HybridBlock):
          def __init__(self):
              super(RNNLayer, self).__init__()
              self.cell = gluon.rnn.RNNCell(hidden_size=1)
  
          def forward(self, seq):
              outputs, state = self.cell.unroll(
                  inputs=seq, length=2, merge_outputs=True
              )
              return outputs
  
          def infer_shape(self, input):
              self.cell.infer_shape(0, input, False)
  
      class LSTMLayer(gluon.HybridBlock):
          def __init__(self):
              super(LSTMLayer, self).__init__()
              self.cell = gluon.rnn.LSTMCell(hidden_size=1)
  
          def forward(self, seq):
              outputs, state = self.cell.unroll(
                  inputs=seq, length=2, merge_outputs=True
              )
              return outputs
  
          def infer_shape(self, input):
              self.cell.infer_shape(0, input, False)
  
      class GRULayer(gluon.HybridBlock):
          def __init__(self):
              super(GRULayer, self).__init__()
              self.cell = gluon.rnn.GRUCell(hidden_size=1)
  
          def forward(self, seq):
              outputs, state = self.cell.unroll(
                  inputs=seq, length=2, merge_outputs=True
              )
              return outputs
  
          def infer_shape(self, input):
              self.cell.infer_shape(0, input, False)
  
      for hybrid in [RNNLayer(), LSTMLayer(), GRULayer()]:
          input = mx.np.ones(
              shape=(1, 2, 1), device=mx.device.current_device()
          )
          hybrid.infer_shape(input)
          hybrid.initialize()
          hybrid.hybridize()
          output1 = hybrid(input)
          hybrid.export(path="./model", epoch=0)
          symbol = mx.gluon.SymbolBlock.imports(
              symbol_file="./model-symbol.json",
              input_names=["data"],
              param_file="./model-0000.params",
              device=mx.device.current_device(),
          )
          output2 = symbol(input)
          assert_almost_equal(output1.asnumpy(), output2.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 18 for calling a global function with example usage: test_rnn_cells_export_import() and returns: outputs, outputs, outputs