Skip to content

[tmva][sofie] Drop NumPy C API dependency from SOFIE parsers#22566

Merged
guitargeek merged 1 commit into
root-project:masterfrom
guitargeek:sofie_numpy
Jun 11, 2026
Merged

[tmva][sofie] Drop NumPy C API dependency from SOFIE parsers#22566
guitargeek merged 1 commit into
root-project:masterfrom
guitargeek:sofie_numpy

Conversation

@guitargeek

Copy link
Copy Markdown
Contributor

The PyTorch parser and the parser unit tests included <numpy/arrayobject.h> and linked against Python3::NumPy purely to read tensor shapes and data pointers
(PyArray_NDIM/PyArray_DIM/PyArray_DATA). This coupled SOFIE to a specific NumPy ABI at build/link time, even though NumPy is only ever needed at runtime to produce the arrays on the Python side.

This commit repaces these uses with the generic CPython API.

The PyTorch parser and the parser unit tests included
`<numpy/arrayobject.h>` and linked against `Python3::NumPy` purely to
read tensor shapes and data pointers
(`PyArray_NDIM`/`PyArray_DIM`/`PyArray_DATA`). This coupled SOFIE to a
specific NumPy ABI at build/link time, even though NumPy is only ever
needed at runtime to produce the arrays on the Python side.

This commit repaces these uses with the generic CPython API.
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown

Test Results

    21 files      21 suites   3d 6h 48m 23s ⏱️
 3 863 tests  3 859 ✅   0 💤 4 ❌
72 801 runs  72 692 ✅ 103 💤 6 ❌

For more details on these failures, see this check.

Results for commit 7b82602.

♻️ This comment has been updated with latest results.

Comment thread tmva/sofie/test/TestRModelParserKeras.C

@lmoneta lmoneta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!
Thank you Jonas for removing this unneeded dependency!

@guitargeek guitargeek merged commit f799703 into root-project:master Jun 11, 2026
57 of 94 checks passed
@guitargeek guitargeek deleted the sofie_numpy branch June 11, 2026 13:22
@guitargeek

Copy link
Copy Markdown
Contributor Author

/backport to 6.40

@root-project-bot

Copy link
Copy Markdown

Preparing to backport PR #22566 to branch 6.40 requested by guitargeek

@root-project-bot

Copy link
Copy Markdown

This PR has been backported to branch 6.40: #22581

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants