Is it possible to return only the free parameters from the model. For a Linear Model, we will have (input_features+1)*out_features number of parameters in the model. For binary classification with 10 covariates, we will have 22 parameters. However, only half of them are free parameters. The loss function is computed from the whole set of parameters, if I try to do something like
torch.autograd.grad(likelihood,free_parameters, create_graph=True,only_inputs=True)
It will give me RuntimeError: differentiated input is unreachable.
So far I try to compute wrt the whole set of parameters and then try to pick those related to the free parameters.
Are there any better way of doing this? i