class_docstr: Test functionality of SkorchDoctor using a simple model
class_docstr_tok: ["Test","functionality","of","SkorchDoctor","using","a","simple","model"]
code: def test_gradient_recs_values(self, doctor):
      recs_module = doctor.gradient_recs_["module"]
  
      expected_shapes = {
          "lin0.weight": (20, 20),
          "lin0.bias": (20,),
          "lin1.weight": (2, 20),
          "lin1.bias": (2,),
      }
      for key in (
          "lin0.weight",
          "lin0.bias",
          "lin1.weight",
          "lin1.bias",
      ):
          grad_shapes = [batch[key].shape for batch in recs_module]
          expected_shape = expected_shapes[key]
          # 2 batches, 3 epochs
          assert grad_shapes == [expected_shape] * 6
  
      # There is not really much we know about the gradient values, we just
      # rely on the gradient hooks doing what they're supposed to do. The only
      # gradients we actually know are for the first layer in the first batch:
      # They have to be zero because in the second layer, we have weights of 0.
  
      batch0 = recs_module[0]
      grad_weight = batch0["lin0.weight"]
      grad_bias = batch0["lin0.bias"]
      assert np.allclose(grad_weight, 0.0)
      assert np.allclose(grad_bias, 0.0)
  
imports: import itertools
  from unittest import mock
  import numpy
  import pytest
  import torch
  from torch import nn
label_desc: Use image node_id 11 for calling the TestSkorchDoctorSimple obj's underlying member method code with example usage: obj.test_gradient_recs_values(doctor) without return types