30 google::protobuf::Message *proto) {
31 int fd = open(filename.c_str(), O_RDONLY);
33 AERROR <<
"cannot open file " << filename;
36 google::protobuf::io::FileInputStream raw_input(fd);
38 bool success = google::protobuf::TextFormat::Parse(&raw_input, proto);
45 google::protobuf::Message *proto) {
46 int fd = open(filename.c_str(), O_RDONLY);
48 AERROR <<
"cannot open file " << filename;
51 google::protobuf::io::FileInputStream raw_input(fd);
52 google::protobuf::io::CodedInputStream coded_input(&raw_input);
53 coded_input.SetTotalBytesLimit(std::numeric_limits<int>::max(), 536870912);
55 bool success = proto->ParseFromCodedStream(&coded_input);
60bool loadNetParams(
const std::string ¶m_file, NetParameter *param) {
63std::string
locateFile(
const std::string &network,
const std::string &input) {
64 return network +
"/" + input;
bool ReadProtoFromTextFile(const std::string &filename, google::protobuf::Message *proto)
std::string locateFile(const std::string &network, const std::string &input)
bool loadNetParams(const std::string ¶m_file, NetParameter *param)
bool ReadProtoFromBinaryFile(const std::string &filename, google::protobuf::Message *proto)