conv2d implementation

This commit is contained in:
Francesco Gatti
2017-06-28 14:04:43 +00:00
parent 8bf0b0257e
commit 3cb126420c
6 changed files with 199 additions and 34 deletions
+11
View File
@@ -1,5 +1,11 @@
#include "kernels.h"
/**
Exponential Linear Unit compute kernel
it does the following operation for each x input element:
x < 0 : y = e^(x) -1
x > 0 : y = x
*/
__global__
void activation_elu(value_type *input, value_type *output, int size) {
@@ -7,9 +13,14 @@ void activation_elu(value_type *input, value_type *output, int size) {
if(i<size)
output[i] = (input[i]>0)*input[i] + (input[i]<0)*(expf(input[i]) -1);
// the if x > or < is condensed in one operation for better threads flow
}
/**
ELU activation function
*/
void activationELUForward(value_type* srcData, value_type* dstData, int size)
{
activation_elu<<<(size+255)/256, 256>>>(srcData, dstData, size);