class_docstr: When stride = 1, the block receives input with 2 * inp channels. Otherwise inp channels.
code: def __init__(
      self,
      inp,
      oup,
      mid_channels,
      ksize,
      stride,
      sequence="pdp",
      affine=True,
  ):
      super().__init__()
      assert stride in [1, 2]
      assert ksize in [3, 5, 7]
      self.channels = inp // 2 if stride == 1 else inp
      self.inp = inp
      self.oup = oup
      self.mid_channels = mid_channels
      self.ksize = ksize
      self.stride = stride
      self.pad = ksize // 2
      self.oup_main = oup - self.channels
      self._affine = affine
      assert self.oup_main > 0
  
      self.branch_main = nn.Sequential(
          *self._decode_point_depth_conv(sequence)
      )
  
      # FIXME: restore before merging into master
      # remove if stride == 2 for torchscript
      self.branch_proj = nn.Sequential(
          # dw
          nn.Conv2d(
              self.channels,
              self.channels,
              ksize,
              stride,
              self.pad,
              groups=self.channels,
              bias=False,
          ),
          nn.BatchNorm2d(self.channels, affine=affine),
          # pw-linear
          nn.Conv2d(self.channels, self.channels, 1, 1, 0, bias=False),
          nn.BatchNorm2d(self.channels, affine=affine),
          nn.ReLU(inplace=True),
      )
  
file_path: nni/examples/nas/legacy/oneshot/spos/blocks.py
imports: import torch
  import nni.retiarii.nn.pytorch
label_desc: Use image node_id 1 to create a new ShuffleNetBlock object from inherited base classes: nn with example: obj = ShuffleNetBlock(inp, oup, mid_channels, ksize, stride, sequence, affine)