| 492 | } |
| 493 | |
| 494 | std::shared_ptr<Primitive> load(Reader& is) { |
| 495 | auto stream = resolve_stream(deserialize<Stream>(is)); |
| 496 | auto name = deserialize<std::string>(is); |
| 497 | if (auto it = factory.find(name); it != factory.end()) { |
| 498 | return it->second.deserialize(is, stream); |
| 499 | } else { |
| 500 | throw std::invalid_argument( |
| 501 | "[import_function] Unable to deserialize primitive " + name); |
| 502 | } |
| 503 | }; |
| 504 | |
| 505 | std::pair<std::string, std::vector<StateT>> extract_state( |
| 506 | const std::shared_ptr<Primitive>& p) { |