class_docstr: Xception optimized for the ImageNet dataset, as specified in
  https://arxiv.org/pdf/1610.02357.pdf
class_docstr_tok: ["Xception","optimized","for","the","ImageNet","dataset",",","as","specified","in","https",":","\/\/arxiv.org\/pdf\/1610.02357.pdf"]
docstr: Constructor
  Args:
      num_classes: number of classes
docstr_tok: ["Constructor","Args",":","num_classes",":","number","of","classes"]
code: def __init__(
      self,
      num_classes=1000,
      in_chans=3,
      drop_rate=0.0,
      global_pool="avg",
  ):
      """Constructor
      Args:
          num_classes: number of classes
      """
      super(Xception, self).__init__()
      self.drop_rate = drop_rate
      self.global_pool = global_pool
      self.num_classes = num_classes
      self.num_features = 2048
  
      self.conv1 = nn.Conv2d(in_chans, 32, 3, 2, 0, bias=False)
      self.bn1 = nn.BatchNorm2d(32)
      self.act1 = nn.ReLU(inplace=True)
  
      self.conv2 = nn.Conv2d(32, 64, 3, bias=False)
      self.bn2 = nn.BatchNorm2d(64)
      self.act2 = nn.ReLU(inplace=True)
  
      self.block1 = Block(64, 128, 2, 2, start_with_relu=False)
      self.block2 = Block(128, 256, 2, 2)
      self.block3 = Block(256, 728, 2, 2)
  
      self.block4 = Block(728, 728, 3, 1)
      self.block5 = Block(728, 728, 3, 1)
      self.block6 = Block(728, 728, 3, 1)
      self.block7 = Block(728, 728, 3, 1)
  
      self.block8 = Block(728, 728, 3, 1)
      self.block9 = Block(728, 728, 3, 1)
      self.block10 = Block(728, 728, 3, 1)
      self.block11 = Block(728, 728, 3, 1)
  
      self.block12 = Block(728, 1024, 2, 2, grow_first=False)
  
      self.conv3 = SeparableConv2d(1024, 1536, 3, 1, 1)
      self.bn3 = nn.BatchNorm2d(1536)
      self.act3 = nn.ReLU(inplace=True)
  
      self.conv4 = SeparableConv2d(1536, self.num_features, 3, 1, 1)
      self.bn4 = nn.BatchNorm2d(self.num_features)
      self.act4 = nn.ReLU(inplace=True)
      self.feature_info = [
          dict(num_chs=64, reduction=2, module="act2"),
          dict(num_chs=128, reduction=4, module="block2.rep.0"),
          dict(num_chs=256, reduction=8, module="block3.rep.0"),
          dict(num_chs=728, reduction=16, module="block12.rep.0"),
          dict(num_chs=2048, reduction=32, module="act4"),
      ]
  
      self.global_pool, self.fc = create_classifier(
          self.num_features, self.num_classes, pool_type=global_pool
      )
  
      # #------- init weights --------
      for m in self.modules():
          if isinstance(m, nn.Conv2d):
              nn.init.kaiming_normal_(
                  m.weight, mode="fan_out", nonlinearity="relu"
              )
          elif isinstance(m, nn.BatchNorm2d):
              m.weight.data.fill_(1)
              m.bias.data.zero_()
  
imports: import torch.jit
  import torch.nn
  import torch.nn.functional
  from timm.layers import create_classifier
  from ._builder import build_model_with_cfg
  from ._registry import register_model, generate_default_cfgs, register_model_deprecations
label_desc: Use image node_id 1 to create a new Xception object from inherited base classes: nn with example: obj = Xception(num_classes, in_chans, drop_rate, global_pool)