How to create a self endecoder and decoder for semantic segmentation using pytorch

Hi all!
I am new in the field. I am trying to implement semantic segmentation. I used the pretrained models (as given below). It works fine. However, I am interested in creating self encoder and decoder. So that, I can modify only decoder for different applications. Can any one please suggest me any useful tutorial or pytorch library? Thank you.

# Pretrained Model : **Fully Convolutional Network (FCN)**
fcn = models.segmentation.fcn_resnet101(pretrained=True).eval()
dlab = models.segmentation.deeplabv3_resnet101(pretrained=1).eval()