aboutsummaryrefslogtreecommitdiff
path: root/cumatrix_example.lua
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-05-18 23:34:08 +0800
committerDeterminant <[email protected]>2015-05-18 23:34:08 +0800
commit186cf4f39e1c753a6056101f654d2939f812d285 (patch)
treeda6bbc97c8f553ad473c820484b879a4b6a00968 /cumatrix_example.lua
parent23fd2694723ab3f2203e6cd040c5e6633cb989c7 (diff)
add softmax for cumatrix
Diffstat (limited to 'cumatrix_example.lua')
-rw-r--r--cumatrix_example.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/cumatrix_example.lua b/cumatrix_example.lua
index 88b5912..c2f2139 100644
--- a/cumatrix_example.lua
+++ b/cumatrix_example.lua
@@ -1,15 +1,15 @@
-m = 600
-n = 600
+m = 10
+n = 10
t = nerv.FloatCuMatrix(m, n)
-t2 = nerv.FloatCuMatrix(m, n)
-- print(t)
a = t[1]
for i = 0, m - 1 do
- tt = t[i]
- tt2 = t2[i]
for j = 0, n - 1 do
- tt[j] = i + j
- tt2[j] = t[i][j]
+-- t[i][j] = i + j
+ t[i][j] = math.random(10)
end
end
--- print(t:rowsum())
+print(t)
+print(t:colsum())
+print(t:colmax())
+print(t:softmax())