20[[nodiscard]] std::optional<size_t>
npy_prefix_size(std::span<const std::byte> leading, std::string& why);
32 std::span<const std::byte> prefix, std::string_view name, std::string& why);
38[[nodiscard]] std::optional<std::vector<std::byte>>
encode_npy(
Owning host tensor: a TensorSpec and the bytes it describes.
std::optional< NpyHeader > parse_npy_header(std::span< const std::byte > prefix, std::string_view name, std::string &why)
Decode a .npy prefix into a tensor spec.
std::optional< std::vector< std::byte > > encode_npy(const Kakshya::TensorData &tensor, std::string &why)
Encode a tensor as a complete .npy array in dense C order.
std::optional< size_t > npy_prefix_size(std::span< const std::byte > leading, std::string &why)
Total prefix size (magic, version, length field and header) of a .npy array.
Complete description of a tensor: type, shape, layout, meaning.