Contents

class

SushiAI::IO::CheckpointReader

Deserializes checkpoint headers and records from an input stream.

Declared in
include/SushiAI/io/checkpoint_format.hpp

Public member functions

explicit CheckpointReader(std::istream &in)

Reads and validates the file header.

Parameters

in

Where the bytes come from; must outlive the reader.

Exceptions

Error

If the magic, the version or the count is wrong, or the header is truncated.

std::uint32_t count() const noexcept

How many records the file declares.

std::uint32_t read_count() const noexcept

How many records have been read so far.

TensorRecord next()

Reads the next record's header, leaving its payload unread.

Returns

The record.

Exceptions

Error

If no records remain, a bound is exceeded, a declared extent is not positive, the dtype is not a DType, or the header is truncated.

void read_payload(const TensorRecord &record, void *destination)

Reads the payload of the record next just returned.

Parameters

record

The record next returned.

destination

record.payload_bytes() writable bytes.

Exceptions

Error

If destination is null, or the stream ends early.