aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortxh18 <[email protected]>2015-12-29 18:50:27 +0800
committertxh18 <[email protected]>2015-12-29 18:50:27 +0800
commitc0e533cef55138e0de201ca9da9c0e3f3b8a61f1 (patch)
treee731457b1ff668c1b37a294908636bf9f1c41125
parent5e34a22d44fcd74df7378aca0de050cdd349c8b9 (diff)
small bug fix in tnn
-rw-r--r--nerv/tnn/tnn.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/nerv/tnn/tnn.lua b/nerv/tnn/tnn.lua
index e7d4981..d527fe6 100644
--- a/nerv/tnn/tnn.lua
+++ b/nerv/tnn/tnn.lua
@@ -347,7 +347,9 @@ function TNN:net_propagate() --propagate according to feeds_now
local feeds_now = self.feeds_now
for t = 1, self.chunk_size do --some layer maybe do not have inputs from time 1..chunk_size
for id, ref in pairs(self.layers) do
- self:propagate_dfs(ref, t)
+ if #ref.dim_in > 0 then --some layer is just there(only to save some parameter)
+ self:propagate_dfs(ref, t)
+ end
end
end
for t = 1, self.chunk_size do
@@ -472,7 +474,9 @@ function TNN:net_backpropagate(do_update) --propagate according to feeds_now
local feeds_now = self.feeds_now
for t = 1, self.chunk_size do --some layer maybe do not have outputs from time 1..chunk_size
for id, ref in pairs(self.layers) do
- self:backpropagate_dfs(ref, t, do_update)
+ if #ref.dim_out > 0 then --some layer is just there(only to save some parameter)
+ self:backpropagate_dfs(ref, t, do_update)
+ end
end
end
for t = 1, self.chunk_size do