aboutsummaryrefslogtreecommitdiff
path: root/mmatrix_example.lua
diff options
context:
space:
mode:
authorDeterminant <ted.sybil@gmail.com>2015-05-19 15:09:06 +0800
committerDeterminant <ted.sybil@gmail.com>2015-05-19 15:09:06 +0800
commit0e738af4bb1eda301564d8469178a7581b0cbcce (patch)
tree4e94320a4a27d8a01bb4419b444d16d80b96a8d2 /mmatrix_example.lua
parente9b8855c894daa4e6749acfe891f68b3ed8ed481 (diff)
...
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())