How to include the training data as learnable parameters in Pytorch?

Hi all,
I am a trained model. Now, I need to feed some random data to it, and then use the gradients to update the random data! I am hoping to see meaningful patterns in the learned data at the end. This is similar to activation maximization in Neural Networks.
However, I am not sure how to add my tensor data into the optimizer! Could anyone help me with this?

Thanks a lot


You will need to make sure that your data properly require gradients.
Then you can pass it to the optimizer as any other parameter.

1 Like

Thank you so much. I will see how it works out