summaryrefslogtreecommitdiff
path: root/cumatrix_example.lua
diff options
context:
space:
mode:
Diffstat (limited to 'cumatrix_example.lua')
-rw-r--r--cumatrix_example.lua19
1 files changed, 10 insertions, 9 deletions
diff --git a/cumatrix_example.lua b/cumatrix_example.lua
index c2f2139..f26d7f4 100644
--- a/cumatrix_example.lua
+++ b/cumatrix_example.lua
@@ -1,15 +1,16 @@
m = 10
n = 10
-t = nerv.FloatCuMatrix(m, n)
--- print(t)
-a = t[1]
+fm = nerv.FloatCuMatrix(m, n)
+dm = nerv.DoubleCuMatrix(m, n)
for i = 0, m - 1 do
for j = 0, n - 1 do
--- t[i][j] = i + j
- t[i][j] = math.random(10)
+ -- local t = math.random(10)
+ t = i / (j + 1)
+ fm[i][j] = t
+ dm[i][j] = t
end
end
-print(t)
-print(t:colsum())
-print(t:colmax())
-print(t:softmax())
+print(fm)
+print(fm:softmax())
+print(dm)
+print(dm:softmax())