-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaxpooling.cuh
52 lines (42 loc) · 1.02 KB
/
maxpooling.cuh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef _MAXPOOLING_H_
#define _MAXPOOLING_H_
#include "layer.cuh"
class MaxPooling : public Layer
{
public:
MaxPooling(int channel_in,
int height_in,
int width_in,
int kernel_size,
int stride,
int pad,
int dilation
);
~MaxPooling();
double* forward(double *input) override;
double* backward(double *grad_input) override;
void update(double lr) override;
private:
int channel_in{};
int height_in{};
int width_in{};
int kernel_h{};
int kernel_w{};
int stride_h{};
int stride_w{};
int pad_h{};
int pad_w{};
int dilation_h{};
int dilation_w{};
int channel_out{};
int height_out{};
int width_out{};
double *input;
double *a;
double *input_grad;
cudnnHandle_t cudnnHandle;
cudnnPoolingDescriptor_t pooling_desc;
cudnnTensorDescriptor_t input_desc;
cudnnTensorDescriptor_t output_desc;
};
#endif // _MAXPOOLING_H_