Implement `at` method for `_IndexUpdateRef`
See original GitHub issueCurrently the following does not work
from jax import numpy as jnp
a = jnp.arange(3)
a = a.at[1:].at[:-1].set(0)
though IMHO the desired instruction is clear. The equivalent numpy expression a[1:][:-1] = 0
works according to one’s intuition and sets the second element to 0.
Issue Analytics
- State:
- Created a year ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
git-update-ref Documentation - Git
This command may create a new empty transaction when the current one has been committed or aborted already. prepare. Prepare to commit the...
Read more >Create and update an index - Microsoft Support
Click where you want to add the index. On the References tab, in the Index group, click Insert Index. In the Index dialog...
Read more >Writing an update conditional on both ref and index value - Help
Hi, I'm trying to write a query which will only update a record if both the ref and the user's email address match...
Read more >Update index settings API | Elasticsearch Guide [8.5] | Elastic
Update index analysisedit ... You can only define new analyzers on closed indices. To add an analyzer, you must close the index, define...
Read more >The Complete Guide to useRef() and Refs in React
Updating a reference doesn't trigger a component re-rendering. Now, let's see how to use useRef() in practice. 1.1 Use case: logging button ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The ndindex library can do these sort of calculations with
as_subindex
: https://quansight-labs.github.io/ndindex/api.html#ndindex.ndindex.NDIndex.as_subindexAnd even for numpy, this kind of composability doesn’t always work as you might expect. For example:
The reason is that while
x[idx] = 999
callsx.__setitem__
,x[idx]
without an associated assignment calls__getitem__
, which in this case returns a copy rather than a view, and the second index expression modifies that copy instead of the original array. So if we were to add such composition, we’d have to think carefully about when and where to mimic / diverge from numpy.