diff options
author | txh18 <[email protected]> | 2015-12-01 21:39:16 +0800 |
---|---|---|
committer | txh18 <[email protected]> | 2015-12-01 21:39:16 +0800 |
commit | 0c286aa6237da9e8daa7db8ed1e3805a33312926 (patch) | |
tree | 9f9f8619aeb717e21b7fd51c30fac1cfbd06a3cb /nerv/lib/matrix/generic/cumatrix.c | |
parent | 910fd4a25527028414d6cc3b2b620c74e9d06e8c (diff) |
added rand_uniform and thres_mask for cumatrix
Diffstat (limited to 'nerv/lib/matrix/generic/cumatrix.c')
-rw-r--r-- | nerv/lib/matrix/generic/cumatrix.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/nerv/lib/matrix/generic/cumatrix.c b/nerv/lib/matrix/generic/cumatrix.c index 77cb304..cbb0481 100644 --- a/nerv/lib/matrix/generic/cumatrix.c +++ b/nerv/lib/matrix/generic/cumatrix.c @@ -10,6 +10,7 @@ #include "../../common.h" #include "../cukernel.h" #include "../cuda_helper.h" +#include <curand.h> void nerv_matrix_(add)(Matrix *c, const Matrix *a, const Matrix *b, MATRIX_ELEM alpha, MATRIX_ELEM beta, @@ -75,6 +76,20 @@ void nerv_matrix_(sigmoid_grad)(Matrix *nerr, const Matrix *err, NERV_SET_STATUS(status, NERV_NORMAL, 0); } +void nerv_matrix_(rand_uniform)(Matrix *a, Status *status) { + PROFILE_START + cudak_(cuda_rand_uniform)(a); + PROFILE_STOP + NERV_SET_STATUS(status, NERV_NORMAL, 0); +} + +void nerv_matrix_(thres_mask)(Matrix *a, double thres, double low, double high, Status *status) { + PROFILE_START + cudak_(cuda_thres_mask)(a, thres, low, high); + PROFILE_STOP + NERV_SET_STATUS(status, NERV_NORMAL, 0); +} + void nerv_matrix_(tanh)(Matrix *a, const Matrix *b, Status *status) { CHECK_SAME_DIMENSION(a, b, status); PROFILE_START |