mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-06 01:34:22 +00:00
45 lines
783 B
Plaintext
45 lines
783 B
Plaintext
#ifndef DENSE_LAYER_H
|
|
#define DENSE_LAYER_H
|
|
|
|
#include <functional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "ilayer.cuh"
|
|
|
|
namespace Layers {
|
|
|
|
class Dense : public ILayer {
|
|
public:
|
|
Dense(
|
|
int inputSize,
|
|
int outputSize,
|
|
Activation activation
|
|
);
|
|
~Dense();
|
|
|
|
void forward(const float* d_input, float* d_output);
|
|
void setWeights(const float* weights);
|
|
void setBiases(const float* biases);
|
|
|
|
private:
|
|
int inputSize;
|
|
int outputSize;
|
|
|
|
float* d_weights;
|
|
float* d_biases;
|
|
|
|
std::vector<float> weights;
|
|
std::vector<float> biases;
|
|
|
|
Activation activation;
|
|
|
|
void initializeWeights();
|
|
void initializeBiases();
|
|
void toCuda();
|
|
};
|
|
|
|
} // namespace Layers
|
|
|
|
#endif // DENSE_LAYER_H
|