mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-06 01:34:22 +00:00
Implement to_cuda function
This commit is contained in:
@@ -5,15 +5,17 @@
|
||||
|
||||
#include <vector>
|
||||
#include <cublas_v2.h>
|
||||
#include <ilayer.h>
|
||||
|
||||
namespace Layers {
|
||||
|
||||
class Dense {
|
||||
class Dense : public ILayer {
|
||||
public:
|
||||
Dense(int inputSize, int outputSize, cublasHandle_t cublasHandle);
|
||||
~Dense();
|
||||
|
||||
void forward(const float* input, float* output);
|
||||
void to_cuda();
|
||||
|
||||
private:
|
||||
int inputSize;
|
||||
|
||||
19
include/layers/ilayer.h
Normal file
19
include/layers/ilayer.h
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
#ifndef I_LAYER_H
|
||||
#define I_LAYER_H
|
||||
|
||||
#include <cublas_v2.h>
|
||||
|
||||
namespace Layers {
|
||||
|
||||
class ILayer {
|
||||
public:
|
||||
virtual ~ILayer() {}
|
||||
|
||||
virtual void forward(const float* input, float* output) = 0;
|
||||
virtual void to_cuda() = 0;
|
||||
};
|
||||
|
||||
} // namespace Layers
|
||||
|
||||
#endif // I_LAYERH
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <cuda_runtime.h>
|
||||
|
||||
#define IDX2C(i,j,ld) (((j)*(ld))+(i))
|
||||
|
||||
// CUDA error checking macro
|
||||
#define CUDA_CHECK(call) \
|
||||
do { \
|
||||
|
||||
Reference in New Issue
Block a user