class_docstr: Test case for the patch module.
class_docstr_tok: ["Test","case","for","the","patch","module","."]
docstr: Check that patched submodules can be called directly.
docstr_tok: ["Check","that","patched","submodules","can","be","called","directly","."]
code: def testSubModuleDirectCall(self):
      """Check that patched submodules can be called directly."""
  
      class Module(nn.Module):
          def __init__(self):
              super().__init__()
              self.submodule = nn.Linear(3, 4)
  
          def forward(self, inputs):
              return self.submodule(inputs)
  
      module = _NestedEnc(nn.Linear(3, 4))
      fmodule = higher.monkeypatch(module)
  
      xs = torch.randn(2, 3)
      fsubmodule = fmodule.f
  
      self.assertTrue(torch.equal(fmodule(xs), fsubmodule(xs)))
  
imports: import unittest
  from parameterized import parameterized
  import torch
  from torch import nn
  import higher
label_desc: Use image node_id 14 for calling the TestPatch obj's underlying member method code with example usage: obj.testSubModuleDirectCall() and returns: self