Hello, thank you for your answer.
I don’t understand why would I detach output_base_model before feeding it to the classifier? This sounds new to me.
To give you some additional information, my base model is a cycle GAN, I am using some layer of the generator to reuse learned features to fed a classifier. Train the two networks separately is not a problem, I guess. With the simplified example above I wanted to show how I would optimize base-model parameters w.r.t. the classification error. The optimal for me would be able both to:

Optimize the base model w.r.t his original loss function combined with the loss of the classifier
Optimize the base model w.r.t. the loss of the classifier.