code: def __init__(
      self,
      expansion: int,
      blocks: List[int],
      input_channels: int = 3,
      activation=ACT_RELU,
      layers=None,
      first_pool: Union[nn.MaxPool2d, nn.AvgPool2d] = nn.MaxPool2d,
      pretrained=None,
      block: Union[XResNetBlock, SEXResNetBlock] = XResNetBlock,
  ):
      assert len(blocks) == 4
      if layers is None:
          layers = [1, 2, 3, 4]
  
      n_filters = [64 // expansion, 64, 128, 256, 512]
      channels = [
          64,
          64 * expansion,
          128 * expansion,
          256 * expansion,
          512 * expansion,
      ]
  
      super().__init__(channels, [2, 4, 8, 16, 32], layers)
  
      res_layers = [
          self._make_layer(
              block,
              expansion,
              n_filters[i],
              n_filters[i + 1],
              n_blocks=l,
              stride=1 if i == 0 else 2,
              activation=activation,
          )
          for i, l in enumerate(blocks)
      ]
  
      self.stem = StemBlock(input_channels, 64, activation=activation)
      self.layer1 = nn.Sequential(
          OrderedDict(
              [
                  (
                      "pool",
                      first_pool(kernel_size=3, stride=2, padding=1),
                  ),
                  ("block", res_layers[0]),
              ]
          )
      )
  
      self.layer2 = res_layers[1]
      self.layer3 = res_layers[2]
      self.layer4 = res_layers[3]
  
imports: from collections import OrderedDict
  from typing import List, Union
  import torch
  from torch import nn
  from pytorch_toolbelt.modules import ACT_RELU, instantiate_activation_block, ChannelSpatialGate2d
  from pytorch_toolbelt.modules.encoders import EncoderModule, make_n_channel_input
label_desc: Use image node_id 1 to create a new XResNet object from inherited base classes: EncoderModule with example: obj = XResNet(expansion, blocks, input_channels, activation, layers, first_pool, pretrained, block)