Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/caffe/util/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ bool ReadProtoFromTextFile(const char* filename, Message* proto) {
}

void WriteProtoToTextFile(const Message& proto, const char* filename) {
int fd = open(filename, O_WRONLY);
int fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0644);
FileOutputStream* output = new FileOutputStream(fd);
CHECK(google::protobuf::TextFormat::Print(proto, output));
delete output;
Expand Down
9 changes: 2 additions & 7 deletions tools/upgrade_net_proto_text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,8 @@ int main(int argc, char** argv) {
NetParameterPrettyPrint net_param_pretty;
NetParameterToPrettyPrint(net_param, &net_param_pretty);

// TODO(jdonahue): figure out why WriteProtoToTextFile doesn't work
// (no file is created).
// WriteProtoToTextFile(net_param_pretty, argv[2]);
ofstream output_proto;
output_proto.open(argv[2]);
output_proto << net_param_pretty.DebugString();
output_proto.close();
// Save new format prototxt.
WriteProtoToTextFile(net_param_pretty, argv[2]);

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