Test softmax

This commit is contained in:
2024-03-17 19:08:16 +01:00
parent 42d646750b
commit cbdb4e7707
5 changed files with 49 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
#include <functional>
#include <cmath>
#include "activation_functions.cuh"
#include "cuda_helper.cuh"
@@ -38,7 +38,7 @@ __global__ void CUDANet::Kernels::softmax_exp(
int tid = blockDim.x * blockIdx.x + threadIdx.x;
for (int i = tid; i < len; i += stride) {
dst[i] = exp(src[i]);
dst[i] = std::exp(src[i]);
}
}

View File

@@ -41,7 +41,7 @@ void Layers::Activation::activate(float* __restrict__ d_input) {
d_input, d_input, length
);
Kernels::softmax_sum<<<gridSize, BLOCK_SIZE>>>(
Kernels::softmax_sum<<<gridSize / 2, BLOCK_SIZE>>>(
d_input, d_softmax_sum, length
);