diff options
author | Determinant <[email protected]> | 2015-06-02 23:07:15 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2015-06-02 23:07:15 +0800 |
commit | 08a52c03a77ce13ae4f6a4deb06ab0ae274d399a (patch) | |
tree | 1cf0ac8c7d05a83c9a7246d6b6c56eb113124385 /layer | |
parent | 74d9e9e7371c80394698fb9805cbf0cbde67a8f3 (diff) |
fix a bug: input[1] should be input[2] (since Lua arrays are 1-based)
Diffstat (limited to 'layer')
-rw-r--r-- | layer/softmax_ce.lua | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/layer/softmax_ce.lua b/layer/softmax_ce.lua index 3dfebc5..09eb3a9 100644 --- a/layer/softmax_ce.lua +++ b/layer/softmax_ce.lua @@ -27,6 +27,8 @@ function SoftmaxCELayer:propagate(input, output) local ce = soutput:create() ce:log_elem(soutput) ce:mul_elem(ce, input[2]) +-- print(input[1][0]) +-- print(soutput[1][0]) -- add total ce self.total_ce = self.total_ce - ce:rowsum():colsum()[0] self.total_frames = self.total_frames + soutput:nrow() @@ -34,5 +36,5 @@ end function SoftmaxCELayer:back_propagate(next_bp_err, bp_err, input, output) -- softmax output - label - next_bp_err[1]:add(self.soutput, input[1], 1.0, -1.0) + next_bp_err[1]:add(self.soutput, input[2], 1.0, -1.0) end |