torch / nngraph

Graph Computation for nn

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when using graph.dot

RishabhMalviya opened this issue · comments

I'm following the README.md file and when I get around to running:

graph.dot(mlp.fg, 'MLP')

from the first example (two hidden layers MLP), I get the following error:

...l/Cellar/torch/HEAD/share/lua/5.1/graph/graphviz.lua:162: attempt to index local 'g' (a nil value) stack traceback: ...local/Cellar/torch/HEAD/share/lua/5.1/trepl/init.lua:501: in function <...local/Cellar/torch/HEAD/share/lua/5.1/trepl/init.lua:494> ...l/Cellar/torch/HEAD/share/lua/5.1/graph/graphviz.lua:162: in function 'graphvizFile' ...l/Cellar/torch/HEAD/share/lua/5.1/graph/graphviz.lua:195: in function 'dot' [string "_RESULT={graph.dot(mlp.fg, 'MLP')}"]:1: in main chunk [C]: in function 'xpcall' ...local/Cellar/torch/HEAD/share/lua/5.1/trepl/init.lua:651: in function 'repl' ...lar/torch/HEAD/lib/luarocks/rocks/trepl/scm-1/bin/th:199: in main chunk [C]: ?

I'm running this from trepl on a mac. I have already run brew install graphviz (it installed version 2.38.0) and luarocks install graph (as suggested at the end of this thread) successfully. I haven't been able to find anything on this error online either. How do I get around this error?

https://github.com/torch/graph/blob/master/graphviz.lua#L162 points to the fact that "g" or "mlp.fg" does not exist. mlp.fg only exists if mlp is a nn.gModule (i.e. an nngraph module). I suspect that you are trying to pass in a non nngraph network into that example, where the member .fg doesn't exist.