code: def _test_rnn_network(net, states):
      """Test network with given input data on both darknet and tvm"""
  
      def get_darknet_network_predict(net, data):
          return _lib().network_predict(net, data)
  
      ffi = FFI()
      np_arr = np.zeros([1, net.inputs], dtype="float32")
      np_arr[0, 2] = 1
      cffi_arr = ffi.cast("float*", np_arr.ctypes.data)
      tvm_out = _get_tvm_output(net, np_arr, states=states)[0]
      darknet_output = get_darknet_network_predict(net, cffi_arr)
      darknet_out = np.zeros(net.outputs, dtype="float32")
      for i in range(net.outputs):
          darknet_out[i] = darknet_output[i]
      last_layer = net.layers[net.n - 1]
      darknet_outshape = (last_layer.batch, last_layer.outputs)
      darknet_out = darknet_out.reshape(darknet_outshape)
      tvm.testing.assert_allclose(
          darknet_out, tvm_out, rtol=1e-4, atol=1e-4
      )
  
imports: from cffi import FFI
  import numpy
  import tvm
  from tvm.contrib import graph_executor
  from tvm.contrib.download import download_testdata
  from tvm.relay.testing.darknet import LAYERTYPE
  from tvm.relay.testing.darknet import __darknetffi__
  from tvm.relay.frontend.darknet import ACTIVATION
  from tvm import relay
label_desc: Use image node_id 8 for calling a global function with example usage: _test_rnn_network(net, states) and returns: _lib