class_docstr: A ResNet class that is similar to torchvision's but contains the following changes:
  - There are now 3 "stem" convolutions as opposed to 1, with an average pool instead of a max pool.
  - Performs anti-aliasing strided convolutions, where an avgpool is prepended to convolutions with stride > 1
  - The final pooling layer is a QKV attention instead of an average pool
class_docstr_tok: ["A","ResNet","class","that","is","similar","to","torchvision","'s","but","contains","the","following","changes",":","-","There","are","now","3","``","stem","''","convolutions","as","opposed","to","1",",","with","an","average","pool","instead","of","a","max","pool",".","-","Performs","anti-aliasing","strided","convolutions",",","where","an","avgpool","is","prepended","to","convolutions","with","stride",">","1","-","The","final","pooling","layer","is","a","QKV","attention","instead","of","an","average","pool"]
code: def __init__(
      self, layers, output_dim, heads, input_resolution=224, width=64
  ):
      super().__init__()
      self.output_dim = output_dim
      self.input_resolution = input_resolution
  
      # the 3-layer stem
      self.conv1 = nn.Conv2d(
          3, width // 2, kernel_size=3, stride=2, padding=1, bias=False
      )
      self.bn1 = nn.BatchNorm2d(width // 2)
      self.relu1 = nn.ReLU(inplace=True)
      self.conv2 = nn.Conv2d(
          width // 2, width // 2, kernel_size=3, padding=1, bias=False
      )
      self.bn2 = nn.BatchNorm2d(width // 2)
      self.relu2 = nn.ReLU(inplace=True)
      self.conv3 = nn.Conv2d(
          width // 2, width, kernel_size=3, padding=1, bias=False
      )
      self.bn3 = nn.BatchNorm2d(width)
      self.relu3 = nn.ReLU(inplace=True)
      self.avgpool = nn.AvgPool2d(2)
  
      # residual layers
      self._inplanes = (
          width  # this is a *mutable* variable used during construction
      )
      self.layer1 = self._make_layer(width, layers[0])
      self.layer2 = self._make_layer(width * 2, layers[1], stride=2)
      self.layer3 = self._make_layer(width * 4, layers[2], stride=2)
      self.layer4 = self._make_layer(width * 8, layers[3], stride=2)
  
      embed_dim = width * 32  # the ResNet feature dimension
      self.attnpool = AttentionPool2d(
          input_resolution // 32, embed_dim, heads, output_dim
      )
  
imports: from collections import OrderedDict
  from typing import Tuple, Union
  import numpy
  import torch
  import torch.nn.functional
  from torch import nn
label_desc: Use image node_id 1 to create a new ModifiedResNet object from inherited base classes: nn with example: obj = ModifiedResNet(layers, output_dim, heads, input_resolution, width)