hill-a / stable-baselines

A fork of OpenAI Baselines, implementations of reinforcement learning algorithms
http://stable-baselines.readthedocs.io/
MIT License
4.13k stars 724 forks source link

[question] How to get layer activations in Tensorflow #825

Open lumelanie opened 4 years ago

lumelanie commented 4 years ago

Hello :) Is there a way in Tensorflow to get the activations from the SAC actor network (as you could do by registering a hook to the layer in PyTorch)?

araffin commented 4 years ago

Hello, You need to use a custom version of stable-baselines for that.

lumelanie commented 4 years ago

Okay thanks, you mean defining my own custom network?

Miffyli commented 4 years ago

Bit more than that. Unless you find a way to obtain activations from layers without modifying the session.call, you also have to modify those calls to include outputs for those mid-network activations. I have not touched TF1 in a while, and I am not sure if this is possible.