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

Functions obtained from get_params_to_statetensor_func silently fail when given too few parameters #122

Open
tlaakkonen opened this issue Jan 28, 2024 · 0 comments

Comments

@tlaakkonen
Copy link

A function that was obtained from get_params_to_statetensor_func will return NaN when given too few parameters, rather than erroring out or assuming the extra parameters to be zero. Is this the expected behaviour?

Minimum working example:

f = qujax.get_params_to_statetensor_func(['Rx', 'Ry'], [[0], [0]], [[0], [1]])
f(np.array([1.0]))
# returns: Array([nan+nanj, nan+nanj], dtype=complex64)

I would expect either an error, since:

np.array([1.0, 0.0])[2]
# throws: "IndexError: index 2 is out of bounds for axis 0 with size 2"

or for the extra parameters to be assumed to be zero, since:

jax.numpy.array([1.0, 0.0])[2]
# returns: Array(0., dtype=float32)

I think throwing an error would be the ideal behaviour here.

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