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

Four-vector addition with jax backend #2591

Closed
Tracked by #3
alexander-held opened this issue Jul 26, 2023 · 1 comment
Closed
Tracked by #3

Four-vector addition with jax backend #2591

alexander-held opened this issue Jul 26, 2023 · 1 comment
Labels
bug (unverified) The problem described would be a bug, but needs to be triaged

Comments

@alexander-held
Copy link
Member

Version of Awkward Array

2.3.0

Description and code to reproduce

This came out of a pyhep.dev hacking session. We tried to build a simple analysis example: read four-vector information for jets, "calibrate" the jet energies (as a function of a nuisance parameter) and then take derivatives of the mean of invariant masses wrt. the nuisance parameter. A reproducer is provided at https://gist.github.com/alexander-held/9ca8eae6ab99572d7a332ab8c1b02beb.

Switching to the jax backend (without taking gradients) triggers

TypeError: Unexpected input type for array: <class 'awkward.contents.numpyarray.NumpyArray'>

This error occurred while calling

    numpy.add.__call__(
        <MomentumArray4D [{eta: -3.1967773, ...}, ..., {...}] type='140 * M...'>
        <MomentumArray4D [{eta: 1.2490234, ...}, ..., {...}] type='140 * Mo...'>
    )

at the point of four-vector addition. Changing this line to instead return the invariant mass of the first jet triggers another error:

RuntimeError: Cannot differentiate through count_zero

This error occurred while calling

    ak.mean(
        <Array [3.3886719, 6.2890625, ..., 4.1523438] type='140 * float32'>
        axis = None
        keepdims = False
    )
@alexander-held alexander-held added the bug (unverified) The problem described would be a bug, but needs to be triaged label Jul 26, 2023
@agoose77
Copy link
Collaborator

Fixed by #2592

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug (unverified) The problem described would be a bug, but needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants