caffe test convolution
authorYangqing Jia <jiayq84@gmail.com>
Fri, 4 Oct 2013 06:19:13 +0000 (23:19 -0700)
committerYangqing Jia <jiayq84@gmail.com>
Fri, 4 Oct 2013 06:19:13 +0000 (23:19 -0700)
src/caffe/test/test_convolution_layer.cpp

index 5de33bc591e75e891dafaa587f3b8533002f28de..fdd870f9de282ff2c78d6174adace57139f07f62 100644 (file)
@@ -151,6 +151,18 @@ TYPED_TEST(ConvolutionLayerTest, TestCPUGradient) {
   checker.CheckGradientExhaustive(layer, this->blob_bottom_vec_, this->blob_top_vec_);
 }
 
+TYPED_TEST(ConvolutionLayerTest, TestCPUGradientGroup) {
+  LayerParameter layer_param;
+  layer_param.set_kernelsize(3);
+  layer_param.set_stride(2);
+  layer_param.set_num_output(3);
+  layer_param.set_group(3);
+  Caffe::set_mode(Caffe::CPU);
+  ConvolutionLayer<TypeParam> layer(layer_param);
+  GradientChecker<TypeParam> checker(1e-2, 1e-2);
+  checker.CheckGradientExhaustive(layer, this->blob_bottom_vec_, this->blob_top_vec_);
+}
+
 TYPED_TEST(ConvolutionLayerTest, TestGPUGradient) {
   LayerParameter layer_param;
   layer_param.set_kernelsize(3);
@@ -162,4 +174,16 @@ TYPED_TEST(ConvolutionLayerTest, TestGPUGradient) {
   checker.CheckGradientExhaustive(layer, this->blob_bottom_vec_, this->blob_top_vec_);
 }
 
+TYPED_TEST(ConvolutionLayerTest, TestGPUGradientGroup) {
+  LayerParameter layer_param;
+  layer_param.set_kernelsize(3);
+  layer_param.set_stride(2);
+  layer_param.set_num_output(3);
+  layer_param.set_group(3);
+  Caffe::set_mode(Caffe::GPU);
+  ConvolutionLayer<TypeParam> layer(layer_param);
+  GradientChecker<TypeParam> checker(1e-2, 1e-2);
+  checker.CheckGradientExhaustive(layer, this->blob_bottom_vec_, this->blob_top_vec_);
+}
+
 }