aboutsummaryrefslogtreecommitdiff
path: root/mmatrix_example.lua
diff options
context:
space:
mode:
Diffstat (limited to 'mmatrix_example.lua')
-rw-r--r--mmatrix_example.lua21
1 files changed, 14 insertions, 7 deletions
diff --git a/mmatrix_example.lua b/mmatrix_example.lua
index 5b34779..39cd28e 100644
--- a/mmatrix_example.lua
+++ b/mmatrix_example.lua
@@ -1,9 +1,16 @@
-t = nerv.FloatMMatrix(5, 10)
-a = t[1]
-for i = 0, 4 do
- for j = 0, 9 do
- t[i][j] = i + j
+m = 10
+n = 10
+fm = nerv.FloatMMatrix(m, n)
+dm = nerv.DoubleMMatrix(m, n)
+for i = 0, m - 1 do
+ for j = 0, n - 1 do
+ -- local t = math.random(10)
+ t = i / (j + 1)
+ fm[i][j] = t
+ dm[i][j] = t
end
end
-print(t)
-print(a)
+print(fm)
+-- print(fm:softmax())
+print(dm)
+-- print(dm:softmax())