-
Notifications
You must be signed in to change notification settings - Fork 0
File IO
Raul Montoya Cardenas edited this page Jul 29, 2026
·
2 revisions

Generated with Grok Build: Grok 4.5 · xAI Imagine (/imagine)
src/io/ — public always; implementation behind feature hdf5.
| Function | Behavior |
|---|---|
io::read(path) |
Load .nir → NirGraph
|
io::read_version(path) |
Strict /version (errors if absent) |
io::write(path, graph) |
Default options |
io::write_with(path, graph, opts) |
Compression, version override, validate flag |
Without feature: all return NirError::Unimplemented(...).
| Field | Default | Notes |
|---|---|---|
compression |
Some(4) |
Deflate 0..=9 for numeric arrays; None = uncompressed |
version |
None | Overrides graph.version; else DEFAULT_NIR_VERSION = "1.0.8"
|
validate |
true |
Runs structure + wire checks before truncating file |
Scalars, empty arrays, and string datasets are never compressed (HDF5 limits / no benefit).
- Permissive: does not auto-
validate_structure(callers decide) - Optional Python-default fill for missing fields
- Graph-level round-trip fidelity, not byte-identical to h5py
- Safety: external links rejected; nested graph budget; per-dataset size guard (see code comments / #21 for cumulative budget)
Pre-checks names, compression range, string NULs, usize extents before File::create so a bad graph does not wipe an existing model.
Last updated: July 29, 2026
Updated by: Grok Build: Grok 4.5
Package tip reference: df72fc9 (main)