From 81bf2d653902860c5d28ccade19ac6e1fd56acaf Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 26 May 2015 14:06:52 +0800 Subject: add layer and param --- matrix/init.lua | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'matrix') diff --git a/matrix/init.lua b/matrix/init.lua index 8f626dc..08080a9 100644 --- a/matrix/init.lua +++ b/matrix/init.lua @@ -38,3 +38,16 @@ function nerv.CuMatrix:__mul__(b) c:mul(self, b, 'N', 'N') return c end + +function nerv.CuMatrixFloat.new_from_host(mat) + local res = nerv.CuMatrixFloat(mat:nrow(), mat:ncol()) + res:copy_from(mat) + print(res) + return res +end + +function nerv.CuMatrixFloat:new_to_host() + local res = nerv.MMatrixFloat(self:nrow(), self:ncol()) + self:copy_to(res) + return res +end -- cgit v1.2.3