mirror of
https://github.com/lordmathis/CUDANet.git
synced 2025-11-05 17:34:21 +00:00
Migrate avg pooling
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
#ifndef CUDANET_H
|
||||
#define CUDANET_H
|
||||
|
||||
// Kernels
|
||||
#ifdef USE_CUDA
|
||||
#include "activation_functions.cuh"
|
||||
#include "convolution.cuh"
|
||||
#include "matmul.cuh"
|
||||
#include "pooling.cuh"
|
||||
#endif
|
||||
|
||||
// Layers
|
||||
#include "activation.hpp"
|
||||
#include "add.cuh"
|
||||
#include "avg_pooling.cuh"
|
||||
#include "add.hpp"
|
||||
#include "avg_pooling.hpp"
|
||||
#include "batch_norm.cuh"
|
||||
#include "concat.cuh"
|
||||
#include "conv2d.cuh"
|
||||
@@ -25,8 +26,10 @@
|
||||
#include "module.hpp"
|
||||
|
||||
// Utils
|
||||
#include "cuda_helper.cuh"
|
||||
#include "imagenet.hpp"
|
||||
#ifdef USE_CUDA
|
||||
#include "cuda_helper.cuh"
|
||||
#include "vector.cuh"
|
||||
#endif
|
||||
|
||||
#endif // CUDANET_H
|
||||
@@ -18,7 +18,7 @@ class AvgPooling2d : public SequentialLayer, public TwoDLayer {
|
||||
);
|
||||
~AvgPooling2d();
|
||||
|
||||
float* forward(const float* d_input);
|
||||
float* forward(const float* input);
|
||||
|
||||
/**
|
||||
* @brief Get output size
|
||||
@@ -45,14 +45,32 @@ class AvgPooling2d : public SequentialLayer, public TwoDLayer {
|
||||
|
||||
shape2d outputSize;
|
||||
|
||||
float* d_output;
|
||||
|
||||
Activation* activation;
|
||||
|
||||
float* forwardCPU(const float* input);
|
||||
|
||||
#ifdef USE_CUDA
|
||||
float* d_output;
|
||||
float* forwardCUDA(const float* d_input);
|
||||
|
||||
void initCUDA();
|
||||
void delCUDA();
|
||||
#endif
|
||||
};
|
||||
|
||||
class AdaptiveAvgPooling2d : public AvgPooling2d {
|
||||
public:
|
||||
AdaptiveAvgPooling2d(shape2d inputShape, int nChannels, shape2d outputShape, ActivationType activationType);
|
||||
AdaptiveAvgPooling2d(
|
||||
shape2d inputShape,
|
||||
int nChannels,
|
||||
shape2d outputShape,
|
||||
ActivationType activationType
|
||||
);
|
||||
|
||||
private:
|
||||
#ifdef USE_CUDA
|
||||
void initCUDA();
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace CUDANet::Layers
|
||||
Reference in New Issue
Block a user