end
end
--- +--> c ----> e --+
--- / / \
--- / / \
--- input --> a --> b ---> d ----+ g --> output
--- \ /
--- \ /
--- +--> f ---+
+-- +- Linear(10, 10) -> ReLU ---> d --+
+-- / / \
+-- / / \
+-- --> a --> b -----------> c --------------+ e -->
+-- \ /
+-- \ /
+-- +-- Mul(-1) --------+
+
+model = nn.DAG()
a = nn.Linear(50, 10)
b = nn.ReLU()
c = nn.Linear(10, 15)
-d = nn.Linear(10, 15)
-e = nn.CMulTable()
-f = nn.Linear(15, 15)
-g = nn.CAddTable()
-
-model = nn.DAG()
+d = nn.CMulTable()
+e = nn.CAddTable()
model:addEdge(a, b)
-model:addEdge(b, nn.Linear(10, 5), nn.ReLU(), nn.Linear(5, 10), c)
-model:addEdge(b, d)
-model:addEdge(c, e)
+model:addEdge(b, nn.Linear(10, 15), nn.ReLU(), d)
model:addEdge(d, e)
-model:addEdge(d, f)
-model:addEdge(e, g)
-model:addEdge(f, nn.Mul(-1), g)
+model:addEdge(b, c)
+model:addEdge(c, d)
+model:addEdge(c, nn.Mul(-1), e)
model:setInput(a)
-model:setOutput(g)
+model:setOutput(e)
local input = torch.Tensor(30, 50):uniform()
local output = model:updateOutput(input):clone()