projects
/
dagnn.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
97142a4
)
Cosmetics.
author
Francois Fleuret
<francois@fleuret.org>
Thu, 12 Jan 2017 20:37:17 +0000
(21:37 +0100)
committer
Francois Fleuret
<francois@fleuret.org>
Thu, 12 Jan 2017 20:37:17 +0000
(21:37 +0100)
test-dagnn.lua
patch
|
blob
|
history
diff --git
a/test-dagnn.lua
b/test-dagnn.lua
index
8f92ccf
..
a41d880
100755
(executable)
--- a/
test-dagnn.lua
+++ b/
test-dagnn.lua
@@
-84,35
+84,31
@@
function printTensorTable(t)
end
end
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)
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(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, 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:setInput(a)
-model:setOutput(
g
)
+model:setOutput(
e
)
local input = torch.Tensor(30, 50):uniform()
local output = model:updateOutput(input):clone()
local input = torch.Tensor(30, 50):uniform()
local output = model:updateOutput(input):clone()