I think the implementation of ResNet in PyTorch is complicated. They used this block expansions as factors, and if I recall they used dilation extensively although it was constant 1 all the time.
You may assume they wrote it this way to help their researches experiment.
If you need simpler implementation check it from resnet from scratch 2.