class_docstr: RegNet backbone.
  
  More details can be found in `paper <https://arxiv.org/abs/2003.13678>`_ .
  
  Args:
      arch (dict): The parameter of RegNets.
  
          - w0 (int): initial width
          - wa (float): slope of width
          - wm (float): quantization parameter to quantize the width
          - depth (int): depth of the backbone
          - group_w (int): width of group
          - bot_mul (float): bottleneck ratio, i.e. expansion of bottlneck.
      strides (Sequence[int]): Strides of the first block of each stage.
      base_channels (int): Base channels after stem layer.
      in_channels (int): Number of input image channels. Default: 3.
      dilations (Sequence[int]): Dilation of each stage.
      out_indices (Sequence[int]): Output from which stages.
      style (str): `pytorch` or `caffe`. If set to "pytorch", the stride-two
          layer is the 3x3 conv layer, otherwise the stride-two layer is
          the first 1x1 conv layer.
      frozen_stages (int): Stages to be frozen (all param fixed). -1 means
          not freezing any parameters.
      norm_cfg (dict): dictionary to construct and config norm layer.
      norm_eval (bool): Whether to set norm layers to eval mode, namely,
          freeze running stats (mean and var). Note: Effect on Batch Norm
          and its variants only.
      with_cp (bool): Use checkpoint or not. Using checkpoint will save some
          memory while slowing down the training speed.
      zero_init_residual (bool): whether to use zero init for last norm layer
          in resblocks to let them behave as identity.
  
  Example:
      >>> from mmdet.models import RegNet
      >>> import torch
      >>> self = RegNet(
              arch=dict(
                  w0=88,
                  wa=26.31,
                  wm=2.25,
                  group_w=48,
                  depth=25,
                  bot_mul=1.0))
      >>> self.eval()
      >>> inputs = torch.rand(1, 3, 32, 32)
      >>> level_outputs = self.forward(inputs)
      >>> for level_out in level_outputs:
      ...     print(tuple(level_out.shape))
      (1, 96, 8, 8)
      (1, 192, 4, 4)
      (1, 432, 2, 2)
      (1, 1008, 1, 1)
class_docstr_tok: ["RegNet","backbone",".","More","details","can","be","found","in","`","paper","<","https",":","\/\/arxiv.org\/abs\/2003.13678",">","`","_",".","Args",":","arch","(","dict",")",":","The","parameter","of","RegNets",".","-","w0","(","int",")",":","initial","width","-","wa","(","float",")",":","slope","of","width","-","wm","(","float",")",":","quantization","parameter","to","quantize","the","width","-","depth","(","int",")",":","depth","of","the","backbone","-","group_w","(","int",")",":","width","of","group","-","bot_mul","(","float",")",":","bottleneck","ratio",",","i.e",".","expansion","of","bottlneck",".","strides","(","Sequence","[","int","]",")",":","Strides","of","the","first","block","of","each","stage",".","base_channels","(","int",")",":","Base","channels","after","stem","layer",".","in_channels","(","int",")",":","Number","of","input","image","channels",".","Default",":","3.","dilations","(","Sequence","[","int","]",")",":","Dilation","of","each","stage",".","out_indices","(","Sequence","[","int","]",")",":","Output","from","which","stages",".","style","(","str",")",":","`","pytorch","`","or","`","caffe","`",".","If","set","to","``","pytorch","''",",","the","stride-two","layer","is","the","3x3","conv","layer",",","otherwise","the","stride-two","layer","is","the","first","1x1","conv","layer",".","frozen_stages","(","int",")",":","Stages","to","be","frozen","(","all","param","fixed",")",".","-1","means","not","freezing","any","parameters",".","norm_cfg","(","dict",")",":","dictionary","to","construct","and","config","norm","layer",".","norm_eval","(","bool",")",":","Whether","to","set","norm","layers","to","eval","mode",",","namely",",","freeze","running","stats","(","mean","and","var",")",".","Note",":","Effect","on","Batch","Norm","and","its","variants","only",".","with_cp","(","bool",")",":","Use","checkpoint","or","not",".","Using","checkpoint","will","save","some","memory","while","slowing","down","the","training","speed",".","zero_init_residual","(","bool",")",":","whether","to","use","zero","init","for","last","norm","layer","in","resblocks","to","let","them","behave","as","identity",".","Example",":",">",">",">","from","mmdet.models","import","RegNet",">",">",">","import","torch",">",">",">","self","=","RegNet","(","arch=dict","(","w0=88",",","wa=26.31",",","wm=2.25",",","group_w=48",",","depth=25",",","bot_mul=1.0",")",")",">",">",">","self.eval","(",")",">",">",">","inputs","=","torch.rand","(","1",",","3",",","32",",","32",")",">",">",">","level_outputs","=","self.forward","(","inputs",")",">",">",">","for","level_out","in","level_outputs",":","...","print","(","tuple","(","level_out.shape",")",")","(","1",",","96",",","8",",","8",")","(","1",",","192",",","4",",","4",")","(","1",",","432",",","2",",","2",")","(","1",",","1008",",","1",",","1",")"]
docstr: Generates per block width from RegNet parameters.
  
  Args:
      initial_width ([int]): Initial width of the backbone
      width_slope ([float]): Slope of the quantized linear function
      width_parameter ([int]): Parameter used to quantize the width.
      depth ([int]): Depth of the backbone.
      divisor (int, optional): The divisor of channels. Defaults to 8.
  
  Returns:
      list, int: return a list of widths of each stage and the number                 of stages
