Created
September 2, 2017 20:53
-
-
Save sbugrov/ca710ec2025c410221548d5c89c416ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__global__ void kSigmoid(float const *input, float *output) { | |
/* Computes the value of the sigmoid function f(x) = 1/(1 + e^-x). | |
Inputs: | |
input: array | |
output: array, the results of the computation are to be stored here | |
*/ | |
const int id = blockIdx.x * blockDim.x + threadIdx.x; | |
output[id] = 1.0 / (1.0 + std::exp(-input[id])); | |
} | |
__device__ void dSigmoid(float const *input, float *output, const int height, const int width){ | |
kSigmoid <<< height, width >>> (input, output); | |
cudaDeviceSynchronize(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment