-
-
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.
Add at_mut template to enable masked_fill on slices (#613)
* Add at_mut template to enable masked_fill on slices This can be useful, for example, when assigning a value into a chain of slice operations which are usually considered immutable even if the original tensor is mutable. For example, the following code: ```nim var x = arange(20).reshape([4, 3]) x[1..2, _][condition] = 100 ``` will fail with a `a slice of an immutable tensor cannot be assigned to` error. Using `at_mut` you can do: ```nim x.at_mut(1..2, _)[condition] = 100 ``` which works fine. * Remove unsafe mut template
- Loading branch information
1 parent
38ffb44
commit 297ce90
Showing
2 changed files
with
41 additions
and
0 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