aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2023-06-20 18:37:54 +0200
committerRicardo Wurmus <rekado@elephly.net>2023-06-20 23:40:40 +0200
commitffb30ffb6e3c57157855e8edbbb66da740b35ade (patch)
tree585a46735bfcbd6fc55a0570bc984d98809d7480 /gnu/packages
parent9a7fc01b5c0c162bb716d24171143ddbe376ac60 (diff)
downloadguix-ffb30ffb6e3c57157855e8edbbb66da740b35ade.tar.gz
guix-ffb30ffb6e3c57157855e8edbbb66da740b35ade.zip
gnu: tensorflow: Patch for numpy >= 1.23.
* gnu/packages/machine-learning.scm (tensorflow)[arguments]: Remove np.asscalar in 'python3.10-compatibility phase.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/machine-learning.scm15
1 files changed, 14 insertions, 1 deletions
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index ac2ac417e7..74b08aa020 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -2450,7 +2450,20 @@ Python.")
(("void BinaryUFunc\\(char\\*\\* args, npy_intp\\* dimensions, npy_intp\\* steps,")
"void BinaryUFunc(char** args, npy_intp const* dimensions, npy_intp const* steps,")
(("void CompareUFunc\\(char\\*\\* args, npy_intp\\* dimensions, npy_intp\\* steps,")
- "void CompareUFunc(char** args, npy_intp const* dimensions, npy_intp const* steps,"))))
+ "void CompareUFunc(char** args, npy_intp const* dimensions, npy_intp const* steps,"))
+
+ ;; ...and for numpy >= 1.23
+ (substitute* '("tensorflow/python/framework/tensor_util.py")
+ (("np.asscalar\\(x\\[0\\]\\)") "x[0].item()")
+ (("np.asscalar\\(x\\)") "x.item()")
+ (("np.asscalar\\(v\\)") "np.ndarray.item(v)")
+ (("return np.asscalar") "return np.ndarray.item"))
+ (substitute* "tensorflow/python/kernel_tests/cwise_ops_test.py"
+ (("np.asscalar\\(np.random.rand\\(1\\) \\* 100.\\)")
+ "(np.random.rand(1) * 100.).item()"))
+ (substitute* '("tensorflow/python/framework/fast_tensor_util.pyx"
+ "tensorflow/python/estimator/canned/linear_testing_utils.py")
+ (("np.asscalar") "np.ndarray.item"))))
(add-after 'python3.10-compatibility 'chdir
(lambda _ (chdir "tensorflow/contrib/cmake")))
(add-after 'chdir 'disable-downloads