-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix an issue with empty preallocation (#113)
* Fix issue with NumPy chain and preallocation=0 Original logic in `grow_append` was to extend data by 10% of its length. This is a problem with the original data length is 0, since it then never extends. This commit amends `grow_append` to always extend by at least 10 elements. * [NumPyBackend] Prevent ``preallocate=0`` from creating object arrays. `grow_append` cannot know if ``preallocate = 0`` was used: it only looks at the `rigid` value to determine how to append. Because of this, will always fail when we use `preallocate = 0` with tensor variables, since then the shapes of `target` and `extension` don’t match. A simple fix is to simply deactivate the special behavior for `preallocate = 0`. - This commit extends `test_growing` with a `preallocate` parameter, so that we test both cases where it is 0 and positive. - We also fix `test_growing` to match the new behavior of `grow_append` introduced in #ea812b0, where data arrays always grow by at least 10. * Remove trailing whitespace --------- Co-authored-by: Alexandre René <[email protected]> Co-authored-by: Michael Osthege <[email protected]>
- Loading branch information
1 parent
b35be42
commit b9704f3
Showing
2 changed files
with
24 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters