| 67 | } |
| 68 | |
| 69 | bool readTextProto(trtcaffe::NetParameter* net, const char* file) |
| 70 | { |
| 71 | CHECK_NULL_RET_VAL(net, false) |
| 72 | CHECK_NULL_RET_VAL(file, false) |
| 73 | using namespace google::protobuf::io; |
| 74 | |
| 75 | std::ifstream stream(file, std::ios::in); |
| 76 | if (!stream) |
| 77 | { |
| 78 | RETURN_AND_LOG_ERROR(false, "Could not open file " + std::string(file)); |
| 79 | } |
| 80 | |
| 81 | IstreamInputStream input(&stream); |
| 82 | bool ok = google::protobuf::TextFormat::Parse(&input, net); |
| 83 | stream.close(); |
| 84 | return ok; |
| 85 | } |
| 86 | } //namespace nvcaffeparser1 |
| 87 | #endif //TRT_CAFFE_PARSER_READ_PROTO_H |