Skip to content

Commit 6f90a17

Browse files
paulinusmeta-codesync[bot]
authored andcommitted
fix: default to numpy.core if available (#1113)
Summary: Not sure how to best handle access to `numpy.core` (in numpy 1) and `numpy._core` (in numpy 2). It seems the best would be not to access it at all. In any case, there are situations in numpy 1 where `numpy._core` exists but does not contain any `multiarray` definition. So we default to use `numpy.core` if it exists and only use `numpy._core` otherwise. Tested locally using `uv`. Failed before this fix. Pull Request resolved: #1113 Differential Revision: D86282715 Pulled By: paulinus fbshipit-source-id: eca406c318237fb18db19dd27611ddfd903eb1ef
1 parent 971085a commit 6f90a17

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

opensfm/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ def load_matches(self, image: str) -> Dict[str, NDArray]:
349349
class MatchingUnpickler(pickle.Unpickler):
350350
# Handle both numpy <2.0 (np.core) and numpy >=2.0 (np._core)
351351
_multiarray = (
352-
np._core.multiarray if hasattr(np, "_core") else np.core.multiarray
352+
np.core.multiarray if hasattr(np, "core") else np._core.multiarray
353353
)
354354
modules_map = {
355355
"numpy.core.multiarray._reconstruct": _multiarray,

0 commit comments

Comments
 (0)