Contents

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

out

Where the bytes go; must outlive the writer.

count

How many records will follow.

Exceptions

Error

If count exceeds MAX_TENSOR_COUNT, or the write fails.

void write(const TensorRecord &record, const void *payload)

Writes one record's header and its payload.

Parameters

record

What the tensor is called, and its type and extents.

payload

record.payload_bytes() readable bytes.

Exceptions

Error

If record breaks a bound, more records are written than were declared, or the write fails.

void finish() const

Checks that exactly the declared number of records were written.

Exceptions

Error

If fewer were written, naming both counts.

std::uint32_t declared_count() const noexcept

How many records this file declared.

std::uint32_t written_count() const noexcept

How many records have been written so far.