class_docstr: ResNeSt Model
  Parameters
  ----------
  block : Block
      Class for the residual block. Options are BasicBlockV1, BottleneckV1.
  layers : list of int
      Numbers of layers in each block
  classes : int, default 1000
      Number of classification classes.
  dilated : bool, default False
      Applying dilation strategy to pretrained ResNet yielding a stride-8 model,
      typically used in Semantic Segmentation.
  norm_layer : object
      Normalization layer used (default: :class:`mxnet.gluon.nn.BatchNorm`)
      Can be :class:`mxnet.gluon.nn.BatchNorm` or :class:`mxnet.gluon.contrib.nn.SyncBatchNorm`.
  last_gamma : bool, default False
      Whether to initialize the gamma of the last BatchNorm layer in each bottleneck to zero.
  deep_stem : bool, default False
      Whether to replace the 7x7 conv1 with 3 3x3 convolution layers.
  avg_down : bool, default False
      Whether to use average pooling for projection skip connection between stages/downsample.
  final_drop : float, default 0.0
      Dropout ratio before the final classification layer.
  use_global_stats : bool, default False
      Whether forcing BatchNorm to use global statistics instead of minibatch statistics;
      optionally set to True if finetuning using ImageNet classification pretrained models.
  Reference:
      - He, Kaiming, et al. "Deep residual learning for image recognition."
      Proceedings of the IEEE conference on computer vision and pattern recognition. 2016.
      - Yu, Fisher, and Vladlen Koltun. "Multi-scale context aggregation by dilated convolutions."
