FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
CaffeOnACL/src/caffe/layers/cudnn_pooling_layer.cpp at master · 2php/CaffeOnACL · GitHub
2php
CaffeOnACL
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
CaffeOnACL
/
src
/
caffe
/
layers
/
cudnn_pooling_layer.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (38 loc) · 1.48 KB
Breadcrumbs
CaffeOnACL
/
src
/
caffe
/
layers
/
cudnn_pooling_layer.cpp
Copy path
File metadata and controls
46 lines (38 loc) · 1.48 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#
ifdef
USE_CUDNN
#
include
<
vector
>
#
include
"
caffe/layers/cudnn_pooling_layer.hpp
"
namespace
caffe
{
template
<
typename
Dtype>
void
CuDNNPoolingLayer<Dtype>::LayerSetUp(
const
vector<Blob<Dtype>*>& bottom,
const
vector<Blob<Dtype>*>& top) {
PoolingLayer<Dtype>::
LayerSetUp
(bottom, top);
CUDNN_CHECK
(
cudnnCreate
(&handle_));
cudnn::createTensor4dDesc<Dtype>(&bottom_desc_);
cudnn::createTensor4dDesc<Dtype>(&top_desc_);
cudnn::createPoolingDesc<Dtype>(&pooling_desc_,
this
->
layer_param_
.
pooling_param
().
pool
(), &mode_,
this
->
kernel_h_
,
this
->
kernel_w_
,
this
->
pad_h_
,
this
->
pad_w_
,
this
->
stride_h_
,
this
->
stride_w_
);
handles_setup_ =
true
;
}
template
<
typename
Dtype>
void
CuDNNPoolingLayer<Dtype>::Reshape(
const
vector<Blob<Dtype>*>& bottom,
const
vector<Blob<Dtype>*>& top) {
PoolingLayer<Dtype>::
Reshape
(bottom, top);
cudnn::setTensor4dDesc<Dtype>(&bottom_desc_, bottom[
0
]->
num
(),
this
->
channels_
,
this
->
height_
,
this
->
width_
);
cudnn::setTensor4dDesc<Dtype>(&top_desc_, bottom[
0
]->
num
(),
this
->
channels_
,
this
->
pooled_height_
,
this
->
pooled_width_
);
}
template
<
typename
Dtype>
CuDNNPoolingLayer<Dtype>::
~CuDNNPoolingLayer
() {
//
Check that handles have been setup before destroying.
if
(!handles_setup_) {
return
; }
cudnnDestroyTensorDescriptor
(bottom_desc_);
cudnnDestroyTensorDescriptor
(top_desc_);
cudnnDestroyPoolingDescriptor
(pooling_desc_);
cudnnDestroy
(handle_);
}
INSTANTIATE_CLASS
(CuDNNPoolingLayer);
}
//
namespace caffe
#
endif
Back
|
FazBrowse Home
|
New Git URL