1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonRelaxDepsHook,
6 pytest-runner,
7 # runtime dependencies
8 numpy,
9 onnx,
10 requests,
11 six,
12 flatbuffers,
13 protobuf,
14 tensorflow,
15 # check dependencies
16 pytestCheckHook,
17 graphviz,
18 parameterized,
19 pytest-cov,
20 pyyaml,
21 timeout-decorator,
22 onnxruntime,
23 keras,
24}:
25
26buildPythonPackage rec {
27 pname = "tf2onnx";
28 version = "1.16.1";
29 format = "setuptools";
30
31 src = fetchFromGitHub {
32 owner = "onnx";
33 repo = "tensorflow-onnx";
34 rev = "refs/tags/v${version}";
35 hash = "sha256-qtRzckw/KHWm3gjFwF+cPuBhGbfktjhYIwImwHn2CFk=";
36 };
37
38 nativeBuildInputs = [
39 pythonRelaxDepsHook
40 pytest-runner
41 ];
42
43 pythonRelaxDeps = [ "flatbuffers" ];
44
45 propagatedBuildInputs = [
46 numpy
47 onnx
48 requests
49 six
50 flatbuffers
51 protobuf
52 tensorflow
53 onnxruntime
54 ];
55
56 pythonImportsCheck = [ "tf2onnx" ];
57
58 nativeCheckInputs = [
59 pytestCheckHook
60 graphviz
61 parameterized
62 pytest-cov
63 pyyaml
64 timeout-decorator
65 keras
66 ];
67
68 # TODO investigate the failures
69 disabledTestPaths = [
70 "tests/test_backend.py"
71 "tests/test_einsum_helper.py"
72 "tests/test_einsum_optimizers.py"
73 ];
74
75 disabledTests = [ "test_profile_conversion_time" ];
76
77 meta = with lib; {
78 description = "Convert TensorFlow, Keras, Tensorflow.js and Tflite models to ONNX";
79 homepage = "https://github.com/onnx/tensorflow-onnx";
80 license = licenses.asl20;
81 maintainers = with maintainers; [ happysalada ];
82 };
83}