class_docstr: Test case for the patch module.
class_docstr_tok: ["Test","case","for","the","patch","module","."]
code: def testMiniMAMLTestTime(self, _, model_builder):
      model = model_builder(self)
      opt = torch.optim.SGD(model.parameters(), lr=self.lr)
  
      ctx_opts = {
          "copy_initial_weights": False,
          "track_higher_grads": False,
      }
      with higher.innerloop_ctx(model, opt, **ctx_opts) as (
          fmodel,
          diffopt,
      ):
          init_params = fmodel.parameters(time=0)
          for _ in range(10):
              inputs = torch.rand(8, 4)
              loss = fmodel(inputs).sum().pow(2)
              diffopt.step(loss)
          param_sum = sum(p.sum() for p in fmodel.parameters())
          final_grads = torch.autograd.grad(
              param_sum, init_params, allow_unused=True
          )
          param_sum.backward()
          for p, g in zip(model.parameters(), final_grads):
              self.assertIsNone(p.grad)
              self.assertIsNone(g)
  
imports: import unittest
  from parameterized import parameterized
  import torch
  from torch import nn
  import higher
label_desc: Use image node_id 13 for calling the TestPatch obj's underlying member method code with example usage: obj.testMiniMAMLTestTime(_, model_builder) without return types