docstr_tok: ["Generates","per","block","width","from","RegNet","parameters",".","Args",":","initial_width","(","[","int","]",")",":","Initial","width","of","the","backbone","width_slope","(","[","float","]",")",":","Slope","of","the","quantized","linear","function","width_parameter","(","[","int","]",")",":","Parameter","used","to","quantize","the","width",".","depth","(","[","int","]",")",":","Depth","of","the","backbone",".","divisor","(","int",",","optional",")",":","The","divisor","of","channels",".","Defaults","to","8",".","Returns",":","list",",","int",":","return","a","list","of","widths","of","each","stage","and","the","number","of","stages"]
code: def generate_regnet(
      self,
      initial_width,
      width_slope,
      width_parameter,
      depth,
      divisor=8,
  ):
      """Generates per block width from RegNet parameters.
  
          Args:
              initial_width ([int]): Initial width of the backbone
              width_slope ([float]): Slope of the quantized linear function
              width_parameter ([int]): Parameter used to quantize the width.
              depth ([int]): Depth of the backbone.
              divisor (int, optional): The divisor of channels. Defaults to 8.
  
          Returns:
              list, int: return a list of widths of each stage and the number \
                  of stages
          """
      assert width_slope >= 0
      assert initial_width > 0
      assert width_parameter > 1
      assert initial_width % divisor == 0
      widths_cont = np.arange(depth) * width_slope + initial_width
      ks = np.round(
          np.log(widths_cont / initial_width) / np.log(width_parameter)
      )
      widths = initial_width * np.power(width_parameter, ks)
      widths = np.round(np.divide(widths, divisor)) * divisor
      num_stages = len(np.unique(widths))
      widths, widths_cont = (
          widths.astype(int).tolist(),
          widths_cont.tolist(),
      )
      return widths, num_stages
  
file_path: insightface/detection/scrfd/mmdet/models/backbones/regnet.py
imports: import numpy
  import torch.nn
  from mmcv.cnn import build_conv_layer, build_norm_layer
  from ..builder import BACKBONES
  from .resnet import ResNet
  from .resnext import Bottleneck
label_desc: Use image node_id 3 for calling the RegNet obj's underlying member method code with example usage: obj.generate_regnet(initial_width, width_slope, width_parameter, depth, divisor) and returns: widths,  num_stages