-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make newTensorUninit[T]() create a rank-1 empty tensor Similar to same change done to `newTensor` on the previous commit. * Make newTensor[T]() create a rank-1 empty tensor Up until now calling newTensor without arguments would create a rank-0 tensor which does not work well (e.g. it reports its size as size 0)! Instead we now create a rank-1 empty tensor when no shape is provided. It is still possible to explicitly create a rank-0 tensor by explicitly passing an empty shape (i.e. `[]`) to newTensor (e.g. `newTensor[float]([])`). This can be useful to create "sentinel" values for procedures that take tensors as arguments. * Fix issue #639 (`size` returns 1 for rank-0 tensors) This fixes #639. While this adds an extra check to `size` which might be called frequently, I have not seen a major difference on several of the benchmarks.
- Loading branch information
1 parent
7ad9903
commit 9cf5b41
Showing
3 changed files
with
22 additions
and
11 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
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