aboutsummaryrefslogtreecommitdiff
path: root/nerv/matrix/generic/cumatrix.c
diff options
context:
space:
mode:
authortxh18 <cloudygooseg@gmail.com>2015-12-01 21:39:16 +0800
committertxh18 <cloudygooseg@gmail.com>2015-12-01 21:39:16 +0800
commit0c286aa6237da9e8daa7db8ed1e3805a33312926 (patch)
tree9f9f8619aeb717e21b7fd51c30fac1cfbd06a3cb /nerv/matrix/generic/cumatrix.c
parent910fd4a25527028414d6cc3b2b620c74e9d06e8c (diff)
added rand_uniform and thres_mask for cumatrix
Diffstat (limited to 'nerv/matrix/generic/cumatrix.c')
-rw-r--r--nerv/matrix/generic/cumatrix.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/nerv/matrix/generic/cumatrix.c b/nerv/matrix/generic/cumatrix.c
index 3d9e694..d1f763b 100644
--- a/nerv/matrix/generic/cumatrix.c
+++ b/nerv/matrix/generic/cumatrix.c
@@ -62,6 +62,25 @@ static int nerv_matrix_(lua_sigmoid_grad)(lua_State *L) {
return 0;
}
+static int nerv_matrix_(lua_thres_mask)(lua_State *L) {
+ Status status;
+ Matrix *a = luaT_checkudata(L, 1, nerv_matrix_(tname));
+ MATRIX_ELEM thres = luaL_checknumber(L, 2);
+ MATRIX_ELEM low = luaL_checknumber(L, 3);
+ MATRIX_ELEM high = luaL_checknumber(L, 4);
+ nerv_matrix_(thres_mask)(a, thres, low, high, &status);
+ NERV_LUA_CHECK_STATUS(L, status);
+ return 0;
+}
+
+static int nerv_matrix_(lua_rand_uniform)(lua_State *L) {
+ Status status;
+ Matrix *a = luaT_checkudata(L, 1, nerv_matrix_(tname));
+ nerv_matrix_(rand_uniform)(a, &status);
+ NERV_LUA_CHECK_STATUS(L, status);
+ return 0;
+}
+
static int nerv_matrix_(lua_tanh)(lua_State *L) {
Status status;
Matrix *a = luaT_checkudata(L, 1, nerv_matrix_(tname));
@@ -349,9 +368,11 @@ static const luaL_Reg nerv_matrix_(extra_methods)[] = {
{"sigmoid_grad", nerv_matrix_(lua_sigmoid_grad)},
{"tanh", nerv_matrix_(lua_tanh)},
{"tanh_grad", nerv_matrix_(lua_tanh_grad)},
+ {"rand_uniform", nerv_matrix_(lua_rand_uniform)},
{"softmax", nerv_matrix_(lua_softmax)},
{"mul_elem", nerv_matrix_(lua_mul_elem)},
{"log_elem", nerv_matrix_(lua_log_elem)},
+ {"thres_mask", nerv_matrix_(lua_thres_mask)},
{"copy_rows_fromh_by_idx", nerv_matrix_(lua_copy_rows_fromh_by_idx)},
{"copy_rows_fromd_by_idx", nerv_matrix_(lua_copy_rows_fromd_by_idx)},
{"expand_frm", nerv_matrix_(lua_expand_frm)},