Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to show structure of the model #133

Open
kapsl opened this issue Apr 6, 2020 · 1 comment
Open

Possibility to show structure of the model #133

kapsl opened this issue Apr 6, 2020 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@kapsl
Copy link

kapsl commented Apr 6, 2020

Hi,
is there an easy way of showing the structure of the keras model? Like normally with .summary() after compiling it?

@hartikainen
Copy link
Member

Good question! Here's how you can currently get the summaries of the keras models:

ipdb> policy.shift_and_scale_model.summary()
Model: "model"
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
observations (InputLayer)    [(None, 3)]               0
_________________________________________________________________
lambda_4 (Lambda)            (None, 3)                 0
_________________________________________________________________
feedforward_model (Sequentia (None, 2)                 67330
_________________________________________________________________
lambda_6 (Lambda)            [(None, 1), (None, 1)]    0
_________________________________________________________________
lambda_7 (Lambda)            (None, 1)                 0
=================================================================
Total params: 67,330
Trainable params: 67,330
Non-trainable params: 0
_________________________________________________________________
ipdb> Qs[0].model.summary()
Model: "feedforward_Q"
__________________________________________________________________________________________________
Layer (type)                    Output Shape         Param #     Connected to
==================================================================================================
0/observations (InputLayer)     [(None, 3)]          0
__________________________________________________________________________________________________
1 (InputLayer)                  [(None, 1)]          0
__________________________________________________________________________________________________
lambda (Lambda)                 (None, 4)            0           0/observations[0][0]
                                                                 1[0][0]
__________________________________________________________________________________________________
feedforward_Q (Sequential)      (None, 1)            67329       lambda[0][0]
==================================================================================================
Total params: 67,329
Trainable params: 67,329
Non-trainable params: 0
__________________________________________________________________________________________________

It's a bit clumsy, and ideally we'd have a .summary() methods implemented in the policy and value function classes. I'll try to implement those at some point. Let's keep this issue open for now as a feature request.

@hartikainen hartikainen added enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants