output_param_string, &expected_output_param));
NetParameter actual_output_param;
insert_splits(input_param, &actual_output_param);
+ CHECK_EQ(expected_output_param.DebugString(),
+ actual_output_param.DebugString());
EXPECT_EQ(expected_output_param.DebugString(),
actual_output_param.DebugString());
}
" type: \"split\" "
" } "
" bottom: \"data\" "
- " top: \"data_split_0\" "
+ " top: \"data\" "
" top: \"data_split_1\" "
" top: \"data_split_2\" "
"} "
" name: \"innerprod1\" "
" type: \"inner_product\" "
" } "
- " bottom: \"data_split_0\" "
+ " bottom: \"data\" "
" top: \"innerprod1\" "
"} "
"layers: { "
" type: \"split\" "
" } "
" bottom: \"innerprod2\" "
- " top: \"innerprod2_split_0\" "
+ " top: \"innerprod2\" "
" top: \"innerprod2_split_1\" "
"} "
"layers: { "
" type: \"euclidean_loss\" "
" } "
" bottom: \"innerprod1\" "
- " bottom: \"innerprod2_split_0\" "
+ " bottom: \"innerprod2\" "
"} "
"layers: { "
" layer { "
" type: \"split\" "
" } "
" bottom: \"data\" "
- " top: \"data_split_0\" "
+ " top: \"data\" "
" top: \"data_split_1\" "
"} "
"layers: { "
" name: \"innerprod1\" "
" type: \"inner_product\" "
" } "
- " bottom: \"data_split_0\" "
+ " bottom: \"data\" "
" top: \"innerprod1\" "
"} "
"layers: { "
void get_split_blob_name(const string& blob_name, const int split_index,
string* split_blob_name) {
- const int suffix_max_length = 16;
- char split_suffix[suffix_max_length];
- const int suffix_length = snprintf(split_suffix, suffix_max_length,
- "_split_%d", split_index);
- CHECK_LT(suffix_length, suffix_max_length);
- *split_blob_name = blob_name + split_suffix;
+ if (split_index == 0) {
+ *split_blob_name = blob_name;
+ } else {
+ const int suffix_max_length = 16;
+ char split_suffix[suffix_max_length];
+ const int suffix_length = snprintf(split_suffix, suffix_max_length,
+ "_split_%d", split_index);
+ CHECK_LT(suffix_length, suffix_max_length);
+ *split_blob_name = blob_name + split_suffix;
+ }
}
} // namespace caffe