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

get_model_summary #165

Open
cyrusmvahid opened this issue Jul 1, 2019 · 1 comment
Open

get_model_summary #165

cyrusmvahid opened this issue Jul 1, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@cyrusmvahid
Copy link

Description

I would like to print my model summary (keras style) or access the network and take a look at layers, weights, collect_params, and number of parameters.
It would be nice to add a get_network_summary or an immutable network object returned by the estimator.

@cyrusmvahid cyrusmvahid added the enhancement New feature or request label Jul 1, 2019
@geoalgo
Copy link
Contributor

geoalgo commented Jul 1, 2019

Hi @cyrusmvahid

The example examples/evaluate_model.py can be adapted as follow:

train_transformation, train_model = estimator.train_model(dataset.train)
print(train_model.collect_params())

This will give you access to network weights if you want to investigate weights.

For printing model summary, we could do something but the print will be dependent on whether the network is hybridized or not.
E.g., we could add in the trainer code something like this that may do the trick:

...
loss.backward()
trainer.step(batch_size)

first_batch = batch_no == 1 and epoch_no == 0

if not self.hybridize and first_batch:
    net.summary(*inputs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants