How to save the hidden layer output after each epoch?

Dear sir or madam,

I have a question about how to get the output of the hidden layer after each epoch because when I tried to do it under the callback, the last result will be covered by the newer one, hence I can only get the final result of the training process. Could you give me some idea about it?

I guess you are storing the output in e.g. a list and might replace it in each iteration.
In this case, either append the new output to the list or use a new key in a dict.
Let me know if these approaches would work or where you are stuck.

Hi ptrblck,

I was trying to save the Hidden layer output in the callback, but after that, I would like to calculate the gradient of the hidden layer output with respect to t, could you give me some idea to do this?

Thank you so much for your help!

Best,
Aaron


This is the Callback I wrote, and I can only get the final result instead of the weights during the process.

Hi ptrblck,

When I was trying to save the weights, the result only showed the final result of the updated weights. And below is my code and my result.