class_docstr: Test case for the patch module.
class_docstr_tok: ["Test","case","for","the","patch","module","."]
code: def testRNNCellForward(self, _, cell_constructor, output_selector):
      num_layers = 2
      hidden_size = 20
      num_feats = 10
  
      batch_size = 3
      seq_length = 5
  
      for _ in range(10):
          cell = cell_constructor(num_feats, hidden_size, num_layers)
          fcell = higher.patch.monkeypatch(cell)
  
          state = fstate = None
          for _ in range(seq_length):
              inputs = torch.randn(batch_size, num_feats)
  
              state = cell(inputs, state)
              fstate = fcell(inputs, fstate)
  
              if isinstance(state, tuple):
                  self.assertEqual(len(state), len(fstate))
                  for s, fs in zip(state, fstate):
                      torch.testing.assert_allclose(s, fs)
              else:
                  torch.testing.assert_allclose(state, fstate)
  
imports: import unittest
  from parameterized import parameterized
  import torch
  from torch import nn
  import higher
label_desc: Use image node_id 9 for calling the TestPatch obj's underlying member method code with example usage: obj.testRNNCellForward(_, cell_constructor, output_selector) without return types