aboutsummaryrefslogtreecommitdiff
path: root/matrix/init.lua
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-05-26 14:06:52 +0800
committerDeterminant <[email protected]>2015-05-26 14:06:52 +0800
commit81bf2d653902860c5d28ccade19ac6e1fd56acaf (patch)
tree831a25c84332ac0839dbe498f61620ea634170e0 /matrix/init.lua
parent8c5246a8794011ca0c25f15643771f031d258594 (diff)
add layer and param
Diffstat (limited to 'matrix/init.lua')
-rw-r--r--matrix/init.lua13
1 files changed, 13 insertions, 0 deletions
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