code: def resnet(
      scope: Scope,
      x,
      block_sizes=(3, 4, 6, 3),
      features=16,
      num_classes=1000,
      dtype=jnp.float32,
      norm=default_norm,
      act=nn.relu,
  ):
      conv = partial(nn.conv, bias=False, dtype=dtype)
      norm = partial(norm, dtype=dtype)
  
      x = scope.child(conv, "init_conv")(
          x, 16, (7, 7), padding=((3, 3), (3, 3))
      )
      x = scope.child(norm, "init_bn")(x)
      x = act(x)
      x = nn.max_pool(x, (2, 2), (2, 2), "SAME")
  
      for i, size in enumerate(block_sizes):
          for j in range(size):
              strides = (1, 1)
              if i > 0 and j == 0:
                  strides = (2, 2)
              block_features = features * 2**i
              block_scope = scope.push(f"block_{i}_{j}")
              x = residual_block(
                  block_scope,
                  x,
                  conv,
                  norm,
                  act,
                  block_features,
                  strides,
              )
              # we can access parameters of the sub module by operating on the scope
              # Example:
              # block_scope.get_kind('params')['conv_1']['kernel']
      x = jnp.mean(x, (1, 2))
      x = scope.child(nn.dense, "out")(x, num_classes)
      return x
  
file_path: flax/tests/core/design/core_resnet_test.py
imports: from functools import partial
  import jax
  from absl.testing import absltest
  from jax import numpy
  from jax import random
  from flax.core import Array, Scope, init, nn, unfreeze
label_desc: Use image node_id 2 for calling a global function with example usage: resnet(scope, x, block_sizes, features, num_classes, dtype, norm, act) and returns: x