mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-05 17:34:21 +00:00
Remove not needed code
This commit is contained in:
@@ -1,16 +1,12 @@
|
||||
#include <functional>
|
||||
|
||||
#ifndef ACTIVATIONS_H
|
||||
#define ACTIVATIONS_H
|
||||
|
||||
__device__ float sigmoid(float a);
|
||||
__device__ float relu(float a);
|
||||
__device__ float linear(float a);
|
||||
|
||||
__global__ void
|
||||
sigmoid_kernel(const float* __restrict__ src, float* __restrict__ dst, int len);
|
||||
|
||||
__global__ void
|
||||
relu_kernel(const float* __restrict__ src, float* __restrict__ dst, int len);
|
||||
|
||||
__global__ void
|
||||
linear_kernel(const float* __restrict__ src, float* __restrict__ dst, int len);
|
||||
|
||||
|
||||
@@ -2,18 +2,6 @@
|
||||
|
||||
#include "activations.cuh"
|
||||
|
||||
__device__ float sigmoid(float a) {
|
||||
return 1.0 / (1.0 + exp(-a));
|
||||
}
|
||||
|
||||
__device__ float relu(float a) {
|
||||
return a < 0.0 ? 0.0 : a;
|
||||
}
|
||||
|
||||
__device__ float linear(float a) {
|
||||
return a;
|
||||
}
|
||||
|
||||
__global__ void sigmoid_kernel(
|
||||
const float* __restrict__ src,
|
||||
float* __restrict__ dst,
|
||||
@@ -23,7 +11,7 @@ __global__ void sigmoid_kernel(
|
||||
int tid = blockDim.x * blockIdx.x + threadIdx.x;
|
||||
|
||||
for (int i = tid; i < len; i += stride) {
|
||||
dst[i] = sigmoid(src[i]);
|
||||
dst[i] = 1.0 / (1.0 + exp(-src[i]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +21,7 @@ relu_kernel(const float* __restrict__ src, float* __restrict__ dst, int len) {
|
||||
int tid = blockDim.x * blockIdx.x + threadIdx.x;
|
||||
|
||||
for (int i = tid; i < len; i += stride) {
|
||||
dst[i] = relu(src[i]);
|
||||
dst[i] = src[i] < 0.0 ? 0.0 : src[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +31,6 @@ linear_kernel(const float* __restrict__ src, float* __restrict__ dst, int len) {
|
||||
int tid = blockDim.x * blockIdx.x + threadIdx.x;
|
||||
|
||||
for (int i = tid; i < len; i += stride) {
|
||||
dst[i] = linear(src[i]);
|
||||
dst[i] = src[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,6 +81,8 @@ void Layers::Dense::forward(const float* d_input, float* d_output) {
|
||||
d_output, d_output, outputSize
|
||||
);
|
||||
}
|
||||
|
||||
CUDA_CHECK(cudaDeviceSynchronize());
|
||||
}
|
||||
|
||||
void Layers::Dense::toCuda() {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
#include <cuda_runtime_api.h>
|
||||
#include <driver_types.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "activations.cuh"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test_cublas_fixture.cuh"
|
||||
|
||||
class ActivationsTest : public CublasTestFixture {
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#include <cuda_runtime_api.h>
|
||||
#include <driver_types.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "activations.cuh"
|
||||
#include "dense.cuh"
|
||||
#include "gtest/gtest.h"
|
||||
#include "test_cublas_fixture.cuh"
|
||||
|
||||
class DenseLayerTest : public CublasTestFixture {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "cublas_v2.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <cublas_v2.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "test_cublas_fixture.cuh"
|
||||
|
||||
cublasHandle_t CublasTestFixture::cublasHandle;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "cublas_v2.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <cublas_v2.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
class CublasTestFixture : public ::testing::Test {
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user