Skip to content

Commit

Permalink
Make class CuDNNNeuronLayerTest derive from GPUDeviceTest
Browse files Browse the repository at this point in the history
  • Loading branch information
flx42 committed May 26, 2015
1 parent 8437c64 commit f48cead
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/caffe/test/test_neuron_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ TYPED_TEST(NeuronLayerTest, TestPReLUInPlace) {

#ifdef USE_CUDNN
template <typename Dtype>
class CuDNNNeuronLayerTest : public ::testing::Test {
class CuDNNNeuronLayerTest : public GPUDeviceTest<Dtype> {
protected:
CuDNNNeuronLayerTest()
: blob_bottom_(new Blob<Dtype>(2, 3, 4, 5)),
Expand All @@ -609,7 +609,6 @@ class CuDNNNeuronLayerTest : public ::testing::Test {
TYPED_TEST_CASE(CuDNNNeuronLayerTest, TestDtypes);

TYPED_TEST(CuDNNNeuronLayerTest, TestReLUCuDNN) {
Caffe::set_mode(Caffe::GPU);
LayerParameter layer_param;
CuDNNReLULayer<TypeParam> layer(layer_param);
layer.SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
Expand All @@ -624,7 +623,6 @@ TYPED_TEST(CuDNNNeuronLayerTest, TestReLUCuDNN) {
}

TYPED_TEST(CuDNNNeuronLayerTest, TestReLUGradientCuDNN) {
Caffe::set_mode(Caffe::GPU);
LayerParameter layer_param;
CuDNNReLULayer<TypeParam> layer(layer_param);
GradientChecker<TypeParam> checker(1e-2, 1e-3, 1701, 0., 0.01);
Expand All @@ -633,7 +631,6 @@ TYPED_TEST(CuDNNNeuronLayerTest, TestReLUGradientCuDNN) {
}

TYPED_TEST(CuDNNNeuronLayerTest, TestReLUWithNegativeSlopeCuDNN) {
Caffe::set_mode(Caffe::GPU);
LayerParameter layer_param;
CHECK(google::protobuf::TextFormat::ParseFromString(
"relu_param { negative_slope: 0.01 }", &layer_param));
Expand All @@ -653,7 +650,6 @@ TYPED_TEST(CuDNNNeuronLayerTest, TestReLUWithNegativeSlopeCuDNN) {
}

TYPED_TEST(CuDNNNeuronLayerTest, TestReLUGradientWithNegativeSlopeCuDNN) {
Caffe::set_mode(Caffe::GPU);
LayerParameter layer_param;
CHECK(google::protobuf::TextFormat::ParseFromString(
"relu_param { negative_slope: 0.01 }", &layer_param));
Expand All @@ -664,7 +660,6 @@ TYPED_TEST(CuDNNNeuronLayerTest, TestReLUGradientWithNegativeSlopeCuDNN) {
}

TYPED_TEST(CuDNNNeuronLayerTest, TestSigmoidCuDNN) {
Caffe::set_mode(Caffe::GPU);
LayerParameter layer_param;
CuDNNSigmoidLayer<TypeParam> layer(layer_param);
layer.SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
Expand All @@ -681,7 +676,6 @@ TYPED_TEST(CuDNNNeuronLayerTest, TestSigmoidCuDNN) {
}

TYPED_TEST(CuDNNNeuronLayerTest, TestSigmoidGradientCuDNN) {
Caffe::set_mode(Caffe::GPU);
LayerParameter layer_param;
CuDNNSigmoidLayer<TypeParam> layer(layer_param);
GradientChecker<TypeParam> checker(1e-2, 1e-3, 1701, 0., 0.01);
Expand All @@ -690,7 +684,6 @@ TYPED_TEST(CuDNNNeuronLayerTest, TestSigmoidGradientCuDNN) {
}

TYPED_TEST(CuDNNNeuronLayerTest, TestTanHCuDNN) {
Caffe::set_mode(Caffe::GPU);
LayerParameter layer_param;
CuDNNTanHLayer<TypeParam> layer(layer_param);
layer.SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
Expand All @@ -713,7 +706,6 @@ TYPED_TEST(CuDNNNeuronLayerTest, TestTanHCuDNN) {
}

TYPED_TEST(CuDNNNeuronLayerTest, TestTanHGradientCuDNN) {
Caffe::set_mode(Caffe::GPU);
LayerParameter layer_param;
CuDNNTanHLayer<TypeParam> layer(layer_param);
GradientChecker<TypeParam> checker(1e-2, 1e-3);
Expand Down

0 comments on commit f48cead

Please sign in to comment.