code: def test_num_params(self, resnet_class_and_num_params, resnet_v2):
      resnet_class, expected_num_params = resnet_class_and_num_params
  
      def model_func(img):
          model = resnet_class(1000, resnet_v2=resnet_v2)
          return model(img, is_training=True)
  
      model = hk.transform_with_state(model_func)
      image = jnp.ones([2, 64, 64, 3])
      rng = jax.random.PRNGKey(0)
      params, _ = model.init(rng, image)
      num_params = sum(
          np.prod(p.shape).item()
          for p in jax.tree_util.tree_leaves(params)
      )
      self.assertGreater(num_params, int(0.998 * expected_num_params))
      self.assertLess(num_params, int(1.002 * expected_num_params))
  
file_path: dm-haiku/haiku/_src/nets/resnet_test.py
imports: from absl.testing import absltest
  from absl.testing import parameterized
  import haiku
  from haiku._src import test_utils
  from haiku._src import transform
  from haiku._src.nets import resnet
  import jax
  import jax.numpy
  import numpy
label_desc: Use image node_id 5 for calling the ResnetTest obj's underlying member method code with example usage: obj.test_num_params(resnet_class_and_num_params, resnet_v2) and returns: model