Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable tensorflow 2.8.0 in CI pipeline. #1863

Merged
merged 7 commits into from
Feb 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci_build/azure_pipelines/onnxruntime_nightly_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ stages:
parameters:
platforms: ['linux']
python_versions: ['3.9']
tf_versions: ['2.5.0']
tf_versions: ['2.8.0']
onnx_opsets: ['']
onnx_backends: {onnxruntime: ['nightly']}
job:
Expand Down
15 changes: 12 additions & 3 deletions ci_build/azure_pipelines/pretrained_model_test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,29 @@ jobs:
steps:
- template: 'pretrained_model_test.yml'

- template: 'templates/job_generator.yml'
parameters:
platforms: ['linux', 'windows']
python_versions: ['3.9']
tf_versions: ['2.6.2']
job:
steps:
- template: 'pretrained_model_test.yml'

- template: 'templates/job_generator.yml'
parameters:
platforms: ['linux', 'windows']
python_versions: ['3.8']
tf_versions: ['2.5.0']
tf_versions: ['2.7.0']
job:
steps:
- template: 'pretrained_model_test.yml'

- template: 'templates/job_generator.yml'
parameters:
platforms: ['linux', 'windows']
python_versions: ['3.9']
tf_versions: ['2.6.2']
python_versions: ['3.8']
tf_versions: ['2.8.0']
job:
steps:
- template: 'pretrained_model_test.yml'
Expand Down
8 changes: 4 additions & 4 deletions ci_build/azure_pipelines/pretrained_model_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@ jobs:

- template: 'templates/job_generator.yml'
parameters:
# 2.6, tf
# 2.7, tf
python_versions: ['3.7']
tf_versions: ['1.15.5','2.6.2']
tf_versions: ['1.15.5','2.7.0']
job:
steps:
- template: 'pretrained_model_test.yml'

- template: 'templates/job_generator.yml'
parameters:
# 2.7, tf
# 2.8, tf
python_versions: ['3.9']
tf_versions: ['2.7.0']
tf_versions: ['2.8.0']
job:
steps:
- template: 'pretrained_model_test.yml'
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ steps:
conda config --set always_yes yes --set changeps1 no
pip install $(ONNX_PATH)
pip install h5py==2.9.0
pip install numpy==1.19
pip install parameterized
$(INSTALL_TENSORFLOW)
$(INSTALL_KERAS)
Expand Down Expand Up @@ -82,7 +81,6 @@ steps:
pip uninstall -y protobuf
pip install protobuf
pip install h5py==2.9.0
pip install numpy==1.19
pip install parameterized
%INSTALL_TENSORFLOW%
%INSTALL_KERAS%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ steps:
conda config --set always_yes yes --set changeps1 no
pip install $(ONNX_PATH)
pip install h5py==2.9.0
pip install numpy==1.19
pip install parameterized
pip install $(TENSORFLOW_PATH)
if [[ ! -z $KERAS ]];
Expand Down
4 changes: 4 additions & 0 deletions ci_build/azure_pipelines/templates/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ steps:
then
pip install "tensorflow-text>=2.7,<2.8"
fi
if [[ $CI_TF_VERSION == 2.8* ]] ;
then
pip install "tensorflow-text>=2.8,<2.9"
fi
fi

python setup.py install
Expand Down
2 changes: 1 addition & 1 deletion ci_build/azure_pipelines/trimmed_keras2onnx_unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
TENSORFLOW_PATH: tensorflow==1.15.0
INSTALL_ORT: pip install onnxruntime==1.9.0

Python37-tf2.3:
Python37-tf2.8:
python.version: '3.7'
ONNX_PATH: onnx==1.10.2
TENSORFLOW_PATH: tensorflow-cpu==2.3.0
Expand Down
11 changes: 11 additions & 0 deletions ci_build/azure_pipelines/unit_test-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,15 @@ stages:
- template: 'unit_test.yml'
report_coverage: 'True'

- template: 'templates/job_generator.yml'
parameters:
platforms: ['linux', 'windows']
python_versions: ['3.8']
tf_versions: ['2.8.0']
onnx_opsets: ['']
job:
steps:
- template: 'unit_test.yml'
report_coverage: 'True'

- template: 'templates/combine_test_coverage.yml'
37 changes: 37 additions & 0 deletions ci_build/azure_pipelines/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,43 @@
stages:
- stage:
jobs:
- template: 'templates/job_generator.yml'
parameters:
# TFJS tf 2.8
python_versions: ['3.9']
tf_versions: ['2.8.0']
onnx_opsets: ['']
skip_tfjs_tests: 'False'
skip_tf_tests: 'True'
job:
steps:
- template: 'unit_test.yml'
report_coverage: 'True'

- template: 'templates/job_generator.yml'
parameters:
# TFLite tf 2.8
python_versions: ['3.8']
tf_versions: ['2.8.0']
onnx_opsets: ['']
skip_tflite_tests: 'False'
skip_tf_tests: 'True'
job:
steps:
- template: 'unit_test.yml'
report_coverage: 'True'

- template: 'templates/job_generator.yml'
parameters:
# tf 2.8
python_versions: ['3.8']
tf_versions: ['2.8.0']
onnx_opsets: ['']
job:
steps:
- template: 'unit_test.yml'
report_coverage: 'True'

- template: 'templates/job_generator.yml'
parameters:
# TFJS tf 2.7
Expand Down
4 changes: 2 additions & 2 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def func(x):
def test_multinomial(self):
x_val = np.array([[10., 10.]], dtype=np.float32)
def func(x):
op = multinomial(tf.math.log(x), 5, output_dtype=tf.int64)
op = multinomial(tf.math.log(x), 5, output_dtype=tf.int32)
return tf.identity(op, name=_TFOUTPUT)

