MLBEDSW-6905: Add dilation greater than 2 support
- Added graph optimisation pass to support dilations greater than 2
in either dimension
- Removed supported operators restrictions
- Removed erroneous dilation on TRANSPOSE_CONV
- Updated unit tests and documentation
Signed-off-by: Tim Hall <tim.hall@arm.com>
Change-Id: Ide302374b0d5eff25c20501383a63f6aa7625c52
diff --git a/ethosu/vela/tflite_supported_operators.py b/ethosu/vela/tflite_supported_operators.py
index fd8bbee..abbfb17 100644
--- a/ethosu/vela/tflite_supported_operators.py
+++ b/ethosu/vela/tflite_supported_operators.py
@@ -189,7 +189,6 @@
# Defined ranges for allowed values:
tens_dim_range = (1, 65535)
stride_range = (1, 3)
- dilation_range = (1, 2)
dilated_height_range = (1, 64)
dilated_product_range = (1, 64 * 64)
weights_limit = 127 * 65536
@@ -225,8 +224,10 @@
# Conv-like checks:
for op_type in TFLiteSupportedOperators.convolution_like_ops:
- self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_stride_range)
- self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_dilation_range)
+ if op_type not in TFLiteSupportedOperators.transpose_convolution_ops:
+ # Transpose Conv has a specific stride constraint (see constraint_tconv_stride below)
+ self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_stride_range)
+
self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_dilated_height_range)
self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_dilated_product_range)
self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_weights_type)
@@ -234,9 +235,6 @@
self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_weights_limit)
self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_bias_type)
self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_bias_40bit)
- # Remove stride contraint from Transpose Conv because it has a specific one (see below)
- for op_type in TFLiteSupportedOperators.transpose_convolution_ops:
- self.specific_constraints[op_type].remove(TFLiteSupportedOperators.constraint_stride_range)
# Transpose Conv specific checks:
for op_type in TFLiteSupportedOperators.transpose_convolution_ops:
self.specific_constraints[op_type].append(TFLiteSupportedOperators.constraint_tconv_stride)
@@ -434,15 +432,6 @@
return valid, f"Op has stride WxH as: {w}x{h}"
@classmethod
- @docstring_format_args(dilation_range)
- def constraint_dilation_range(cls, op):
- "Dilation factor values for both width and height must be in the range [{}, {}]"
- w, h = op.get_kernel_dilation()
- dilation_min, dilation_max = cls.dilation_range
- valid = (dilation_min <= w <= dilation_max) and (dilation_min <= h <= dilation_max)
- return valid, f"Op has dilation factor WxH as: {w}x{h}"
-
- @classmethod
@docstring_format_args(dilated_height_range)
def constraint_dilated_height_range(cls, op):
"Dilated kernel height must be in the range [{}, {}]"