Skip to content

Commit 995bd6a

Browse files
committed
merge changes from master for 1.7.2
Signed-off-by: Guenther Schmuelling <[email protected]>
2 parents 5ea2dc0 + 66c3cd7 commit 995bd6a

27 files changed

+3910
-160
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,10 @@ python -m tf2onnx.convert
145145
[--target TARGET]
146146
[--custom-ops list-of-custom-ops]
147147
[--fold_const]
148+
[--large_model]
148149
[--continue_on_error]
149150
[--verbose]
151+
[--output_frozen_graph]
150152
```
151153

152154
### Parameters
@@ -199,13 +201,17 @@ Only valid with parameter `--saved_model`. If a model contains a list of concret
199201

200202
Only valid with parameter `--saved_model`. When set, creates a zip file containing the ONNX protobuf model and large tensor values stored externally. This allows for converting models that exceed the 2 GB protobuf limit.
201203

204+
#### --output_frozen_graph
205+
206+
Saves the frozen tensorflow graph to file.
207+
202208
#### --target
203209

204210
Some models require special handling to run on some runtimes. In particular, the model may use unsupported data types. Workarounds are activated with ```--target TARGET```. Currently supported values are listed on this [wiki](https://github.com/onnx/tensorflow-onnx/wiki/target). If your model will be run on Windows ML, you should specify the appropriate target value.
205211

206212
#### --fold_const
207213

208-
When set, TensorFlow fold_constants transformation is applied before conversion. This benefits features including Transpose optimization (e.g. Transpose operations introduced during tf-graph-to-onnx-graph conversion will be removed), and RNN unit conversion (for example LSTM). Older TensorFlow version might run into issues with this option depending on the model.
214+
Deprecated. Constant folding is always enabled.
209215

210216
### <a name="summarize_graph"></a>Tool to get Graph Inputs & Outputs
211217

VERSION_NUMBER

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.7.1
1+
1.7.2

ci_build/azure_pipelines/pretrained_model_test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
- template: 'templates/job_generator.yml'
55
parameters:
66
python_versions: ['3.7']
7-
tf_versions: ['1.15.2','2.1.0']
7+
tf_versions: ['1.15.2','2.3.0']
88
job:
99
steps:
1010
- template: 'pretrained_model_test.yml'
@@ -24,3 +24,4 @@ jobs:
2424
job:
2525
steps:
2626
- template: 'pretrained_model_test.yml'
27+

ci_build/azure_pipelines/pylint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ jobs:
1212
pip freeze
1313
pylint --rcfile=tools/pylintrc --ignore=version.py --disable=cyclic-import tf2onnx tests/*.py tools -j 0
1414
displayName: 'Pylint'
15+

ci_build/azure_pipelines/unit_test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ stages:
1616
- template: 'templates/job_generator.yml'
1717
parameters:
1818
python_versions: ['3.7']
19-
tf_versions: ['1.14.0','1.15.2','2.1.0','2.2.0']
19+
tf_versions: ['1.14.0','1.15.2','2.2.0','2.3.0']
2020
onnx_opsets: ['']
2121
job:
2222
steps:
@@ -44,3 +44,4 @@ stages:
4444
report_coverage: 'True'
4545

4646
- template: 'templates/combine_test_coverage.yml'
47+

tests/backend_test_base.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@
3030
from tf2onnx.graph import ExternalTensorStorage
3131

3232

33+
if is_tf2():
34+
tf_set_random_seed = tf.compat.v1.set_random_seed
35+
tf_tables_initializer = tf.compat.v1.tables_initializer
36+
else:
37+
tf_set_random_seed = tf.set_random_seed
38+
tf_tables_initializer = tf.tables_initializer
39+
40+
3341
class Tf2OnnxBackendTestBase(unittest.TestCase):
3442
def setUp(self):
3543
self.config = get_test_config()
@@ -133,14 +141,13 @@ def run_test_case(self, func, feed_dict, input_names_with_port, output_names_wit
133141
# use graph to execute the tensorflow func
134142
#
135143
with tf_session() as sess:
136-
tf.set_random_seed(1)
144+
tf_set_random_seed(1)
137145
input_list = []
138146
for k, v in clean_feed_dict.items():
139147
input_list.append(tf_placeholder(name=k, shape=v.shape, dtype=tf.as_dtype(v.dtype)))
140148
func(*input_list)
141149
variables_lib.global_variables_initializer().run()
142-
if not is_tf2():
143-
tf.tables_initializer().run()
150+
tf_tables_initializer().run()
144151
output_dict = []
145152
for out_name in output_names_with_port:
146153
output_dict.append(sess.graph.get_tensor_by_name(out_name))

0 commit comments

Comments
 (0)