summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 91abaec)
raw | patch | inline | side by side (parent: 91abaec)
author | Yangqing Jia <jiayq84@gmail.com> | |
Thu, 26 Sep 2013 17:04:25 +0000 (10:04 -0700) | ||
committer | Yangqing Jia <jiayq84@gmail.com> | |
Thu, 26 Sep 2013 17:04:25 +0000 (10:04 -0700) |
src/caffe/test/test_softmax_layer.cpp | patch | blob | history |
index 253ea8a9f09bb37dc635eb740e1ff834ceed9949..fc1c1b70163ce0722f7ea54978984aac33b75dfa 100644 (file)
SoftmaxLayer<TypeParam> layer(layer_param);
layer.SetUp(this->blob_bottom_vec_, &(this->blob_top_vec_));
layer.Forward(this->blob_bottom_vec_, &(this->blob_top_vec_));
+ // Test sum
+ for (int i = 0; i < this->blob_bottom_->num(); ++i) {
+ TypeParam sum = 0;
+ for (int j = 0; j < this->blob_top_->channels(); ++j) {
+ sum += this->blob_top_->data_at(i, j, 0, 0);
+ }
+ EXPECT_GE(sum, 0.999);
+ EXPECT_LE(sum, 1.001);
+ }
+ // Test exact values
for (int i = 0; i < this->blob_bottom_->num(); ++i) {
TypeParam scale = 0;
for (int j = 0; j < this->blob_bottom_->channels(); ++j) {