Latope2-150:

add the inputs to your optimizer


Thank you so much for your reply, I already come to the same idea yesterday but I want to make sure of the following:
1- How can I add the input variable to the optimizer? I tried to use nn.parameter at initialization but clearly it seems that I can not initialize a variable that is not defined yet. Any help?

is it simply like this?
data = Variable(sample[0], requires_grad=True)
self.optimizer.add_param_group({“params”: data})
If yes, when I do: print (list(self.parameters())), I dont see the input among the parameters. Only weight and biases!
*** Also when i run the program with these 2 lines above it is taking very much long time. When adding the input of the model to the optimisation process, do i occupy the memory in any uncessary manner or is this slow running normal)?
Thanks for clarification

2- I would like to confirm: adding the input to the optimizer will: Make the total loss optimized considering the input data, AND will update the input data as well (so that input data as well well not be the same)?
Thank you sooo much for your help
Am