Typically I use
for name, module in self.model.named_children():
    # do stuff here with layers

to iterate through my model to modify layers. Is there a way where I can detect if the current module is the last in my network, so that I can treat this layer differently?