MLBEDSW-8111: Update to TensorFlow 2.14
- Update to TensorFlow 2.14 and minimum required Python version to 3.9.
- Update version pins on NumPy and FlatBuffers.
- Add constraint to Offset attribute of StridedSlice operator
Change-Id: I8c7122def963202e5f47e92b62be607935ed05cf
Signed-off-by: Rickard Bolin <rickard.bolin@arm.com>
diff --git a/README.md b/README.md
index 52392c9..4b29bad 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@
against that of the corresponding TensorFlow Lite reference kernels. The
following list indicates which version is used for comparison:
-* Vela 3.10.0 to current supports TensorFlow 2.13
+* Vela 3.10.0 to current supports TensorFlow 2.14
* Vela 3.9.0 supports TensorFlow 2.12
* Vela 3.8.0 supports TensorFlow 2.11
* Vela 3.6.0 to 3.7.0 supports TensorFlow 2.10
@@ -68,7 +68,8 @@
minimum version (pyproject.toml:project.requires-python) indicated in the
brackets:
-* Vela 3.9.0 to current supports Python 3.10 (3.8)
+* Vela 3.10.0 to current supports Python 3.10 (3.9)
+* Vela 3.9.0 supports Python 3.10 (3.8)
* Vela 3.8.0 supports Python 3.9 (3.8)
* Vela 3.4.0 to 3.7.0 supports Python 3.7 (3.8)
* Vela 3.3.0 supports Python 3.8 (3.7)
diff --git a/SUPPORTED_OPS.md b/SUPPORTED_OPS.md
index e22da32..b22c539 100644
--- a/SUPPORTED_OPS.md
+++ b/SUPPORTED_OPS.md
@@ -19,7 +19,7 @@
# Supported Ops
This file was automatically generated by Vela using the `--supported-ops-report` parameter.
-Vela version: `3.9.1.dev7+g3a3f35e.d20230912`
+Vela version: `3.9.1.dev14+g7e03323`
This file complies with
[**Gitiles Markdown syntax**](https://gerrit.googlesource.com/gitiles/+/HEAD/Documentation/markdown.md)
@@ -391,6 +391,7 @@
- new_axis_mask and shrink_axis_mask cannot both be set
- Slice 'end' values must be greater than 'begin' values
- All Strides values must be 1
+- Offset attribute must be False
### TFLite SUB Constraints
diff --git a/ethosu/vela/test/test_tflite_supported_operators.py b/ethosu/vela/test/test_tflite_supported_operators.py
index e5cc280..d6b9478 100644
--- a/ethosu/vela/test/test_tflite_supported_operators.py
+++ b/ethosu/vela/test/test_tflite_supported_operators.py
@@ -529,6 +529,7 @@
op = create_strided_slice_op([1, 10, 10, 10], [1, 5, 5, 10], [127, 2, 2, 0], [0, 7, -3, 0])
op.attrs["begin_mask"] = 1
op.attrs["end_mask"] = 9
+ op.attrs["offset"] = False
assert support.is_operator_supported(op)
return op
@@ -540,6 +541,13 @@
assert not support.is_operator_supported(op)
+def test_constraint_stridedslice_offset_false():
+ # Offset attribute must be False
+ op = create_strided_slice()
+ op.attrs["offset"] = True
+ assert not support.is_operator_supported(op)
+
+
def test_constraint_inputs_int32():
# both inputs must be type int32
op = testutil.create_elemwise_op(Op.SHL, "op", [1, 8, 8, 8], [1, 8, 8, 8], [1, 8, 8, 8])
diff --git a/ethosu/vela/tflite/Buffer.py b/ethosu/vela/tflite/Buffer.py
index e9d45a5..4629ded 100644
--- a/ethosu/vela/tflite/Buffer.py
+++ b/ethosu/vela/tflite/Buffer.py
@@ -55,7 +55,21 @@
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
return o == 0
-def BufferStart(builder): builder.StartObject(1)
+ # Buffer
+ def Offset(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
+ return 0
+
+ # Buffer
+ def Size(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
+ return 0
+
+def BufferStart(builder): builder.StartObject(3)
def Start(builder):
return BufferStart(builder)
def BufferAddData(builder, data): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(data), 0)
@@ -64,6 +78,12 @@
def BufferStartDataVector(builder, numElems): return builder.StartVector(1, numElems, 1)
def StartDataVector(builder, numElems):
return BufferStartDataVector(builder, numElems)
+def BufferAddOffset(builder, offset): builder.PrependUint64Slot(1, offset, 0)
+def AddOffset(builder, offset):
+ return BufferAddOffset(builder, offset)
+def BufferAddSize(builder, size): builder.PrependUint64Slot(2, size, 0)
+def AddSize(builder, size):
+ return BufferAddSize(builder, size)
def BufferEnd(builder): return builder.EndObject()
def End(builder):
return BufferEnd(builder)
\ No newline at end of file
diff --git a/ethosu/vela/tflite/Operator.py b/ethosu/vela/tflite/Operator.py
index 2af3f8c..23d787b 100644
--- a/ethosu/vela/tflite/Operator.py
+++ b/ethosu/vela/tflite/Operator.py
@@ -194,7 +194,21 @@
o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20))
return o == 0
-def OperatorStart(builder): builder.StartObject(9)
+ # Operator
+ def LargeCustomOptionsOffset(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
+ return 0
+
+ # Operator
+ def LargeCustomOptionsSize(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24))
+ if o != 0:
+ return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos)
+ return 0
+
+def OperatorStart(builder): builder.StartObject(11)
def Start(builder):
return OperatorStart(builder)
def OperatorAddOpcodeIndex(builder, opcodeIndex): builder.PrependUint32Slot(0, opcodeIndex, 0)
@@ -239,6 +253,12 @@
def OperatorStartIntermediatesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartIntermediatesVector(builder, numElems):
return OperatorStartIntermediatesVector(builder, numElems)
+def OperatorAddLargeCustomOptionsOffset(builder, largeCustomOptionsOffset): builder.PrependUint64Slot(9, largeCustomOptionsOffset, 0)
+def AddLargeCustomOptionsOffset(builder, largeCustomOptionsOffset):
+ return OperatorAddLargeCustomOptionsOffset(builder, largeCustomOptionsOffset)
+def OperatorAddLargeCustomOptionsSize(builder, largeCustomOptionsSize): builder.PrependUint64Slot(10, largeCustomOptionsSize, 0)
+def AddLargeCustomOptionsSize(builder, largeCustomOptionsSize):
+ return OperatorAddLargeCustomOptionsSize(builder, largeCustomOptionsSize)
def OperatorEnd(builder): return builder.EndObject()
def End(builder):
return OperatorEnd(builder)
\ No newline at end of file
diff --git a/ethosu/vela/tflite/StridedSliceOptions.py b/ethosu/vela/tflite/StridedSliceOptions.py
index ccc2701..c0696e7 100644
--- a/ethosu/vela/tflite/StridedSliceOptions.py
+++ b/ethosu/vela/tflite/StridedSliceOptions.py
@@ -63,7 +63,14 @@
return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
return 0
-def StridedSliceOptionsStart(builder): builder.StartObject(5)
+ # StridedSliceOptions
+ def Offset(self):
+ o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
+ if o != 0:
+ return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
+ return False
+
+def StridedSliceOptionsStart(builder): builder.StartObject(6)
def Start(builder):
return StridedSliceOptionsStart(builder)
def StridedSliceOptionsAddBeginMask(builder, beginMask): builder.PrependInt32Slot(0, beginMask, 0)
@@ -81,6 +88,9 @@
def StridedSliceOptionsAddShrinkAxisMask(builder, shrinkAxisMask): builder.PrependInt32Slot(4, shrinkAxisMask, 0)
def AddShrinkAxisMask(builder, shrinkAxisMask):
return StridedSliceOptionsAddShrinkAxisMask(builder, shrinkAxisMask)
+def StridedSliceOptionsAddOffset(builder, offset): builder.PrependBoolSlot(5, offset, 0)
+def AddOffset(builder, offset):
+ return StridedSliceOptionsAddOffset(builder, offset)
def StridedSliceOptionsEnd(builder): return builder.EndObject()
def End(builder):
return StridedSliceOptionsEnd(builder)
\ No newline at end of file
diff --git a/ethosu/vela/tflite_mapping.py b/ethosu/vela/tflite_mapping.py
index a94db70..fd94dd8 100644
--- a/ethosu/vela/tflite_mapping.py
+++ b/ethosu/vela/tflite_mapping.py
@@ -736,7 +736,8 @@
BuiltinOperator.STRIDED_SLICE: (
Op.StridedSlice,
OptionsSerializer(
- "StridedSliceOptions", ("begin_mask", "ellipsis_mask", "end_mask", "new_axis_mask", "shrink_axis_mask")
+ "StridedSliceOptions",
+ ("begin_mask", "ellipsis_mask", "end_mask", "new_axis_mask", "shrink_axis_mask", "offset"),
),
TFLITE_IFM_INDICES,
),
diff --git a/ethosu/vela/tflite_supported_operators.py b/ethosu/vela/tflite_supported_operators.py
index 3dbde84..41862b6 100644
--- a/ethosu/vela/tflite_supported_operators.py
+++ b/ethosu/vela/tflite_supported_operators.py
@@ -306,6 +306,7 @@
self.specific_constraints[Op.StridedSlice].append(
TFLiteSupportedOperators.constraint_stridedslice_stride_values
)
+ self.specific_constraints[Op.StridedSlice].append(TFLiteSupportedOperators.constraint_stridedslice_offset_false)
# Pad specific checks:
self.specific_constraints[Op.Pad].append(TFLiteSupportedOperators.constraint_pad_shape)
@@ -806,6 +807,13 @@
return valid, f"Op has strides values {strides.values}"
@staticmethod
+ def constraint_stridedslice_offset_false(op):
+ "Offset attribute must be False"
+ offset = op.attrs.get("offset", False)
+ valid = offset is False
+ return valid, f"Op has offset={offset}"
+
+ @staticmethod
def constraint_inputs_int32(op):
"Both Input data types must be int32"
ifm_dtype = op.ifm.dtype
diff --git a/pyproject.toml b/pyproject.toml
index fd4fc2d..8faa752 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -17,7 +17,7 @@
[project]
name = "ethos-u-vela"
description = "Neural network model compiler for Arm Ethos-U NPUs"
-requires-python = "~=3.8"
+requires-python = "~=3.9"
authors = [{name = "Arm Ltd", email = "mlg-vela@arm.com"}]
license = {text= "Apache License 2.0"}
classifiers = [
@@ -34,9 +34,8 @@
]
keywords = ["ethos-u", "vela compiler", "tflite", "npu"]
dependencies = [
- "flatbuffers==23.1.21",
- "numpy<=1.21.3; python_version<='3.7'",
- "numpy; python_version>'3.7'",
+ "flatbuffers==23.5.26",
+ "numpy",
"lxml>=4.5.2"
]
dynamic = ["readme", "version"]
@@ -58,8 +57,7 @@
[build-system]
requires = [
- "numpy<=1.21.3; python_version<='3.7'",
- "numpy; python_version>'3.7'",
+ "numpy",
"setuptools_scm[toml]~=7.1.0"
]
build-backend = "setuptools.build_meta"