| 242 | } |
| 243 | |
| 244 | void onnx_parser::parse_from(std::istream& is, std::string name) |
| 245 | { |
| 246 | auto* mm = prog.get_main_module(); |
| 247 | this->filename = std::move(name); |
| 248 | auto parent_path = fs::path(this->filename).parent_path(); |
| 249 | if(not parent_path.empty()) |
| 250 | this->path = parent_path.string(); |
| 251 | |
| 252 | onnx::ModelProto model; |
| 253 | if(model.ParseFromIstream(&is)) |
| 254 | { |
| 255 | auto version = get_opset_version(model); |
| 256 | opset_version = (version == -1) ? opset_version : version; |
| 257 | |
| 258 | if(model.has_graph()) |
| 259 | { |
| 260 | (void)this->parse_graph(mm, model.graph()); |
| 261 | } |
| 262 | } |
| 263 | else |
| 264 | { |
| 265 | MIGRAPHX_THROW("PARSE_FROM: Failed reading onnx file: " + this->filename); |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | void onnx_parser::parse_from(const void* data, std::size_t size) |
| 270 | { |
no test coverage detected