mohit117:

Hi,
If you are using alpha which is the output of alpha_model in x and x the only way that alpha_model won’t contribute is that you throw away x and h too, if not, alpha_model is part of the definition of x so gradients will be calculated.
   #x = torch.pow(x,alpha)
   #h = torch.pow(h,alpha)



If you want to omit a part of graph from updating, just freeze their parameters using requires_grad = False. Then optimizer will skip it.
Bests