class_docstr: ResNet model.
class_docstr_tok: ["ResNet","model","."]
docstr: Constructs a ResNet model.
  
  Args:
    blocks_per_group_list: A sequence of length 4 that indicates the number of
      blocks created in each group.
    num_classes: The number of classes to classify the inputs into.
    bn_config: A dictionary of two elements, `decay_rate` and `eps` to be
      passed on to the `BatchNorm` layers. By default the `decay_rate` is
      `0.9` and `eps` is `1e-5`.
    resnet_v2: Whether to use the v1 or v2 ResNet implementation. Defaults to
      False.
    channels_per_group_list: A sequence of length 4 that indicates the number
      of channels used for each block in each group.
    name: Name of the module.
docstr_tok: ["Constructs","a","ResNet","model",".","Args",":","blocks_per_group_list",":","A","sequence","of","length","4","that","indicates","the","number","of","blocks","created","in","each","group",".","num_classes",":","The","number","of","classes","to","classify","the","inputs","into",".","bn_config",":","A","dictionary","of","two","elements",",","`","decay_rate","`","and","`","eps","`","to","be","passed","on","to","the","`","BatchNorm","`","layers",".","By","default","the","`","decay_rate","`","is","`","0.9","`","and","`","eps","`","is","`","1e-5","`",".","resnet_v2",":","Whether","to","use","the","v1","or","v2","ResNet","implementation",".","Defaults","to","False",".","channels_per_group_list",":","A","sequence","of","length","4","that","indicates","the","number","of","channels","used","for","each","block","in","each","group",".","name",":","Name","of","the","module","."]
code: def __init__(
      self,
      blocks_per_group_list: Sequence[int],
      num_classes: int,
      bn_config: Optional[Mapping[str, float]] = None,
      resnet_v2: bool = False,
      channels_per_group_list: Sequence[int] = (256, 512, 1024, 2048),
      name: Optional[str] = None,
  ):
      """Constructs a ResNet model.
  
      Args:
        blocks_per_group_list: A sequence of length 4 that indicates the number of
          blocks created in each group.
        num_classes: The number of classes to classify the inputs into.
        bn_config: A dictionary of two elements, `decay_rate` and `eps` to be
          passed on to the `BatchNorm` layers. By default the `decay_rate` is
          `0.9` and `eps` is `1e-5`.
        resnet_v2: Whether to use the v1 or v2 ResNet implementation. Defaults to
          False.
        channels_per_group_list: A sequence of length 4 that indicates the number
          of channels used for each block in each group.
        name: Name of the module.
      """
      super().__init__(name=name)
      if bn_config is None:
          bn_config = {"decay_rate": 0.9, "eps": 1e-5}
      self._bn_config = bn_config
      self._resnet_v2 = resnet_v2
  
      # Number of blocks in each group for ResNet.
      if len(blocks_per_group_list) != 4:
          raise ValueError(
              "`blocks_per_group_list` must be of length 4 not {}".format(
                  len(blocks_per_group_list)
              )
          )
      self._blocks_per_group_list = blocks_per_group_list
  
      # Number of channels in each group for ResNet.
      if len(channels_per_group_list) != 4:
          raise ValueError(
              "`channels_per_group_list` must be of length 4 not {}".format(
                  len(channels_per_group_list)
              )
          )
      self._channels_per_group_list = channels_per_group_list
  
      self._initial_conv = conv.Conv2D(
          output_channels=64,
          kernel_shape=7,
          stride=2,
          with_bias=False,
          padding=pad.same,
          name="initial_conv",
      )
      if not self._resnet_v2:
          self._initial_batchnorm = batch_norm.BatchNorm(
              create_scale=True,
              create_offset=True,
              name="initial_batchnorm",
              **bn_config,
          )
  
      self._block_groups = []
      strides = [1, 2, 2, 2]
      for i in range(4):
          self._block_groups.append(
              BlockGroup(
                  channels=self._channels_per_group_list[i],
                  num_blocks=self._blocks_per_group_list[i],
                  stride=strides[i],
                  bn_config=bn_config,
                  resnet_v2=resnet_v2,
                  name="block_group_%d" % (i),
              )
          )
  
      if self._resnet_v2:
          self._final_batchnorm = batch_norm.BatchNorm(
              create_scale=True,
              create_offset=True,
              name="final_batchnorm",
              **bn_config,
          )
  
      self._logits = linear.Linear(
          output_size=num_classes,
          w_init=initializers.Zeros(),
          name="logits",
      )
  
imports: from typing import Mapping, Optional, Sequence, Union
  from sonnet.src import base
  from sonnet.src import batch_norm
  from sonnet.src import conv
  from sonnet.src import initializers
  from sonnet.src import linear
  from sonnet.src import pad
  import tensorflow
label_desc: Use image node_id 1 to create a new ResNet object from inherited base classes: base with example: obj = ResNet(blocks_per_group_list, num_classes, bn_config, resnet_v2, channels_per_group_list, name)