There is nothing from in iterating over modules, as long as you get the last nested ones properly.
The problem here is the Architecture of DenseNet where the next denselayer requires the input from all the previous layers.
Someone implementing GradCAM has to take care for that fact.