Phase3 doesn’t use any parameters of netA to calculate the loss l3, so no gradients will be computed for parameters in netA.
If you want to optimizer netA in phase3, you would have to pass y1_a to netB so that the computation graph includes both models.
PS: you can post code snippets by wrapping them into three backticks ```, which makes debugging easier.