| 46 | ModelServer::~ModelServer() {} |
| 47 | |
| 48 | bool ModelServer::Load(const std::string& file) { |
| 49 | AutoInputFileStream is; |
| 50 | if (!is.Open(file)) { |
| 51 | DXERROR("Failed to open: %s.", file.c_str()); |
| 52 | return false; |
| 53 | } |
| 54 | |
| 55 | DXINFO("Loading graph from: %s...", file.c_str()); |
| 56 | graph_.reset(new Graph); |
| 57 | if (!graph_->Read(is)) { |
| 58 | return false; |
| 59 | } |
| 60 | DXCHECK(graph_->target_size() > target_type_); |
| 61 | target_name_ = graph_->target(target_type_).name(); |
| 62 | DXINFO("Done."); |
| 63 | |
| 64 | DXINFO("Loading model from: %s...", file.c_str()); |
| 65 | model_.reset(new Model); |
| 66 | model_->Init(graph_.get()); |
| 67 | if (!model_->Read(is)) { |
| 68 | return false; |
| 69 | } |
| 70 | |
| 71 | DXINFO("Done."); |
| 72 | return true; |
| 73 | } |
| 74 | |
| 75 | bool ModelServer::LoadGraph(const std::string& file) { |
| 76 | graph_.reset(new Graph); |