class
SushiAI::IO::CheckpointWriter
Serializes checkpoint headers and tensor records to an output stream.
- Declared in
include/SushiAI/io/checkpoint_format.hpp
Public member functions
CheckpointWriter(std::ostream &out, std::uint32_t count)Writes the file header immediately.
Parameters
outWhere the bytes go; must outlive the writer.
countHow many records will follow.
Exceptions
ErrorIf
countexceeds MAX_TENSOR_COUNT, or the write fails.
void write(const TensorRecord &record, const void *payload)Writes one record's header and its payload.
Parameters
recordWhat the tensor is called, and its type and extents.
payloadrecord.payload_bytes()readable bytes.
Exceptions
ErrorIf
recordbreaks a bound, more records are written than were declared, or the write fails.
void finish() constChecks that exactly the declared number of records were written.
Exceptions
ErrorIf fewer were written, naming both counts.
std::uint32_t declared_count() const noexceptHow many records this file declared.
std::uint32_t written_count() const noexceptHow many records have been written so far.

