summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDylan Paiton <dpaiton@yahoo-inc.com>2015-06-16 17:57:07 -0700
committerDylan Paiton <dpaiton@yahoo-inc.com>2015-06-16 17:57:07 -0700
commit98fb438c0d14f279d434719abd3e79b7f9d231ae (patch)
tree6bcc75e80b5bfa0faf34e80b6b1f65ac5b3582f5 /src
parent0d7c6cb4b2286980c3d5b47cfddb2457202c93cf (diff)
downloadcaffeonacl-98fb438c0d14f279d434719abd3e79b7f9d231ae.tar.gz
caffeonacl-98fb438c0d14f279d434719abd3e79b7f9d231ae.tar.bz2
caffeonacl-98fb438c0d14f279d434719abd3e79b7f9d231ae.zip
fixed two bugs with prototext format
The first bug was in InitUnsharedWeightsNet. Proto var was of type ostringstream, which converted the bool bias_term into an int. I wrote an inline conditional to convert the term into a string. This allows backwards compatibility with earlier prototext versions (e.g. version 2.3.0 on Redhat was failing without this). The second bug was in the syntax for repeated bool parameters, assigned to the propagate_down parameter. The style used for e.g. propagate_down: [true,true] does not work with earlier prototext versions (failed with version 2.3.0 on Redhat). New syntax works for all versions.
Diffstat (limited to 'src')
-rw-r--r--src/caffe/test/test_net.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/caffe/test/test_net.cpp b/src/caffe/test/test_net.cpp
index 782a96bc..56959f47 100644
--- a/src/caffe/test/test_net.cpp
+++ b/src/caffe/test/test_net.cpp
@@ -288,6 +288,7 @@ class NetTest : public MultiDeviceTest<TypeParam> {
const bool force_backward = false, const bool bias_term = false,
const Dtype blobs_lr_w1 = 1, const Dtype blobs_lr_b1 = 2,
const Dtype blobs_lr_w2 = 1, const Dtype blobs_lr_b2 = 2) {
+ string bias_str = bias_term ? "true ":"false ";
ostringstream proto;
proto << "name: 'UnsharedWeightsNetwork' ";
if (force_backward) {
@@ -314,7 +315,7 @@ class NetTest : public MultiDeviceTest<TypeParam> {
" type: 'InnerProduct' "
" inner_product_param { "
" num_output: 10 "
- " bias_term: " << bias_term <<
+ " bias_term: " << bias_str <<
" weight_filler { "
" type: 'gaussian' "
" std: 10 "
@@ -340,7 +341,7 @@ class NetTest : public MultiDeviceTest<TypeParam> {
" type: 'InnerProduct' "
" inner_product_param { "
" num_output: 10 "
- " bias_term: " << bias_term <<
+ " bias_term: " << bias_str <<
" weight_filler { "
" type: 'gaussian' "
" std: 10 "
@@ -699,9 +700,11 @@ class NetTest : public MultiDeviceTest<TypeParam> {
" bottom: 'innerproduct' "
" bottom: 'label_argmax' ";
if (test_skip_true)
- proto += " propagate_down: [true, false] ";
+ proto += " propagate_down: true "
+ " propagate_down: false ";
else
- proto += " propagate_down: [true, true] ";
+ proto += " propagate_down: true "
+ " propagate_down: true ";
proto +=
" top: 'cross_entropy_loss' "
" type: 'SigmoidCrossEntropyLoss' "