To just add some extra information, if you want to use each block of DenseNet in your network, you can use the following:
pretrained_model = densenet121()
self.features = pretrained_model._modules[‘features’]
self.block = self.features._modules[‘denseblock1’]