Hi @ptrblck,
The use case is to create conditional computation of layers, then define multiple entry points to a network and compute layers only corresponding to the specific entry point. I was trying to apply this to progressive training of CNNs for classification/segmentation, applying the principle from Progressive GANs. The advantage could be that this method could generalize to different standard network architectures.
So what I am looking for is below:
new_resnet18 = MagicConditionalModifier(resnet18, stages=['layer1', 'layer2'])
stage_1_input #torch.tensor(Bx64xHxW)
output = new_resnet18(stage_1_input, stage=1) #or stage='layer1')
stage_2_input #torch.tensor(Bx128xHxW)
output = new_resnet18(stage_2_input, stage=2)#or stage='layer2')

We can of course create a new network from the old network and create the conditional computational paths, but it seemed to me that there had to be a better way. (Maybe I’m overthinking this!)