MCPcopy Create free account
hub / github.com/cactus-compute/cactus / write_serialized_graph

Function write_serialized_graph

cactus/graph/graph_io.cpp:198–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196 }
197
198 void write_serialized_graph(std::ostream& out, const GraphFile::SerializedGraph& sg) {
199 write_u32(out, sg.header.magic);
200 write_u32(out, sg.header.version);
201 write_u32(out, sg.header.node_count);
202 write_u32(out, sg.header.flags);
203
204 write_u32_vector(out, sg.graph_inputs);
205 write_u32_vector(out, sg.graph_outputs);
206
207 for (const auto& node : sg.nodes) {
208 write_u32(out, node.index);
209 write_u32(out, static_cast<uint32_t>(node.op_type));
210 write_u32_vector(out, node.inputs);
211 write_size_vector(out, node.output_shape);
212 write_u32(out, static_cast<uint32_t>(node.precision));
213 write_op_params(out, node);
214 }
215
216 if (!out) {
217 throw std::runtime_error("Error writing serialized graph");
218 }
219 }
220
221 // read helpers
222 uint32_t read_u32(std::istream& in) {

Callers 1

save_graphFunction · 0.85

Calls 4

write_u32Function · 0.85
write_u32_vectorFunction · 0.85
write_size_vectorFunction · 0.85
write_op_paramsFunction · 0.85

Tested by

no test coverage detected