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

Architecture diagram print #22

Open
wajahat57 opened this issue Nov 28, 2017 · 6 comments
Open

Architecture diagram print #22

wajahat57 opened this issue Nov 28, 2017 · 6 comments

Comments

@wajahat57
Copy link

wajahat57 commented Nov 28, 2017

Hi
How to display the diagram of the architecture (or graph topology plot) in AutoNN which is done by Dagnn.print() or vl_simplenn_display()?
Best Regards

@jotaf98
Copy link
Collaborator

jotaf98 commented Nov 28, 2017

Hi, that would be: layer.plotPDF()

@wajahat57
Copy link
Author

wajahat57 commented Nov 28, 2017

thanks a lot for this wrapper and help.
How can I retrieve a layer from an autoNN net once it is compiled? (to use plotPDF)
OK, got it. It is:
LL=Layer.fromCompiledNet(net);
and then the networks will be a cell structure LL{1}, LL{2} ...
Renaming may be required:
LL{1}.sequentialNames
and then:
LL{1}.plotPDF
but it will require GraphViz to convert the graph DOT file to PDF. Otherwise, the graph will be generated in a temporary file in a temp folder. The error message thus generated will provide the path to the file.

@wajahat57
Copy link
Author

Is there any documentation such as what is inputVars and inputArgPos etc?

@jotaf98
Copy link
Collaborator

jotaf98 commented Nov 28, 2017

No worries!

I meant to create a graph visualization without the GraphViz dependency, but didn't have the time yet. See "doc GraphPlot" on how. If you end up creating a more-or-less general function that does this, please send it or create a Pull Request :)

@jotaf98
Copy link
Collaborator

jotaf98 commented Nov 28, 2017

As for the fields of the internal compiled Net structures (net.forward/net.backward), they're not documented, unless you look at either net.compile (more complicated) or net.eval (which is simpler). Open net.eval and look at the block (about 10 lines of code) following the comment line "% forward pass". That's essentially all there is to running a forward pass of the network.

As a quick description: When running layer K, we set layer = net.forward(K). Then we just call layer.func with the arguments list layer.args. This includes all of the constant arguments in the function call (e.g. the 2nd argument in "sum(X, 2)"). It is empty for non-constant arguments (e.g. the 1st argument in "sum(X, 2)"). To fill in the non-constant arguments with the results from the previous layers (e.g. the "X" above), layer.inputArgPos tells you which arguments to fill in, and layer.inputVars tells you the variable indexes to get the values from. The output of the layer is then assigned to the variables with indexes layer.outputVar.

One useful thing to do if you want to dig deeper than that, is to put a breakpoint somewhere in net.eval, type "whos" into the command line to see what variables are there, and inspect them for a simple network. You can also step through and see how they change at each iteration. Note that no external functions are called in this method, it's relatively self-contained.

@wajahat57
Copy link
Author

Thanks a lot Joao

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

No branches or pull requests

2 participants