koraykv/torch-nngraph — pull request #23 by fidlej (2014-03-03 18:13:18+00:00)
Title: Saved the graph .svg when nngraph.setDebug(true) is enabled

It is useful to see the graph .svg, when an error occurs.
When debug is enabled by `nngraph.setDebug(true)`,
the .svg will be saved if an error occurs in a graph.

The problematic node will be marked with red color:
![nngraph_1in_1out](https://f.cloud.github.com/assets/147710/2312627/859a4d7a-a2fe-11e3-8e6b-d4da6bc0bf46.png)

The basename of the saved file can be changed by setting `gmodule.name`.

Example usage:

require 'nngraph'

local nInputs = 20

local input = nn.Identity()()
local projected = nn.Linear(nInputs, 10)(input)
local h = nn.Tanh()(projected)
local net = nn.gModule({input}, {h})

nngraph.setDebug(true)

local wrongNInputs = nInputs + 1
local inputExample = torch.rand(wrongNInputs)
net:forward(inputExample)