Cosmetics.
authorFrancois Fleuret <francois@fleuret.org>
Thu, 12 Jan 2017 20:37:17 +0000 (21:37 +0100)
committerFrancois Fleuret <francois@fleuret.org>
Thu, 12 Jan 2017 20:37:17 +0000 (21:37 +0100)
test-dagnn.lua

index 8f92ccf..a41d880 100755 (executable)
@@ -84,35 +84,31 @@ function printTensorTable(t)
    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()