diff options
author | erik.andersson@arm.com <erik.andersson@arm.com> | 2021-01-18 14:23:12 +0100 |
---|---|---|
committer | erik.andersson@arm.com <erik.andersson@arm.com> | 2021-01-22 13:50:07 +0100 |
commit | 7b676498c2499428f238f68b0224dc3a8fbcb56e (patch) | |
tree | 20972c6bed99718b8ae1ac0c746b247b10a244d5 /ethosu/vela/supported_operators.py | |
parent | e82be7c1a000277b44da7e85c527229a1d5eab2a (diff) | |
download | ethos-u-vela-7b676498c2499428f238f68b0224dc3a8fbcb56e.tar.gz |
MLBEDSW-3858: Incorrect PAD usage bug
Fixed a bug where PAD having no consumers would result in a crash.
Now the constraint doesn't crash and thus the intended error message is shown, resulting in easier debugging.
Change-Id: I1e4403d47a6152e7adbf7bc065db86d4217d39cc
Signed-off-by: erik.andersson@arm.com <erik.andersson@arm.com>
Diffstat (limited to 'ethosu/vela/supported_operators.py')
-rw-r--r-- | ethosu/vela/supported_operators.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/ethosu/vela/supported_operators.py b/ethosu/vela/supported_operators.py index 9d315189..1bebe9af 100644 --- a/ethosu/vela/supported_operators.py +++ b/ethosu/vela/supported_operators.py @@ -829,17 +829,15 @@ class SupportedOperators: def constraint_pad_ofm(cls, op): "Must be followed by one of the following operator types: {}" consumers = op.ofm.consumers() - consumers_to_pad = 0 - for consumer in consumers: - if consumer.type in cls.supported_pad_consumers: - if consumer.attrs["padding"] == Padding.VALID: - consumers_to_pad += 1 - valid = len(consumers) > 0 and len(consumers) == consumers_to_pad - return ( - valid, - f"Operator is followed by {consumers_to_pad} consumers with " - f"padding set to VALID, out of {len(consumers)} consumers", - ) + unsupported_consumers = [ + cons.type + for cons in consumers + if cons is not None + if cons.type not in cls.supported_pad_consumers or cons.attrs["padding"] != Padding.VALID + ] + [None for cons in consumers if cons is None] + none_string = ", ".join(["NoneType" for cons in consumers if cons is None]) + valid = len(unsupported_consumers) == 0 + return valid, f"PAD operator is followed by: {_optype_formatter(unsupported_consumers)+none_string}" @staticmethod def constraint_stridedslice_inputs_const(op): |