Skip to content

Commit

Permalink
add ALv2 licenses (#1271)
Browse files Browse the repository at this point in the history
Signed-off-by: Sheng Zha <zhasheng@amazon.com>
  • Loading branch information
szha committed Jan 14, 2021
1 parent 25f8b0c commit e28c973
Show file tree
Hide file tree
Showing 257 changed files with 3,169 additions and 2,323 deletions.
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!--- SPDX-License-Identifier: Apache-2.0 -->

# Contributing

We're always looking for your help to fix bugs and improve the product. Create a pull request and we'll be happy to take a look.
Expand Down
377 changes: 355 additions & 22 deletions LICENSE

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!--- SPDX-License-Identifier: Apache-2.0 -->

# tf2onnx - Convert TensorFlow models to ONNX.

| Build Type | OS | Python | Tensorflow | Onnx opset | Status |
Expand Down Expand Up @@ -276,7 +278,7 @@ python tests/run_pretrained_models.py --backend onnxruntime --config tests/run_p
#### <a name="save_pretrained_model"></a>Tool to save pre-trained model

We provide an [utility](tools/save_pretrained_model.py) to save pre-trained model along with its config.
Put `save_pretrained_model(sess, outputs, feed_inputs, save_dir, model_name)` in your last testing epoch and the pre-trained model and config will be saved under `save_dir/to_onnx`.
Put `save_pretrained_model(sess, outputs, feed_inputs, save_dir, model_name)` in your last testing epoch and the pre-trained model and config will be saved under `save_dir/to_onnx`.
Please refer to the example in [tools/save_pretrained_model.py](tools/save_pretrained_model.py) for more information.
Note the minimum required Tensorflow version is r1.6.

Expand All @@ -287,7 +289,7 @@ In some cases it will be useful to convert the models from TensorFlow to ONNX fr
```
import tf2onnx
tf2onnx.tfonnx.process_tf_graph(tf_graph,
tf2onnx.tfonnx.process_tf_graph(tf_graph,
continue_on_error=False, verbose=False, target=None,
opset=None, custom_op_handlers=None,
custom_rewriter=None, extra_opset=None,
Expand Down
4 changes: 3 additions & 1 deletion Troubleshooting.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<!--- SPDX-License-Identifier: Apache-2.0 -->

tf2onnx - common issues when converting models.
========

## tensorflow op is not supported
Example:

```ValueError: tensorflow op NonMaxSuppression is not supported```
```ValueError: tensorflow op NonMaxSuppression is not supported```

means that the given tensorflow op is not mapped to ONNX. This could have multiple reasons:

Expand Down
2 changes: 2 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
rem SPDX-License-Identifier: Apache-2.0

python -m pytest --cov=tf2onnx
python setup.py bdist_wheel
5 changes: 4 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#!/bin/bash

# SPDX-License-Identifier: Apache-2.0


set -x

apt-get install -y protobuf-compiler libprotoc-dev
pip install setuptools
pip install setuptools
pip install onnx pytest-cov

python setup.py test
Expand Down
2 changes: 2 additions & 0 deletions examples/benchmark_tfmodel_ort.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

"""
The following code compares the speed of tensorflow against onnxruntime
with a model downloaded from Tensorflow Hub.
Expand Down
2 changes: 2 additions & 0 deletions examples/call_converter_via_python.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

"""
A simple example how to call tensorflow-onnx via python.
"""
Expand Down
2 changes: 2 additions & 0 deletions examples/custom_op_via_python.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

"""
A simple example how to map a custom op in python.
"""
Expand Down
2 changes: 2 additions & 0 deletions examples/end2end_tfhub.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

"""
This example retrieves a model from tensorflowhub.
It is converted into ONNX. Predictions are compared to
Expand Down
2 changes: 2 additions & 0 deletions examples/end2end_tfkeras.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

"""
This example builds a simple model without training.
It is converted into ONNX. Predictions are compared to
Expand Down
2 changes: 2 additions & 0 deletions examples/rnn_tips.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!--- SPDX-License-Identifier: Apache-2.0 -->

Tips to convert TensorFlow RNN models.
========

Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

[aliases]
test=pytest

Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
6 changes: 4 additions & 2 deletions support_status.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<!--- SPDX-License-Identifier: Apache-2.0 -->

## `tf2onnx` Support Status
### Domain: "" (default domain)
| Tensorflow Op | Convertible to ONNX Op Versions |
Expand Down Expand Up @@ -228,14 +230,14 @@
| Where | 9 ~ 13 |
| While | 7 ~ 13 |
| ZerosLike | 1 ~ 13 |
### Domain: "com.microsoft"
### Domain: "com.microsoft"
| Tensorflow Op | Convertible to ONNX Op Versions |
| ------------- | ------------------------------- |
| Conv2DBackpropInput | 1 |
| CropAndResize | 1 |
| MatrixInverse | 1 |
| Range | 1 |
### Domain: "ai.onnx.contrib"
### Domain: "ai.onnx.contrib"
| Tensorflow Op | Convertible to ONNX Op Versions |
| ------------- | ------------------------------- |
| Equal | 1 |
Expand Down
2 changes: 2 additions & 0 deletions tests/backend_test_base.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/common.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/run_pretrained_models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0


# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
Expand Down
2 changes: 2 additions & 0 deletions tests/test_cond.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_const_fold.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_convert.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_cudnn.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_cudnn_compatible_gru.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_custom_rnncell.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_example.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_gru.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_grublock.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_internals.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_loops.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_lstm.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_lstmblock.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_onnx_shape_inference.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_optimizers.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_profile.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_seq2seq.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_stacked_lstm.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

"""Unit Tests for layered lstm"""

import numpy as np
Expand Down
2 changes: 2 additions & 0 deletions tests/test_string_ops.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_tf_shape_inference.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tests/test_tflite_utils.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
"""tf2onnx package."""
Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/constants.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/convert.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/custom_opsets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
""" custom tf2onnx mapping functions. """
Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/custom_opsets/ms.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
""" tf2onnx mapping functions for ms domain. """
Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/custom_opsets/onnx_ml.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
""" tf2onnx mapping functions for onnx ml domain. """
Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/custom_opsets/string_ops.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
""" tf2onnx mapping functions for string ops using contrib ops domain. """
Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/graph.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/graph_builder.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/graph_matcher.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/handler.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/onnx_opset/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
"""tf2onnx.onnx_opset module"""
Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/onnx_opset/common.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/onnx_opset/controlflow.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/onnx_opset/generator.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/onnx_opset/logical.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/onnx_opset/math.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/onnx_opset/misc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.

Expand Down
Loading

0 comments on commit e28c973

Please sign in to comment.