- Now the header will automatically align itself to 8 bytes (f64) with
appending extra spaces as necessary.
- This will allow extra fast memory mapping by reinterpreting bytes as
f32/f64 etc.. Unaligned bytes do not allow for this. https://www.reddit.com/r/rust/comments/tanaxm/mutating_a_buffer_of_u8s_as_f32s_in_place/
- This does not change contiguousness of tensors
- This does not change the actual spec (we're just putting extra valid bytes
in the header and using a different serialization ordering)
- Readers should still be able to read old files, they would just need
to be copied before being cast as their final destination when using
mmap
- This has no effect for GPU since copy is already necessary (*I think*,
depends on the cuda API actually if it allows filling f32 addresses
from raw unaligned bytes).
This change will only be interesting if things like https://github.com/Narsil/fast_gpt2
actually pick up. And even with the copy, load times are still vastly
superior to `pytorch`.