Hi sorry I’m new to Pytorch: if I have Model1 producing some output, which is fed into Model2 (which is pre-trained), is there a simple way to optimize Model1’s weights based on Model2’s outputs? I could of course just backprop through Model2 into Model1, but I want to assume Model2 is not accessible to Model1 other than it’s outputs.
If I do:
for p in Model2.parameters():
    p.requires_grad = False

Does that have the desired effect? - Model2’s weights and gradient are not accessible to Model1 during backprop