Rework padding size setting

This commit is contained in:
2024-04-20 16:31:28 +02:00
parent dbaab5652e
commit ecf7416f8e
5 changed files with 44 additions and 59 deletions

View File

@@ -23,7 +23,7 @@ class Conv2d : public WeightedLayer {
* @param kernelSize Width and height of the convolution kernel
* @param stride Convolution stride
* @param numFilters Number of output filters
* @param padding Padding type ('SAME' or 'VALID')
* @param paddingSize Padding size
* @param activationType Activation function type ('RELU', 'SIGMOID',
* 'SOFTMAX' or 'NONE')
*/
@@ -33,7 +33,7 @@ class Conv2d : public WeightedLayer {
int kernelSize,
int stride,
int numFilters,
Padding padding,
int paddingSize,
ActivationType activationType
);

View File

@@ -4,32 +4,26 @@
#include <vector>
#define CUDANET_SAME_PADDING(inputSize, kernelSize, stride) ((stride - 1) * inputSize - stride + kernelSize) / 2;
namespace CUDANet::Layers {
/**
* @brief Padding types
*
* SAME: Zero padding such that the output size is the same as the input
* VALID: No padding
*
*/
enum Padding { SAME, VALID };
/**
* @brief Basic Sequential Layer
*
*
*/
class SequentialLayer {
public:
/**
* @brief Destroy the Sequential Layer
*
*
*/
virtual ~SequentialLayer() {};
virtual ~SequentialLayer(){};
/**
* @brief Forward propagation virtual function
*
*
* @param input Device pointer to the input
* @return float* Device pointer to the output
*/
@@ -45,7 +39,7 @@ class WeightedLayer : public SequentialLayer {
* @brief Destroy the ILayer object
*
*/
virtual ~WeightedLayer() {};
virtual ~WeightedLayer(){};
/**
* @brief Virtual function for forward pass
@@ -64,7 +58,7 @@ class WeightedLayer : public SequentialLayer {
/**
* @brief Virtual function for getting weights
*
*
*/
virtual std::vector<float> getWeights() = 0;
@@ -77,7 +71,7 @@ class WeightedLayer : public SequentialLayer {
/**
* @brief Virtual function for getting biases
*
*
*/
virtual std::vector<float> getBiases() = 0;