blob: 506330be24f7e2b2bd1b742769af19d6394898d9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
{
lib,
buildPythonPackage,
fetchPypi,
pythonAtLeast,
numpy,
}:
let
pname = "paddle-bfloat";
version = "0.1.7";
in
buildPythonPackage {
inherit pname version;
format = "setuptools";
src = fetchPypi {
pname = "paddle_bfloat";
inherit version;
hash = "sha256-mrjQCtLsXOvqeHHMjuMx65FvMfZ2+wTh1ao9ZJE+9xw=";
};
postPatch = ''
sed '1i#include <memory>' -i bfloat16.cc # gcc12
# replace deprecated function for python3.11
substituteInPlace bfloat16.cc \
--replace "Py_TYPE(&NPyBfloat16_Descr) = &PyArrayDescr_Type" "Py_SET_TYPE(&NPyBfloat16_Descr, &PyArrayDescr_Type)"
'';
disabled = pythonAtLeast "3.12";
propagatedBuildInputs = [ numpy ];
pythonImportsCheck = [ "paddle_bfloat" ];
# upstream has no tests
doCheck = false;
meta = {
description = "Paddle numpy bfloat16 package";
homepage = "https://pypi.org/project/paddle-bfloat";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ happysalada ];
};
}
|