PyTorch - How to derive manually ResNet?
I managed to find this implementation of ResNet-18:

def __init__(self): 
    super(ResNet18,self).__init__()
    self.block1 = nn.Sequential(
        nn.Conv2d(1,64,kernel_size=2,stride=2,padding=3,bias=False),
        nn.BatchNorm2d(64),
        nn.ReLU(True)
    )
    self.block2 = nn.Sequential(
       nn.MaxPool2d(1,1),
       ResidualBlock(64,64),
       ResidualBlock(64,64,2)
    )
    self.block3 = nn.Sequential(
        ResidualBlock(64,128),
        ResidualBlock(128,128,2)
    )
    self.block4 = nn.Sequential(
        ResidualBlock(128,256),
        ResidualBlock(256,256,2)
    )
    self.block5 = nn.Sequential(
        ResidualBlock(256,512),
        ResidualBlock(512,512,2)
    )
    self.avgpool = nn.AvgPool2d(2) 
    # vowel_diacritic 
    self.fc1 = nn.Linear(512,11)
    # grapheme_root
    self.fc2 = nn.Linear(512,168)
    # consonant_diacritic
    self.fc3 = nn.Linear(512,7)

def forward(self,x):
    x = self.block1(x)
    x = self.block2(x)
    x = self.block3(x)
    x = self.block4(x)
    x = self.block5(x)
    x = self.avgpool(x)
    x = x.view(x.size(0),-1)
    x1 = self.fc1(x)
    x2 = self.fc2(x)
    x3 = self.fc3(x)
    return x1,x2,x3

class ResidualBlock(nn.Module):

    def __init__(self,in_channels,out_channels,stride=1,kernel_size=3,padding=1,bias=False):
        super(ResidualBlock,self).__init__()
        self.cnn1 = nn.Sequential(nn.Conv2d(in_channels,out_channels,kernel_size,stride,padding,bias=False), nn.BatchNorm2d(out_channels), nn.ReLU(True) )

        self.cnn2 = nn.Sequential( nn.Conv2d(out_channels,out_channels,kernel_size,1,padding,bias=False), nn.BatchNorm2d(out_channels) ) 

        if stride != 1 or in_channels != out_channels: 
            self.shortcut = nn.Sequential( nn.Conv2d(in_channels,out_channels,kernel_size=1,stride=stride,bias=False), nn.BatchNorm2d(out_channels) ) 
        else: 
            self.shortcut = nn.Sequential() 

    def forward(self,x): 
        residual = x 
        x = self.cnn1(x) 
        x = self.cnn2(x) 
        x += self.shortcut(residual) 
        x = nn.ReLU(True)(x) 
        return x


I am still new to PyTorch and I am trying to obtain the architectures for ResNets 34, 50 and 101 in a similar format as above for ResNet18. Initially I thought that the only changes that I have to make are the last parameter of each block according to the source GitHub code at https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py, where for ResNet34 we have return _resnet('resnet34', BasicBlock, [3, 4, 6, 3], pretrained, progress, **kwargs). 

Am I doing this wrong? I am still reading up on the documentation and trying to make sense of the methodologies, so some guidance will be deeply appreciated. :')

Coming from a TensorFlow background with a flavour of FastAi: you can use all those  ResNet variants if you import them directly from torchvision module:

#Download the pretrained model
import torch
import torchvision.models as models
model = models.resnet18(pretrained = True) #change here to whatever model you want

#Switch device to gpu if available
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

