Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prototype mutable tensors + question: are they desirable? #59

Open
david-berthelot opened this issue Sep 24, 2020 · 0 comments
Open

Prototype mutable tensors + question: are they desirable? #59

david-berthelot opened this issue Sep 24, 2020 · 0 comments
Assignees
Labels
feature request New feature or request question Further information is requested

Comments

@david-berthelot
Copy link
Contributor

david-berthelot commented Sep 24, 2020

Currently we cannot do write part of a tensor using numpy syntax:

import jax.numpy as jn

v = jn.arange(10)
v[2:4] += 1  
# TypeError: '<class 'jax.interpreters.xla.DeviceArray'>' object does not support item assignment.
# JAX arrays are immutable; perhaps you want jax.ops.index_update or jax.ops.index_add instead?

However in numpy it works

import numpy as np

v = np.arange(10)
v[2:4] += 1  
print(v)
# [0 1 3 4 4 5 6 7 8 9]

I'm interested in prototyping feasibility but I also wonder if it's a desirable feature generally speaking. Feedback welcome.

@david-berthelot david-berthelot self-assigned this Sep 24, 2020
@david-berthelot david-berthelot added feature request New feature or request question Further information is requested labels Sep 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant