class_docstr: DepthwiseSeparable block
  Used for DS convs in MobileNet-V1 and in the place of IR blocks with an expansion
  factor of 1.0. This is an alternative to having a IR with optional first pw conv.
class_docstr_tok: ["DepthwiseSeparable","block","Used","for","DS","convs","in","MobileNet-V1","and","in","the","place","of","IR","blocks","with","an","expansion","factor","of","1.0",".","This","is","an","alternative","to","having","a","IR","with","optional","first","pw","conv","."]
code: def __init__(
      self,
      in_chs,
      out_chs,
      dw_kernel_size=3,
      stride=1,
      pad_type="",
      act_layer=nn.ReLU,
      noskip=False,
      pw_kernel_size=1,
      pw_act=False,
      se_ratio=0.0,
      se_kwargs=None,
      norm_layer=nn.BatchNorm2d,
      norm_kwargs=None,
      drop_connect_rate=0.0,
  ):
      super(DepthwiseSeparableConv, self).__init__()
      assert stride in [1, 2]
      norm_kwargs = norm_kwargs or {}
      self.has_residual = (
          stride == 1 and in_chs == out_chs
      ) and not noskip
      self.drop_connect_rate = drop_connect_rate
  
      self.conv_dw = select_conv2d(
          in_chs,
          in_chs,
          dw_kernel_size,
          stride=stride,
          padding=pad_type,
          depthwise=True,
      )
      self.bn1 = norm_layer(in_chs, **norm_kwargs)
      self.act1 = act_layer(inplace=True)
  
      # Squeeze-and-excitation
      if se_ratio is not None and se_ratio > 0.0:
          se_kwargs = resolve_se_args(se_kwargs, in_chs, act_layer)
          self.se = SqueezeExcite(
              in_chs, se_ratio=se_ratio, **se_kwargs
          )
      else:
          self.se = nn.Identity()
  
      self.conv_pw = select_conv2d(
          in_chs, out_chs, pw_kernel_size, padding=pad_type
      )
      self.bn2 = norm_layer(out_chs, **norm_kwargs)
      self.act2 = act_layer(inplace=True) if pw_act else nn.Identity()
  
imports: import re
  from copy import deepcopy
  from .conv2d_layers import *
  from geffnet.activations import *
label_desc: Use image node_id 1 to create a new DepthwiseSeparableConv object from inherited base classes: nn with example: obj = DepthwiseSeparableConv(in_chs, out_chs, dw_kernel_size, stride, pad_type, act_layer, noskip, pw_kernel_size, pw_act, se_ratio, se_kwargs, norm_layer, norm_kwargs, drop_connect_rate)