# since returned indexes are random we can only check type and shape
Expand All @@ -318,7 +318,7 @@ def test_multinomial1(self):
shape = [2, 10]
x_val = np.ones(np.prod(shape)).astype("float32").reshape(shape)
def func(x):
op = multinomial(x, 2, output_dtype=tf.int64)
op = multinomial(x, 2, output_dtype=tf.int32)
return tf.identity(op, name=_TFOUTPUT)
# since returned indexes are random we can only check type and shape
self._run_test_case(func, [_OUTPUT], {_INPUT: x_val}, check_value=False,
Expand Down
75 changes: 75 additions & 0 deletions tf2onnx/tflite/BucketizeOptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# SPDX-License-Identifier: Apache-2.0

# automatically generated by the FlatBuffers compiler, do not modify

# namespace: tflite

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class BucketizeOptions(object):
__slots__ = ['_tab']

@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = BucketizeOptions()
x.Init(buf, n + offset)
return x

@classmethod
def GetRootAsBucketizeOptions(cls, buf, offset=0):
"""This method is deprecated. Please switch to GetRootAs."""
return cls.GetRootAs(buf, offset)
@classmethod
def BucketizeOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed)

# BucketizeOptions
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)

# BucketizeOptions
def Boundaries(self, j):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
a = self._tab.Vector(o)
return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
return 0

# BucketizeOptions
def BoundariesAsNumpy(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
return 0

# BucketizeOptions
def BoundariesLength(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return self._tab.VectorLen(o)
return 0

# BucketizeOptions
def BoundariesIsNone(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
return o == 0

def Start(builder): builder.StartObject(1)
def BucketizeOptionsStart(builder):
"""This method is deprecated. Please switch to Start."""
return Start(builder)
def AddBoundaries(builder, boundaries): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(boundaries), 0)
def BucketizeOptionsAddBoundaries(builder, boundaries):
"""This method is deprecated. Please switch to AddBoundaries."""
return AddBoundaries(builder, boundaries)
def StartBoundariesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def BucketizeOptionsStartBoundariesVector(builder, numElems):
"""This method is deprecated. Please switch to Start."""
return StartBoundariesVector(builder, numElems)
def End(builder): return builder.EndObject()
def BucketizeOptionsEnd(builder):
"""This method is deprecated. Please switch to End."""
return End(builder)
6 changes: 6 additions & 0 deletions tf2onnx/tflite/BuiltinOperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,10 @@ class BuiltinOperator(object):
READ_VARIABLE = 143
ASSIGN_VARIABLE = 144
BROADCAST_ARGS = 145
RANDOM_STANDARD_NORMAL = 146
BUCKETIZE = 147
RANDOM_UNIFORM = 148
MULTINOMIAL = 149
GELU = 150
DYNAMIC_UPDATE_SLICE = 151

4 changes: 4 additions & 0 deletions tf2onnx/tflite/BuiltinOptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,8 @@ class BuiltinOptions(object):
VarHandleOptions = 111
ReadVariableOptions = 112
AssignVariableOptions = 113
RandomOptions = 114
BucketizeOptions = 115
GeluOptions = 116
DynamicUpdateSliceOptions = 117

40 changes: 40 additions & 0 deletions tf2onnx/tflite/DynamicUpdateSliceOptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# SPDX-License-Identifier: Apache-2.0

# automatically generated by the FlatBuffers compiler, do not modify

# namespace: tflite

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class DynamicUpdateSliceOptions(object):
__slots__ = ['_tab']

@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = DynamicUpdateSliceOptions()
x.Init(buf, n + offset)
return x

@classmethod
def GetRootAsDynamicUpdateSliceOptions(cls, buf, offset=0):
"""This method is deprecated. Please switch to GetRootAs."""
return cls.GetRootAs(buf, offset)
@classmethod
def DynamicUpdateSliceOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed)

# DynamicUpdateSliceOptions
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)

def Start(builder): builder.StartObject(0)
def DynamicUpdateSliceOptionsStart(builder):
"""This method is deprecated. Please switch to Start."""
return Start(builder)
def End(builder): return builder.EndObject()
def DynamicUpdateSliceOptionsEnd(builder):
"""This method is deprecated. Please switch to End."""
return End(builder)
51 changes: 51 additions & 0 deletions tf2onnx/tflite/GeluOptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# SPDX-License-Identifier: Apache-2.0

# automatically generated by the FlatBuffers compiler, do not modify

# namespace: tflite

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class GeluOptions(object):
__slots__ = ['_tab']

@classmethod
def GetRootAs(cls, buf, offset=0):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = GeluOptions()
x.Init(buf, n + offset)
return x

@classmethod
def GetRootAsGeluOptions(cls, buf, offset=0):
"""This method is deprecated. Please switch to GetRootAs."""
return cls.GetRootAs(buf, offset)
@classmethod
def GeluOptionsBufferHasIdentifier(cls, buf, offset, size_prefixed=False):
return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x54\x46\x4C\x33", size_prefixed=size_prefixed)

# GeluOptions
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)

# GeluOptions
def Approximate(self):
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
if o != 0:
return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
return False

def Start(builder): builder.StartObject(1)
def GeluOptionsStart(builder):
"""This method is deprecated. Please switch to Start."""
return Start(builder)
def AddApproximate(builder, approximate): builder.PrependBoolSlot(0, approximate, 0)
def GeluOptionsAddApproximate(builder, approximate):
"""This method is deprecated. Please switch to AddApproximate."""
return AddApproximate(builder, approximate)
def End(builder): return builder.EndObject()
def GeluOptionsEnd(builder):
"""This method is deprecated. Please switch to End."""
return End(builder)
Loading