Suppose there are parts A and part B in a model.
What I want to achieve is:


If the model prediction is a, then update the weight of part A in the model.


If the model prediction is b, then update the weight of part B in the model.


My question is:

How is it implemented in PyTorch? (Especially when batch prediction)
From the perspective of deep learning, is such an update scheme practical?