From: Jeff Donahue Date: Mon, 17 Mar 2014 08:40:03 +0000 (-0700) Subject: set correct bottom blob name in upgraded conv layer X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=19cc990848631044e25dd88ccf2d6b1dfbbfcbcb;p=platform%2Fupstream%2Fcaffe.git set correct bottom blob name in upgraded conv layer --- diff --git a/src/caffe/util/upgrade_proto.cpp b/src/caffe/util/upgrade_proto.cpp index b6faca5..3c53ee8 100644 --- a/src/caffe/util/upgrade_proto.cpp +++ b/src/caffe/util/upgrade_proto.cpp @@ -66,13 +66,25 @@ void UpgradeV0PaddingLayers(const V0NetParameter& param, LOG(FATAL) << "Unknown blob input " << blob_name << " to layer " << j; } const int top_idx = blob_name_to_last_top_idx[blob_name]; - V0LayerParameter source_layer = param.layers(top_idx).layer(); - if (source_layer.type() == "padding") { + V0LayerConnection source_layer = param.layers(top_idx); + if (source_layer.layer().type() == "padding") { + // This layer has a padding layer as input -- check that it is a conv + // layer and takes only one input. Also check that the padding layer + // input has only one input and one output. Other cases have undefined + // behavior in Caffe. CHECK_EQ(layer_param.type(), "conv") << "Padding layer input to " "non-convolutional layer type " << layer_param.type(); + CHECK_EQ(layer_connection.bottom_size(), 1) + << "Conv Layer takes a single blob as input."; + CHECK_EQ(source_layer.bottom_size(), 1) + << "Padding Layer takes a single blob as input."; + CHECK_EQ(source_layer.top_size(), 1) + << "Padding Layer produces a single blob as output."; int layer_index = param_upgraded_pad->layers_size() - 1; param_upgraded_pad->mutable_layers(layer_index)->mutable_layer() - ->set_pad(source_layer.pad()); + ->set_pad(source_layer.layer().pad()); + param_upgraded_pad->mutable_layers(layer_index) + ->set_bottom(j, source_layer.bottom(0)); } } for (int j = 0; j < layer_connection.top_size(); ++j) {