class_docstr_tok: ["ResNeSt","Model","Parameters","--","--","--","--","--","block",":","Block","Class","for","the","residual","block",".","Options","are","BasicBlockV1",",","BottleneckV1",".","layers",":","list","of","int","Numbers","of","layers","in","each","block","classes",":","int",",","default","1000","Number","of","classification","classes",".","dilated",":","bool",",","default","False","Applying","dilation","strategy","to","pretrained","ResNet","yielding","a","stride-8","model",",","typically","used","in","Semantic","Segmentation",".","norm_layer",":","object","Normalization","layer","used","(","default",":",":","class",":","`","mxnet.gluon.nn.BatchNorm","`",")","Can","be",":","class",":","`","mxnet.gluon.nn.BatchNorm","`","or",":","class",":","`","mxnet.gluon.contrib.nn.SyncBatchNorm","`",".","last_gamma",":","bool",",","default","False","Whether","to","initialize","the","gamma","of","the","last","BatchNorm","layer","in","each","bottleneck","to","zero",".","deep_stem",":","bool",",","default","False","Whether","to","replace","the","7x7","conv1","with","3","3x3","convolution","layers",".","avg_down",":","bool",",","default","False","Whether","to","use","average","pooling","for","projection","skip","connection","between","stages\/downsample",".","final_drop",":","float",",","default","0.0","Dropout","ratio","before","the","final","classification","layer",".","use_global_stats",":","bool",",","default","False","Whether","forcing","BatchNorm","to","use","global","statistics","instead","of","minibatch","statistics",";","optionally","set","to","True","if","finetuning","using","ImageNet","classification","pretrained","models",".","Reference",":","-","He",",","Kaiming",",","et","al",".","``","Deep","residual","learning","for","image","recognition",".","''","Proceedings","of","the","IEEE","conference","on","computer","vision","and","pattern","recognition",".","2016",".","-","Yu",",","Fisher",",","and","Vladlen","Koltun",".","``","Multi-scale","context","aggregation","by","dilated","convolutions",".","''"]
code: def __init__(
      self,
      block,
      layers,
      cardinality=1,
      bottleneck_width=64,
      classes=1000,
      dilated=False,
      dilation=1,
      norm_layer=BatchNorm,
      norm_kwargs=None,
      last_gamma=False,
      deep_stem=False,
      stem_width=32,
      avg_down=False,
      final_drop=0.0,
      use_global_stats=False,
      name_prefix="",
      dropblock_prob=0,
      input_size=224,
      use_splat=False,
      radix=2,
      avd=False,
      avd_first=False,
      split_drop_ratio=0,
  ):
      self.cardinality = cardinality
      self.bottleneck_width = bottleneck_width
      self.inplanes = stem_width * 2 if deep_stem else 64
      self.radix = radix
      self.split_drop_ratio = split_drop_ratio
      self.avd_first = avd_first
      super(ResNeSt, self).__init__(prefix=name_prefix)
      norm_kwargs = norm_kwargs if norm_kwargs is not None else {}
      if use_global_stats:
          norm_kwargs["use_global_stats"] = True
      self.norm_kwargs = norm_kwargs
      with self.name_scope():
          if not deep_stem:
              self.conv1 = nn.Conv2D(
                  channels=64,
                  kernel_size=7,
                  strides=2,
                  padding=3,
                  use_bias=False,
                  in_channels=3,
              )
          else:
              self.conv1 = nn.HybridSequential(prefix="conv1")
              self.conv1.add(
                  nn.Conv2D(
                      channels=stem_width,
                      kernel_size=3,
                      strides=2,
                      padding=1,
                      use_bias=False,
                      in_channels=3,
                  )
              )
              self.conv1.add(
                  norm_layer(in_channels=stem_width, **norm_kwargs)
              )
              self.conv1.add(nn.Activation("relu"))
              self.conv1.add(
                  nn.Conv2D(
                      channels=stem_width,
                      kernel_size=3,
                      strides=1,
                      padding=1,
                      use_bias=False,
                      in_channels=stem_width,
                  )
              )
              self.conv1.add(
                  norm_layer(in_channels=stem_width, **norm_kwargs)
              )
              self.conv1.add(nn.Activation("relu"))
              self.conv1.add(
                  nn.Conv2D(
                      channels=stem_width * 2,
                      kernel_size=3,
                      strides=1,
                      padding=1,
                      use_bias=False,
                      in_channels=stem_width,
                  )
              )
          input_size = _update_input_size(input_size, 2)
          self.bn1 = norm_layer(
              in_channels=64 if not deep_stem else stem_width * 2,
              **norm_kwargs,
          )
          self.relu = nn.Activation("relu")
          self.maxpool = nn.MaxPool2D(pool_size=3, strides=2, padding=1)
          input_size = _update_input_size(input_size, 2)
          self.layer1 = self._make_layer(
              1,
              block,
              64,
              layers[0],
              avg_down=avg_down,
              norm_layer=norm_layer,
              last_gamma=last_gamma,
              use_splat=use_splat,
              avd=avd,
          )
          self.layer2 = self._make_layer(
              2,
              block,
              128,
              layers[1],
              strides=2,
              avg_down=avg_down,
              norm_layer=norm_layer,
              last_gamma=last_gamma,
              use_splat=use_splat,
              avd=avd,
          )
          input_size = _update_input_size(input_size, 2)
          if dilated or dilation == 4:
              self.layer3 = self._make_layer(
                  3,
                  block,
                  256,
                  layers[2],
                  strides=1,
                  dilation=2,
                  avg_down=avg_down,
                  norm_layer=norm_layer,
                  last_gamma=last_gamma,
                  dropblock_prob=dropblock_prob,
                  input_size=input_size,
                  use_splat=use_splat,
                  avd=avd,
              )
              self.layer4 = self._make_layer(
                  4,
                  block,
                  512,
                  layers[3],
                  strides=1,
                  dilation=4,
                  pre_dilation=2,
                  avg_down=avg_down,
                  norm_layer=norm_layer,
                  last_gamma=last_gamma,
                  dropblock_prob=dropblock_prob,
                  input_size=input_size,
                  use_splat=use_splat,
                  avd=avd,
              )
          elif dilation == 3:
              # special
              self.layer3 = self._make_layer(
                  3,
                  block,
                  256,
                  layers[2],
                  strides=1,
                  dilation=2,
                  avg_down=avg_down,
                  norm_layer=norm_layer,
                  last_gamma=last_gamma,
                  dropblock_prob=dropblock_prob,
                  input_size=input_size,
                  use_splat=use_splat,
                  avd=avd,
              )
              self.layer4 = self._make_layer(
                  4,
                  block,
                  512,
                  layers[3],
                  strides=2,
                  dilation=2,
                  pre_dilation=2,
                  avg_down=avg_down,
                  norm_layer=norm_layer,
                  last_gamma=last_gamma,
                  dropblock_prob=dropblock_prob,
                  input_size=input_size,
                  use_splat=use_splat,
                  avd=avd,
              )
          elif dilation == 2:
              self.layer3 = self._make_layer(
                  3,
                  block,
                  256,
                  layers[2],
                  strides=2,
                  avg_down=avg_down,
                  norm_layer=norm_layer,
                  last_gamma=last_gamma,
                  dropblock_prob=dropblock_prob,
                  input_size=input_size,
                  use_splat=use_splat,
                  avd=avd,
              )
              self.layer4 = self._make_layer(
                  4,
                  block,
                  512,
                  layers[3],
                  strides=1,
                  dilation=2,
                  avg_down=avg_down,
                  norm_layer=norm_layer,
                  last_gamma=last_gamma,
                  dropblock_prob=dropblock_prob,
                  input_size=input_size,
                  use_splat=use_splat,
                  avd=avd,
              )
          else:
              self.layer3 = self._make_layer(
                  3,
                  block,
                  256,
                  layers[2],
                  strides=2,
                  avg_down=avg_down,
                  norm_layer=norm_layer,
                  last_gamma=last_gamma,
                  dropblock_prob=dropblock_prob,
                  input_size=input_size,
                  use_splat=use_splat,
                  avd=avd,
              )
              input_size = _update_input_size(input_size, 2)
              self.layer4 = self._make_layer(
                  4,
                  block,
                  512,
                  layers[3],
                  strides=2,
                  avg_down=avg_down,
                  norm_layer=norm_layer,
                  last_gamma=last_gamma,
                  dropblock_prob=dropblock_prob,
                  input_size=input_size,
                  use_splat=use_splat,
                  avd=avd,
              )
              input_size = _update_input_size(input_size, 2)
          self.avgpool = nn.GlobalAvgPool2D()
          self.flat = nn.Flatten()
          self.drop = None
          if final_drop > 0.0:
              self.drop = nn.Dropout(final_drop)
          self.fc = nn.Dense(
              in_units=512 * block.expansion, units=classes
          )
  
imports: from __future__ import division
  import math
  from mxnet.context import cpu
  from mxnet.gluon import nn
  from mxnet.gluon.block import HybridBlock
  from mxnet.gluon.nn import BatchNorm
  from ..nn.dropblock import DropBlock
  from ..nn.splat import SplitAttentionConv
label_desc: Use image node_id 1 to create a new ResNeSt object from inherited base classes: HybridBlock with example: obj = ResNeSt(block, layers, cardinality, bottleneck_width, classes, dilated, dilation, norm_layer, norm_kwargs, last_gamma, deep_stem, stem_width, avg_down, final_drop, use_global_stats, name_prefix, dropblock_prob, input_size, use_splat, radix, avd, avd_first, split_drop_ratio)