summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authortxh18 <[email protected]>2015-05-27 20:26:09 +0800
committertxh18 <[email protected]>2015-05-27 20:26:09 +0800
commitba66e109a89d5aff4d709cf0865da60d4d873fee (patch)
treeb6f71baa6860bf2b64c34d84965291599b2a0f9b /examples
parentb9a860c021183d4e8138b5fa8e637414d2e47108 (diff)
modified copy_from(d/h), copy_to(d/h)
Diffstat (limited to 'examples')
-rw-r--r--examples/cumatrix_from_mmatrix.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/examples/cumatrix_from_mmatrix.lua b/examples/cumatrix_from_mmatrix.lua
index fba8a90..1aac1c4 100644
--- a/examples/cumatrix_from_mmatrix.lua
+++ b/examples/cumatrix_from_mmatrix.lua
@@ -1,5 +1,5 @@
-m = 10
-n = 10
+m = 3
+n = 4
fm = nerv.MMatrixFloat(m, n)
dm = nerv.MMatrixDouble(m, n)
for i = 0, m - 1 do
@@ -15,9 +15,14 @@ print(dm)
fc = nerv.CuMatrixFloat(m, n)
dc = nerv.CuMatrixDouble(m, n)
-fc:copy_from(fm)
-dc:copy_from(dm)
+fc:copy_fromh(fm)
+dc:copy_fromh(dm)
+print("fc and dc")
print(fc)
print(dc)
+dc[1]:copy_tod(dc[0])
+print("dc[1] copied to dc[0]")
+print(dc)
+print("softmax of fc and dc")
print(fc:softmax())
print(dc:softmax())