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

Example einx.add_at does not work #21

Open
erlebach opened this issue Feb 9, 2025 · 1 comment
Open

Example einx.add_at does not work #21

erlebach opened this issue Feb 9, 2025 · 1 comment

Comments

@erlebach
Copy link

erlebach commented Feb 9, 2025

I am trying to get the example:

einx.add_at("b ([h w]) c, ([2] b) i, c i -> c [h w] b", image, coordinates, updates)

to work. Could you please provide array definitions that make the example work without a stack trace? I am using Python 3.10 .
So far, I have been unsuccessful. The example can be found in the tutorial on operators .

@fferflo
Copy link
Owner

fferflo commented Feb 13, 2025

This works on my end:

import jax.numpy as jnp
import einx

b = 4
h = 80
w = 128
c = 3
i = 10

image = jnp.zeros((b, h * w, c))
coordinates = jnp.zeros((2 * b, i), dtype="int32")
updates = jnp.zeros((c, i))

image = einx.add_at("b ([h w]) c, ([2] b) i, c i -> c [h w] b", image, coordinates, updates, h=h)

The example was indeed missing an additional parameter, since h and w were not fully constrained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants