Skip to content

Commit 9e48a44

Browse files
authored
tf-2.6.0rc2 (#1662)
* tf-2.6.0rc2 Signed-off-by: Guenther Schmuelling <[email protected]> * fix large model support for tf-2.6 Signed-off-by: Guenther Schmuelling <[email protected]> * pylint Signed-off-by: Guenther Schmuelling <[email protected]>
1 parent 1d3478f commit 9e48a44

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

ci_build/azure_pipelines/templates/setup.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ steps:
4141
then
4242
pip install tensorflow-text>=2.5
4343
fi
44+
if [[ $CI_TF_VERSION == 2.6* ]] ;
45+
then
46+
# FIXME: make it >= 2.6 after offical tensorflow-text was released
47+
pip install tensorflow-text==2.6.0rc0
48+
fi
4449
fi
4550
4651
python setup.py install

ci_build/azure_pipelines/unit_test.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
stages:
44
- stage:
55
jobs:
6+
- template: 'templates/job_generator.yml'
7+
parameters:
8+
# tf 2.5
9+
python_versions: ['3.8']
10+
tf_versions: ['2.6.0rc2']
11+
onnx_opsets: ['14']
12+
job:
13+
steps:
14+
- template: 'unit_test.yml'
15+
report_coverage: 'True'
16+
617
- template: 'templates/job_generator.yml'
718
parameters:
819
# TFJS tf 2.5

tf2onnx/tf_loader.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,18 @@ def make_tensor_proto_wrapped(values, dtype=None, shape=None, verify_shape=False
161161
tensor_util.make_tensor_proto = make_tensor_proto_wrapped
162162

163163
try:
164-
converter_data = _FunctionConverterData(func=func, lower_control_flow=False, aggressive_inlining=True)
164+
function_converter = _FunctionConverterData
165+
if LooseVersion(tf.__version__) >= "2.6.0":
166+
from tensorflow.python.eager import context
167+
from tensorflow.python.framework.convert_to_constants import _FunctionConverterDataInEager, \
168+
_FunctionConverterDataInGraph
169+
if context.executing_eagerly():
170+
function_converter = _FunctionConverterDataInEager
171+
else:
172+
function_converter = _FunctionConverterDataInGraph
173+
else:
174+
function_converter = _FunctionConverterData
175+
converter_data = function_converter(func=func, lower_control_flow=False, aggressive_inlining=True)
165176
frozen_graph_def, _ = _replace_variables_by_constants(converter_data=converter_data)
166177
finally:
167178
tensor_util.make_tensor_proto = make_tensor_proto_original

0 commit comments

Comments
 (0)