From f9e116ef514b27680434eb92d737135edd316875 Mon Sep 17 00:00:00 2001 From: cloudygoose Date: Thu, 4 Jun 2015 17:03:41 +0800 Subject: doc change --- doc/nerv_io.md | 23 +++++++++++++++++++++++ doc/nerv_matrix.md | 6 ++++++ doc/nerv_param.md | 26 ++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 doc/nerv_io.md create mode 100644 doc/nerv_param.md (limited to 'doc') diff --git a/doc/nerv_io.md b/doc/nerv_io.md new file mode 100644 index 0000000..7066939 --- /dev/null +++ b/doc/nerv_io.md @@ -0,0 +1,23 @@ +#The Nerv IO Package# +Part of the [Nerv](../README.md) toolkit. + +##Description## +There are four classes in to deal with chunk data, which are __nerv.ChunkFile__, __nerv.ChunkFileHandle__, __nerv.ChunkInfo__, __nerv.ChunkData__. Below is the underlying C structs. +``` +typedef struct ChunkFileHandle { + FILE *fp; +} ChunkFileHandle; + +typedef struct ChunkInfo { + off_t offset, length; +} ChunkInfo; + +typedef struct ChunkData { + FILE *fp; + char *data; +} ChunkData; +``` + +##Methods## +* __ChunkFileHandle ChunkFile.\_\_init(string mode, string fn)__ +`mode` can be `r` or `w`, for reading or writing a file. diff --git a/doc/nerv_matrix.md b/doc/nerv_matrix.md index 1a2778b..22971d2 100644 --- a/doc/nerv_matrix.md +++ b/doc/nerv_matrix.md @@ -102,6 +102,12 @@ Return a new __MMatrix__ which is a copy of `self`. * __string Matrix.\_\_tostring\_\_(Matrix self)__ Returns a string containing values of __Matrix__ `self`. --- +* __MMatrix MMatrix.load(ChunkData chunk)__ +Return a new __MMatrix__ loaded from the file position in `chunk`. +* __void MMatrix.save(MMatrix self, ChunkFileHandle chunk)__ +Write `self` to the file position in `chunk`. +* __void MMatrix.copy_from(MMatrix ma, MMatrix mb,[int b_bgein, int b_end, int a_begin])__ +Copy a part of `mb`(rows of index `[b_begin..b_end)`) to `ma` beginning at row index `a_begin`. If not specified, `b_begin` will be `0`, `b_end` will be `b.nrow`, `a_begin` will be `0`. ##Examples## * Use `get_dataref_value` to test __Nerv__'s matrix space allocation. diff --git a/doc/nerv_param.md b/doc/nerv_param.md new file mode 100644 index 0000000..87ea1af --- /dev/null +++ b/doc/nerv_param.md @@ -0,0 +1,26 @@ +#The Nerv Parameter Package# +Part of the [Nerv](../README.md) toolkit. + +##Description## +###Class hierarchy### +There is a base class __Nerv.Param__ defined in `layer/init.lua`. +__Nerv.MatrixParam__ inherits __Nerv.Param__. +__Nerv.LinearTransParam__, __Nerv.BiasParam__ inherits __Nerv.MatrixParam__. +###Class member### +* __Nerv.MatrixParam__ + * __nerv.CuMatrix__ trans + Stores the parameter matrix. + +##Methods## +* __void Param.\_\_init(Param self, string id, table global_conf)__ +Constructor of a __Param__, it will set `self.id` to be `id` and `self.gconf` to be `global_conf`. +* __void Param.set_info(table info)__ +Set `self.info` to be `info`. +* __table Param.get_info()__ +Returns `self.info`. +* __void Param.read(ChunkData pcdata)__ +This is not implemented in `nerv.Param`. +* __void MatrixParam.read(MatrixParam self, ChunkData pcdata)__ +Read `self.trans` from `pcdata`. +* __void MatrixParam.write(MatrixParam self, ChunkFileHandle pfhandle)__ +Write `self.trans` to `pfhandle`. \ No newline at end of file -- cgit v1.2.3-70-g09d2