Implement output layer

This commit is contained in:
2024-03-21 23:07:46 +01:00
parent e46d5d3f76
commit 90fb104dae
8 changed files with 92 additions and 9 deletions

View File

@@ -1,7 +1,6 @@
#ifndef CUDANET_CONV_LAYER_H
#define CUDANET_CONV_LAYER_H
#include <string>
#include <vector>
#include "activation.cuh"

View File

@@ -1,8 +1,6 @@
#ifndef CUDANET_DENSE_LAYER_H
#define CUDANET_DENSE_LAYER_H
#include <functional>
#include <string>
#include <vector>
#include "layer.cuh"

View File

@@ -2,8 +2,6 @@
#ifndef CUDANET_I_LAYER_H
#define CUDANET_I_LAYER_H
#include <vector>
namespace CUDANet::Layers {
/**

39
include/layers/output.cuh Normal file
View File

@@ -0,0 +1,39 @@
#ifndef CUDANET_OUTPUT_LAYER_H
#define CUDANET_OUTPUT_LAYER_H
#include "layer.cuh"
namespace CUDANet::Layers {
class Output : public SequentialLayer {
public:
/**
* @brief Create a new Output layer
*
* @param inputSize Size of the input vector
*/
explicit Output(int inputSize);
/**
* @brief Destroy the Output layer
*
*/
~Output();
/**
* @brief Forward pass of the output layer. Just copies the input from device to host
*
* @param input Device pointer to the input vector
* @return Host pointer to the output vector
*/
float* forward(const float* input);
private:
int inputSize;
float* h_output;
};
} // namespace CUDANet::Layers
#endif // CUDANET_OUTPUT_LAYER_H

View File

@@ -4,7 +4,9 @@
#include <string>
#include <vector>
#include <map>
#include "layer.cuh"
#include "input.cuh"
namespace CUDANet {