From 0c286aa6237da9e8daa7db8ed1e3805a33312926 Mon Sep 17 00:00:00 2001 From: txh18 Date: Tue, 1 Dec 2015 21:39:16 +0800 Subject: added rand_uniform and thres_mask for cumatrix --- nerv/lib/matrix/generic/cumatrix.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'nerv/lib/matrix/generic/cumatrix.c') 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 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 -- cgit v1.2.3-70-g09d2