void CuDNNPoolingLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
PoolingLayer<Dtype>::LayerSetUp(bottom, top);
- // Sanity check: CUDNN currently only supports pad == 0.
- CHECK_EQ(this->pad_h_, 0);
- CHECK_EQ(this->pad_w_, 0);
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->stride_h_, this->stride_w_);
+ this->kernel_h_, this->kernel_w_, this->pad_h_, this->pad_w_,
+ this->stride_h_, this->stride_w_);
handles_setup_ = true;
}
EXPECT_EQ(this->blob_top_->width(), 2);
}
-// This test and all following cuDNN pooling tests with padding are commented
-// for now, since cuDNN pooling does not currently support padding.
-/*
TYPED_TEST(CuDNNPoolingLayerTest, TestSetupPaddedCuDNN) {
Caffe::set_mode(Caffe::GPU);
LayerParameter layer_param;
EXPECT_EQ(this->blob_top_->height(), 4);
EXPECT_EQ(this->blob_top_->width(), 3);
}
-*/
/*
TYPED_TEST(CuDNNPoolingLayerTest, PrintBackwardCuDNN) {
}
}
-/*
TYPED_TEST(CuDNNPoolingLayerTest, TestForwardMaxPaddedCuDNN) {
Caffe::set_mode(Caffe::GPU);
LayerParameter layer_param;
EXPECT_NEAR(this->blob_top_->cpu_data()[7], 4, epsilon);
EXPECT_NEAR(this->blob_top_->cpu_data()[8], 1, epsilon);
}
-*/
/*
TYPED_TEST(CuDNNPoolingLayerTest, TestGradientMaxTopMaskCuDNN) {
}
}
-/*
TYPED_TEST(CuDNNPoolingLayerTest, TestGradientAvePaddedCuDNN) {
Caffe::set_mode(Caffe::GPU);
for (int kernel_h = 3; kernel_h <= 4; kernel_h++) {
}
}
}
-*/
#endif