diff options
author | Determinant <[email protected]> | 2016-03-10 13:40:11 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2016-03-10 13:40:11 +0800 |
commit | a32195e3e2ae9ca0f0c7a82e73e6bddb64568c05 (patch) | |
tree | a19f21f8cbadecff7357f9a102f160f5fe699b65 /nerv/matrix/init.lua | |
parent | 4a6872601f05e9ecc059f83fb64a0a4887992b99 (diff) |
major change: clearer param binding semantics; permit rebinding; enable
resuming from previous training
Diffstat (limited to 'nerv/matrix/init.lua')
-rw-r--r-- | nerv/matrix/init.lua | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/nerv/matrix/init.lua b/nerv/matrix/init.lua index ef2fb6b..cf85004 100644 --- a/nerv/matrix/init.lua +++ b/nerv/matrix/init.lua @@ -87,6 +87,17 @@ function nerv.Matrix:__mul__(b) return c end +--- A wrapper function for `copy_from` +function nerv.Matrix:copy_to(b, ...) + b:copy_from(self, ...) +end + +--- The base class for all device (in-GPU) matrices +-- @type nerv.CuMatrix + +--- A wrapper function for `copy_fromd` +nerv.CuMatrix.copy_tod = nerv.Matrix.copy_to + --- CUDA float matrices -- @type nerv.CuMatrixFloat @@ -127,6 +138,14 @@ end -- @type nerv.MMatrix --- A wrapper function for `copy_fromh` -function nerv.MMatrix:copy_toh(b, ...) +nerv.MMatrix.copy_toh = nerv.Matrix.copy_to + +--- A wrapper function for `nerv.CuMatrix` copy +function nerv.MMatrix:copy_fromd(b, ...) + b:copy_toh(self, ...) +end + +--- A wrapper function for `nerv.CuMatrix` copy +function nerv.MMatrix:copy_tod(b, ...) b:copy_fromh(self, ...) end |