Detect fortran_order in npz (#911)

* Fix fortran_order parsing
* Abort on non row-major NPZ entries
* Update CHANGELOG
* Update VERSION

Co-authored-by: Roman Grundkiewicz <rgrundkiewicz@gmail.com>
This commit is contained in:
Graeme Nail 2022-02-15 13:22:49 +00:00 committed by GitHub
parent 58c4576e5d
commit 601c9ac980
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 3 deletions

View File

@ -12,12 +12,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
- Scripts using PyYAML now use `safe_load`; see https://msg.pyyaml.org/load
- Fixed check for `fortran_ordering` in cnpy
### Changed
- Make guided-alignment faster via sparse memory layout, add alignment points for EOS, remove losses other than ce.
- Make guided-alignment faster via sparse memory layout, add alignment points for EOS, remove losses other than ce
- Changed minimal C++ standard to C++-17
- Faster LSH top-k search on CPU
- Updated intgemm to the latest upstream version
- Parameters in npz files are no longer implicitly assumed to be row-ordered. Non row-ordered parameters will result in an abort
## [1.11.0] - 2022-02-08

View File

@ -1 +1 @@
v1.11.4
v1.11.5

View File

@ -82,7 +82,7 @@ void cnpy::parse_npy_header(FILE* fp, char& type, unsigned int& word_size, unsig
//fortran order
loc1 = (int)header.find("fortran_order")+16;
fortran_order = (header.substr(loc1,5) == "True" ? true : false);
fortran_order = (header.substr(loc1,4) == "True" ? true : false);
//shape
loc1 = (int)header.find("(");

View File

@ -90,6 +90,9 @@ void addMetaToItems(const std::string& meta,
void loadItemsFromNpz(const std::string& fileName, std::vector<Item>& items) {
auto numpy = cnpy::npz_load(fileName);
for(auto it : numpy) {
ABORT_IF(
it.second->fortran_order, "Numpy item '{}' is not stored in row-major order", it.first);
Shape shape;
shape.resize(it.second->shape.size());
for(size_t i = 0; i < it.second->shape.size(); ++i)