From f6786b0e7c71437a100c88377b96f832acb8125d Mon Sep 17 00:00:00 2001 From: cloudygoose Date: Mon, 8 Jun 2015 16:25:36 +0800 Subject: doc change --- doc/nerv_layer.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 doc/nerv_layer.md (limited to 'doc/nerv_layer.md') diff --git a/doc/nerv_layer.md b/doc/nerv_layer.md new file mode 100644 index 0000000..587bf24 --- /dev/null +++ b/doc/nerv_layer.md @@ -0,0 +1,33 @@ +#The Nerv Layer Package# +Part of the [Nerv](../README.md) toolkit. + +##Description## +__nerv.Layer__ is the base class and most of its methods are abstract. +###Class hierarchy and their members### +* __nerv.AffineLayer__ inherits __nerv.Layer__. + * `MatrixParam ltp` The liner transform parameter. + * `BiasParam bp` The bias parameter. + * `table dim_in` should be of length 1. + * `table dim_out` should be of length 1. + +##Methods## +* __void Layer.\_\_init(Layer self, string id, table global_conf, table layer_conf)__ +Abstract method. +The constructing method should assign `id` to `self.id` and `global_conf` to `self.gconf`, `layer_conf.dim_in` to `self.dim_in`, `layer_conf.dim_out` to `self.dim_out`. `dim_in` and `dim_out` are a list specifies the dimensions of the inputs and outputs. Also, `layer_conf` will include the parameters, which should also be properly saved. +* __void Layer.init(Layer self)__ +Abstract method. +Initialization method, in this method the layer should do some self-checking and allocate space for intermediate results. +* __void Layer.update(Layer self, table bp_err, table input, table output)__ +Abstract method. +`bp_err[i]` should be the error on `output[i]`. In this method the parameters of `self` is updated. +* __void Layer.propagate(Layer self, table input, table output)__ +Abstract method. +Given `input` and the current parameters, propagate and store the result in `output`. +* __void Layer.back_propagate(Layer self, Matrix next_bp_err, Matrix bp_err, Matrix input, Matrix output)__ +Abstract method. + +* __void Layer.check_dim_len(int len_in, int len_out)__ +Check whether `#self.dim_in == len_in` and `#self.dim_out == len_out`, if violated, an error will be posted. +* __void Layer.get_params(Layer self)__ +Abstract method. + -- cgit v1.2.3 From 3ce264a01113645a8f3a82853078ff804d1c7c66 Mon Sep 17 00:00:00 2001 From: cloudygoose Date: Mon, 8 Jun 2015 17:06:02 +0800 Subject: doc change --- doc/nerv_layer.md | 1 + 1 file changed, 1 insertion(+) (limited to 'doc/nerv_layer.md') diff --git a/doc/nerv_layer.md b/doc/nerv_layer.md index 587bf24..272ffd8 100644 --- a/doc/nerv_layer.md +++ b/doc/nerv_layer.md @@ -25,6 +25,7 @@ Abstract method. Given `input` and the current parameters, propagate and store the result in `output`. * __void Layer.back_propagate(Layer self, Matrix next_bp_err, Matrix bp_err, Matrix input, Matrix output)__ Abstract method. +Calculate the error on the inputs and store them in `next_bp_err`. * __void Layer.check_dim_len(int len_in, int len_out)__ Check whether `#self.dim_in == len_in` and `#self.dim_out == len_out`, if violated, an error will be posted. -- cgit v1.2.3 From 3e07a536a89badff65fc81f56bb19cc69291396e Mon Sep 17 00:00:00 2001 From: cloudygoose Date: Tue, 9 Jun 2015 15:52:52 +0800 Subject: doc change... --- doc/nerv_layer.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'doc/nerv_layer.md') diff --git a/doc/nerv_layer.md b/doc/nerv_layer.md index 272ffd8..dd991df 100644 --- a/doc/nerv_layer.md +++ b/doc/nerv_layer.md @@ -4,12 +4,20 @@ Part of the [Nerv](../README.md) toolkit. ##Description## __nerv.Layer__ is the base class and most of its methods are abstract. ###Class hierarchy and their members### -* __nerv.AffineLayer__ inherits __nerv.Layer__. +* __nerv.Layer__. + * `table dim_in` It specifies the dimensions of the inputs. + * `table dim_out` It specifies the dimensions of the outputs. + * `string id` ID of this layer. + * `table gconf` Stores the `global_conf`. +* __nerv.AffineLayer__ inherits __nerv.Layer__, both `#dim_in` and `#dim_out` are 1. * `MatrixParam ltp` The liner transform parameter. * `BiasParam bp` The bias parameter. - * `table dim_in` should be of length 1. - * `table dim_out` should be of length 1. - +* __nerv.BiasLayer__ inherits __nerv.Layer__, both `#dim_in` nad `#dim_out` are 1. + * `BiasParam bias` The bias parameter. +* __nerv.SigmoidLayer__ inherits __nerv.Layer__, both `#dim_in` and `#dim_out` are 1. +* __nerv.SoftmaxCELayer__ inherits __nerv.Layer__, `#dim_in` is 2 and `#dim_out` is 1. + * `float total_ce` + * `int total_frams` Records how many frames have passed. ##Methods## * __void Layer.\_\_init(Layer self, string id, table global_conf, table layer_conf)__ Abstract method. @@ -30,5 +38,6 @@ Calculate the error on the inputs and store them in `next_bp_err`. * __void Layer.check_dim_len(int len_in, int len_out)__ Check whether `#self.dim_in == len_in` and `#self.dim_out == len_out`, if violated, an error will be posted. * __void Layer.get_params(Layer self)__ -Abstract method. +Abstract method. +The layer should return a list containing its parameters. -- cgit v1.2.3