Skip to content

Commit

Permalink
get rid of NetParameterPrettyPrint as layer is now after inputs
Browse files Browse the repository at this point in the history
(whoohoo)
  • Loading branch information
jeffdonahue committed Feb 5, 2015
1 parent 78b02e5 commit 62d1d3a
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 50 deletions.
6 changes: 0 additions & 6 deletions include/caffe/util/upgrade_proto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <string>

#include "caffe/proto/caffe.pb.h"
#include "caffe/proto/caffe_pretty_print.pb.h"

namespace caffe {

Expand Down Expand Up @@ -51,11 +50,6 @@ bool UpgradeV1LayerParameter(const V1LayerParameter& v1_layer_param,

const char* UpgradeV1LayerType(const V1LayerParameter_LayerType type);

// Convert a NetParameter to NetParameterPrettyPrint used for dumping to
// proto text files.
void NetParameterToPrettyPrint(const NetParameter& param,
NetParameterPrettyPrint* pretty_param);

// Check for deprecations and upgrade the NetParameter as needed.
bool UpgradeNetAsNeeded(const string& param_file, NetParameter* param);

Expand Down
18 changes: 0 additions & 18 deletions src/caffe/proto/caffe_pretty_print.proto

This file was deleted.

20 changes: 0 additions & 20 deletions src/caffe/util/upgrade_proto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,26 +583,6 @@ void UpgradeNetDataTransformation(NetParameter* net_param) {
}
}

void NetParameterToPrettyPrint(const NetParameter& param,
NetParameterPrettyPrint* pretty_param) {
pretty_param->Clear();
if (param.has_name()) {
pretty_param->set_name(param.name());
}
if (param.has_force_backward()) {
pretty_param->set_force_backward(param.force_backward());
}
for (int i = 0; i < param.input_size(); ++i) {
pretty_param->add_input(param.input(i));
}
for (int i = 0; i < param.input_dim_size(); ++i) {
pretty_param->add_input_dim(param.input_dim(i));
}
for (int i = 0; i < param.layer_size(); ++i) {
pretty_param->add_layer()->CopyFrom(param.layer(i));
}
}

bool UpgradeNetAsNeeded(const string& param_file, NetParameter* param) {
bool success = true;
if (NetNeedsV0ToV1Upgrade(*param)) {
Expand Down
7 changes: 1 addition & 6 deletions tools/upgrade_net_proto_text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,8 @@ int main(int argc, char** argv) {
UpgradeNetDataTransformation(&net_param);
}

// Convert to a NetParameterPrettyPrint to print fields in desired
// order.
NetParameterPrettyPrint net_param_pretty;
NetParameterToPrettyPrint(net_param, &net_param_pretty);

// Save new format prototxt.
WriteProtoToTextFile(net_param_pretty, argv[2]);
WriteProtoToTextFile(net_param, argv[2]);

LOG(ERROR) << "Wrote upgraded NetParameter text proto to " << argv[2];
return !success;
Expand Down

0 comments on commit 62d1d3a

Please sign in to comment.