SpatialTransformerLayer icon indicating copy to clipboard operation
SpatialTransformerLayer copied to clipboard

Gradient test case may fail in GPU single precision mode

Open ychfan opened this issue 8 years ago • 4 comments

When running the test case in src/caffe/test/test_st_layer_hard.cpp, some cases in GPU single precision mode may fail.

ychfan avatar Sep 29 '16 19:09 ychfan

Yes, I found the same problem when I did my experiments.

I think it’s the precision problem at the point of sub gradient. Just use the double precision mode and you should be fine.

Thank you.

daerduoCarey avatar Oct 03 '16 09:10 daerduoCarey

I have the same question, and how did you solve it? When I make test, I see the question.

hugguofeng avatar Nov 15 '16 01:11 hugguofeng

I didn't solve it. As i said before, I think that's the inherent precision problem. I chose to use double precision float during my experiments. Thank you.

daerduoCarey avatar Nov 21 '16 05:11 daerduoCarey

@daerduoCarey double precision also fails in some cases. When theta is set to identity matrix, unit test fails.

		Dtype *theta = this->blob_theta_->mutable_cpu_data();
		caffe_set(this->blob_theta_->count(), Dtype(0), theta);
		theta[0] += 1;
		theta[4] += 1;
		theta[6] += 1;
		theta[10] += 1;

seed93 avatar Apr 11 '17 03:04 seed93