code: def build_resnet_v1(
      input_shape,
      depth,
      num_classes=10,
      num_filters=16,
      l2_reg_weight=1e-4,
      return_logits=False,
  ):
      """Returns a Model object for ResNet V1."""
      if (depth - 2) % 6 != 0:
          raise ValueError(
              "depth should be 6n+2 (eg 14, 20, 32, 44, 50)"
          )
      # Start model definition.
      num_res_blocks = int((depth - 2) / 6)
      logging.info("Starting ResNet build.")
      inputs = tf.keras.layers.Input(shape=input_shape, name="image")
  
      x = _resnet_layer(
          inputs,
          num_filters=num_filters,
          l2_regularization_weight=l2_reg_weight,
      )
      # Instantiate the stack of residual units
      for stack in range(3):
          for res_block in range(num_res_blocks):
              logging.info(
                  "Starting ResNet stack #%d block #%d.",
                  stack,
                  res_block,
              )
              strides = 1
              if (
                  stack > 0 and res_block == 0
              ):  # first layer but not first stack
                  strides = 2  # downsample
              y = _resnet_layer(
                  inputs=x,
                  num_filters=num_filters,
                  strides=strides,
                  l2_regularization_weight=l2_reg_weight,
              )
              y = _resnet_layer(
                  inputs=y,
                  num_filters=num_filters,
                  activation=None,
                  l2_regularization_weight=l2_reg_weight,
              )
              if (
                  stack > 0 and res_block == 0
              ):  # first layer but not first stack
                  # linear projection residual shortcut connection to match changed dims
                  x = _resnet_layer(
                      inputs=x,
                      num_filters=num_filters,
                      kernel_size=1,
                      strides=strides,
                      activation=None,
                      batch_norm=False,
                      l2_regularization_weight=l2_reg_weight,
                  )
              x = tf.keras.layers.add([x, y])
              x = tf.keras.layers.Activation("relu")(x)
          num_filters *= 2
  
      # Add classifier on top.
      # v1 does not use BN after last shortcut connection-ReLU
      x = tf.keras.layers.AveragePooling2D(pool_size=x.shape[1:3])(x)
      y = tf.keras.layers.Flatten()(x)
      outputs = tf.keras.layers.Dense(
          num_classes,
          activation=None if return_logits else "softmax",
          kernel_initializer="he_normal",
      )(y)
  
      return tf.keras.Model(inputs=inputs, outputs=outputs)
  
imports: from absl import logging
  import gin
  import tensorflow.compat.v2
label_desc: Use image node_id 2 for calling a global function with example usage: build_resnet_v1(input_shape, depth, num_classes, num_filters, l2_reg_weight, return_logits) and returns: tf