34 static void register_with_registry();
37 [[nodiscard]]
static bool probe(std::span<const std::byte> head, uint64_t file_size);
39 [[nodiscard]]
bool can_read(
const std::string& filepath)
const override;
41 void close()
override;
45 [[nodiscard]] std::string
format_name()
const override {
return "npy"; }
46 [[nodiscard]] std::vector<Kakshya::TensorSpec> describe()
const override;
47 [[nodiscard]] std::optional<Kakshya::TensorData> read(std::string_view name)
override;
NpyReader & operator=(const NpyReader &)=delete
Kakshya::TensorSpec m_spec
NpyReader(const NpyReader &)=delete
bool is_open() const override
Check if a file is currently open.
void close() override
Close the currently open file.
std::string format_name() const override
Format identifier such as safetensors or npy.
std::vector< std::string > get_supported_extensions() const override
Get supported file extensions for this reader.
std::vector< std::string > get_supported_extensions() const override
Extensions this format writes, without dots.
bool write(const std::string &filepath, const Kakshya::TensorSet &tensors) override
Write every tensor in the set to a file.
std::string get_last_error() const override
Reason the last write failed, or empty.
Writer for a single .npy array in dense C order.
Typed FileReader boundary for formats that store named tensors.
Single-shot writer of a TensorSet to one file format.
FileReadOptions
Generic options for file reading behavior.
@ ALL
All options enabled.
Named tensors that belong together, such as a model's weights or I/O.
Complete description of a tensor: type, shape, layout, meaning.