end
end
--- +- Linear(10, 10) -> ReLU ---> d --+
--- / / \
--- / / \
--- --> a --> b -----------> c --------------+ e -->
--- \ /
--- \ /
--- +-- Mul(-1) --------+
+-- +-- Linear(10, 10) --> ReLU --> d --+
+-- / / \
+-- / / \
+-- --> a --> b -----------> c --------------+ e -->
+-- \ /
+-- \ /
+-- +----- Mul(-1) ------+
model = nn.DAG()
d = nn.CMulTable()
e = nn.CAddTable()
-model:addEdge(a, b)
-model:addEdge(b, nn.Linear(10, 15), nn.ReLU(), d)
-model:addEdge(d, e)
-model:addEdge(b, c)
-model:addEdge(c, d)
-model:addEdge(c, nn.Mul(-1), e)
+model:connect(a, b, c)
+model:connect(b, nn.Linear(10, 15), nn.ReLU(), d)
+model:connect(d, e)
+model:connect(c, d)
+model:connect(c, nn.Mul(-1), e)
model:setInput(a)
model:setOutput(e)
print('Error = ' .. checkGrad(model, nn.MSECriterion(), input, output))
-model:dot('/tmp/graph.dot')
+print('Writing /tmp/graph.dot')
+model:saveDot('/tmp/graph.dot')