From 83dbefa3435b72911ee643f9f99205247d140279 Mon Sep 17 00:00:00 2001 From: cloudygoose Date: Fri, 12 Jun 2015 12:27:36 +0800 Subject: doc change --- doc/nerv_layer.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'doc/nerv_layer.md') diff --git a/doc/nerv_layer.md b/doc/nerv_layer.md index 0425d5f..ac6480c 100644 --- a/doc/nerv_layer.md +++ b/doc/nerv_layer.md @@ -141,7 +141,8 @@ print('network input&output&error space allocation...') affineI = {dataM} --input to the network is data affineO = {nerv.CuMatrixFloat(data_num, 2)} softmaxI = {affineO[1], labelM} -softmaxO = {nerv.CuMatrixFloat(data_num, 2)} +softmaxO = {} +output = nerv.CuMatrixFloat(data_num, 2) affineE = {nerv.CuMatrixFloat(data_num, 2)} --[[space allocation end]]-- @@ -152,9 +153,9 @@ ce_last = 0 for l = 0, 10, 1 do affineL:propagate(affineI, affineO) softmaxL:propagate(softmaxI, softmaxO) - softmaxO[1]:softmax(softmaxI[1]) + output:softmax(softmaxI[1]) - softmaxL:back_propagate(affineE, nil, softmaxI, softmaxO) + softmaxL:back_propagate(affineE, {}, softmaxI, softmaxO) affineL:update(affineE, affineI, affineO) @@ -162,10 +163,9 @@ for l = 0, 10, 1 do nerv.utils.printf("training iteration %d finished\n", l) nerv.utils.printf("cross entropy: %.8f\n", softmaxL.total_ce - ce_last) ce_last = softmaxL.total_ce - nerv.utils.printf("accurate labels: %d\n", calculate_accurate(softmaxO[1], labelM)) + nerv.utils.printf("accurate labels: %d\n", calculate_accurate(output, labelM)) nerv.utils.printf("total frames processed: %.8f\n", softmaxL.total_frames) end end --[[end training]]-- - ``` \ No newline at end of file -- cgit v1.2.3