code: def simple_rnn(
      self,
      T,
      n,
      d,
      model,
      step,
      input_t,
      output_t,
      output_t_prev,
      input_blob,
      initial_input_blob,
  ):
      input = np.random.randn(T, n, d).astype(np.float32)
      initial_input = np.random.randn(1, n, d).astype(np.float32)
      print(locals())
      recurrent.recurrent_net(
          net=model.net,
          cell_net=step.net,
          inputs=[(input_t, input_blob)],
          initial_cell_inputs=[(output_t_prev, initial_input_blob)],
          links={output_t_prev: output_t},
          scope="test_rnn_sum_mull",
      )
      workspace.blobs[input_blob] = input
      workspace.blobs[initial_input_blob] = initial_input
  
      op = model.net._net.op[-1]
      # Just conviniently store all inputs in an array in the same
      # order as op.input
      inputs = [workspace.blobs[name] for name in op.input]
  
      def reference(input, initial_input):
          global_ws_name = workspace.CurrentWorkspace()
          input_all = workspace.blobs[input_blob]
  
          workspace.SwitchWorkspace("ref", create_if_missing=True)
          workspace.blobs[input_blob] = input
          workspace.blobs[output_t_prev] = initial_input.reshape(n, d)
          res_all = np.zeros(shape=input.shape, dtype=np.float32)
  
          for t_cur in range(T):
              workspace.blobs[input_t] = input_all[t_cur]
              workspace.RunNetOnce(step.net)
              result_t = workspace.blobs[output_t]
              workspace.blobs[output_t_prev] = result_t
              res_all[t_cur] = result_t
  
          workspace.SwitchWorkspace(global_ws_name)
  
          shape = list(input.shape)
          shape[0] = 1
          return (res_all, res_all[-1].reshape(shape))
  
      self.assertReferenceChecks(
          device_option=hu.cpu_do,
          op=op,
          inputs=inputs,
          reference=reference,
          output_to_grad=op.output[0],
          outputs_to_check=[0, 1],
      )
  
      self.assertGradientChecks(
          device_option=hu.cpu_do,
          op=op,
          inputs=inputs,
          outputs_to_check=0,
          outputs_with_grads=[0],
          threshold=0.01,
          stepsize=0.005,
      )
  
file_path: pytorch/caffe2/python/operator_test/recurrent_network_test.py
imports: from caffe2.python import recurrent, workspace
  from caffe2.python.model_helper import ModelHelper
  from hypothesis import given, settings
  import caffe2.python.hypothesis_test_util
  import caffe2.python.serialized_test.serialized_test_util
  import hypothesis.strategies
  import numpy
label_desc: Use image node_id 4 for calling the RecurrentNetworkTest obj's underlying member method code with example usage: obj.simple_rnn(T, n, d, model, step, input_t, output_t, output_t_prev, input_blob, initial_input_blob) and returns: res_all,  res_all