class_docstr: AnyNet model. See :paper:`dds`.
class_docstr_tok: ["AnyNet","model",".","See",":","paper",":","`","dds","`","."]
docstr: Args:
      stem_class (callable): A callable taking 4 arguments (channels in, channels out,
          normalization, callable returning an activation function) that returns another
          callable implementing the stem module.
      stem_width (int): The number of output channels that the stem produces.
      block_class (callable): A callable taking 6 arguments (channels in, channels out,
          stride, normalization, callable returning an activation function, a dict of
          block-specific parameters) that returns another callable implementing the repeated
          block module.
      depths (list[int]): Number of blocks in each stage.
      widths (list[int]): For each stage, the number of output channels of each block.
      group_widths (list[int]): For each stage, the number of channels per group in group
          convolution, if the block uses group convolution.
      strides (list[int]): The stride that each network stage applies to its input.
      bottleneck_ratios (list[float]): For each stage, the ratio of the number of bottleneck
          channels to the number of block input channels (or, equivalently, output channels),
          if the block uses a bottleneck.
      se_ratio (float): The ratio of the number of channels used inside the squeeze-excitation
          (SE) module to it number of input channels, if SE the block uses SE.
      activation_class (callable): A callable taking no arguments that returns another
          callable implementing an activation function.
      freeze_at (int): The number of stages at the beginning to freeze.
          see :meth:`freeze` for detailed explanation.
      norm (str or callable): normalization for all conv layers.
          See :func:`layers.get_norm` for supported format.
      out_features (list[str]): name of the layers whose outputs should
          be returned in forward. RegNet's use "stem" and "s1", "s2", etc for the stages after
          the stem. If None, will return the output of the last layer.
code: def __init__(
      self,
      *,
      stem_class,
      stem_width,
      block_class,
      depths,
      widths,
      group_widths,
      strides,
      bottleneck_ratios,
      se_ratio,
      activation_class,
      freeze_at=0,
      norm="BN",
      out_features=None,
  ):
      """
      Args:
          stem_class (callable): A callable taking 4 arguments (channels in, channels out,
              normalization, callable returning an activation function) that returns another
              callable implementing the stem module.
          stem_width (int): The number of output channels that the stem produces.
          block_class (callable): A callable taking 6 arguments (channels in, channels out,
              stride, normalization, callable returning an activation function, a dict of
              block-specific parameters) that returns another callable implementing the repeated
              block module.
          depths (list[int]): Number of blocks in each stage.
          widths (list[int]): For each stage, the number of output channels of each block.
          group_widths (list[int]): For each stage, the number of channels per group in group
              convolution, if the block uses group convolution.
          strides (list[int]): The stride that each network stage applies to its input.
          bottleneck_ratios (list[float]): For each stage, the ratio of the number of bottleneck
              channels to the number of block input channels (or, equivalently, output channels),
              if the block uses a bottleneck.
          se_ratio (float): The ratio of the number of channels used inside the squeeze-excitation
              (SE) module to it number of input channels, if SE the block uses SE.
          activation_class (callable): A callable taking no arguments that returns another
              callable implementing an activation function.
          freeze_at (int): The number of stages at the beginning to freeze.
              see :meth:`freeze` for detailed explanation.
          norm (str or callable): normalization for all conv layers.
              See :func:`layers.get_norm` for supported format.
          out_features (list[str]): name of the layers whose outputs should
              be returned in forward. RegNet's use "stem" and "s1", "s2", etc for the stages after
              the stem. If None, will return the output of the last layer.
      """
      super().__init__()
      self.stem = stem_class(3, stem_width, norm, activation_class)
  
      current_stride = self.stem.stride
      self._out_feature_strides = {"stem": current_stride}
      self._out_feature_channels = {"stem": self.stem.out_channels}
      self.stages_and_names = []
      prev_w = stem_width
  
      for i, (d, w, s, b, g) in enumerate(
          zip(depths, widths, strides, bottleneck_ratios, group_widths)
      ):
          params = {"bot_mul": b, "group_w": g, "se_r": se_ratio}
          stage = AnyStage(
              prev_w,
              w,
              s,
              d,
              block_class,
              norm,
              activation_class,
              params,
          )
          name = "s{}".format(i + 1)
          self.add_module(name, stage)
          self.stages_and_names.append((stage, name))
          self._out_feature_strides[name] = current_stride = int(
              current_stride
              * np.prod([k.stride for k in stage.children()])
          )
          self._out_feature_channels[name] = list(stage.children())[
              -1
          ].out_channels
          prev_w = w
  
      self.apply(init_weights)
  
      if out_features is None:
          out_features = [name]
      self._out_features = out_features
      assert len(self._out_features)
      children = [x[0] for x in self.named_children()]
      for out_feature in self._out_features:
          assert (
              out_feature in children
          ), "Available children: {} does not include {}".format(
              ", ".join(children), out_feature
          )
      self.freeze(freeze_at)
  
imports: import numpy
  from torch import nn
  from detectron2.layers import CNNBlockBase, ShapeSpec, get_norm
  from .backbone import Backbone
label_desc: Use image node_id 1 to create a new AnyNet object from inherited base classes: Backbone with example: obj = AnyNet()