mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-05 17:34:21 +00:00
Implement avg pooling
This commit is contained in:
@@ -11,8 +11,7 @@ __global__ void max_pooling(
|
||||
const int inputSize,
|
||||
const int nChannels,
|
||||
const int poolingSize,
|
||||
const int stride,
|
||||
const int paddingSize
|
||||
const int stride
|
||||
);
|
||||
|
||||
__global__ void avg_pooling(
|
||||
@@ -21,8 +20,7 @@ __global__ void avg_pooling(
|
||||
const int inputSize,
|
||||
const int nChannels,
|
||||
const int poolingSize,
|
||||
const int stride,
|
||||
const int paddingSize
|
||||
const int stride
|
||||
);
|
||||
|
||||
} // namespace CUDANet::Kernels
|
||||
|
||||
38
include/layers/avg_pooling.cuh
Normal file
38
include/layers/avg_pooling.cuh
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef CUDANET_AVG_POOLING_H
|
||||
#define CUDANET_AVG_POOLING_H
|
||||
|
||||
#include "activation.cuh"
|
||||
#include "layer.cuh"
|
||||
|
||||
namespace CUDANet::Layers {
|
||||
|
||||
class AvgPooling2D : public SequentialLayer {
|
||||
public:
|
||||
AvgPooling2D(
|
||||
int inputSize,
|
||||
int nChannels,
|
||||
int poolingSize,
|
||||
int stride,
|
||||
ActivationType activationType
|
||||
);
|
||||
~AvgPooling2D();
|
||||
|
||||
float* forward(const float* d_input);
|
||||
|
||||
private:
|
||||
int inputSize;
|
||||
int nChannels;
|
||||
int poolingSize;
|
||||
int stride;
|
||||
|
||||
int outputSize;
|
||||
int gridSize;
|
||||
|
||||
float* d_output;
|
||||
|
||||
Activation activation;
|
||||
};
|
||||
|
||||
} // namespace CUDANet::Layers
|
||||
|
||||
#endif // CUDANET_AVG_POOLING_H
|
||||
@@ -15,7 +15,6 @@ class MaxPooling2D : public SequentialLayer {
|
||||
int nChannels,
|
||||
int poolingSize,
|
||||
int stride,
|
||||
Padding padding,
|
||||
ActivationType activationType
|
||||
);
|
||||
~MaxPooling2D();
|
||||
@@ -27,7 +26,6 @@ class MaxPooling2D : public SequentialLayer {
|
||||
int nChannels;
|
||||
int poolingSize;
|
||||
int stride;
|
||||
int paddingSize;
|
||||
|
||||
int outputSize;
|
||||
int gridSize;
|
||||
|
||||
Reference in New Issue
Block a user