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

empty multidimensional numpy arrays causing error #197

Open
JW-swansea opened this issue Dec 6, 2024 · 0 comments
Open

empty multidimensional numpy arrays causing error #197

JW-swansea opened this issue Dec 6, 2024 · 0 comments

Comments

@JW-swansea
Copy link

JW-swansea commented Dec 6, 2024

This section of code seems to have excluded something, numpy arrays can have a shape (n,0) in addition to (n,) (n,1) (0) etc.

if x.ndim == 1:
(i,) = x.shape
di = 2**math.ceil(math.log2(i)) - i
return jnp.pad(x, ((0, di),), mode="constant", constant_values=0.0)
elif x.ndim == 2:
i, j = x.shape
di = 2**math.ceil(math.log2(i)) - i

This means that it's possible to have an array shape that registers as two dimensional, and still trips up log i with a log of zero problem.

Now arrays of the form (n,0) should have no entries, so there's obviously another problem I have to trace, but this is something I can report at least; I believe you need an extra case to account for empty but multi-dimensional arrays.

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

1 participant