diff options
author | Tim Hall <tim.hall@arm.com> | 2022-04-20 20:19:48 +0100 |
---|---|---|
committer | Tim Hall <tim.hall@arm.com> | 2022-04-20 21:10:54 +0100 |
commit | f9267da3ad6251a7e04f501218380ac9a89953b7 (patch) | |
tree | cc2c78f0c068817c228fb8b74b68ecc42865da0a | |
parent | 814d01f5a86b50a3a6b7e589db59047d0666b770 (diff) | |
download | ethos-u-vela-f9267da3ad6251a7e04f501218380ac9a89953b7.tar.gz |
MLBEDSW-6407: Vela fails with TypeError in npu_performance
- This is due to calling range() on a non-integer value which in turn is due
to a change in the behaviour of round() on numpy.float64 values
- The fix is to always force the output of the round() to be an integer and
thereby stop whole number floating point values propagating into the kernel
dimensions which later feed into the range().
Signed-off-by: Tim Hall <tim.hall@arm.com>
Change-Id: Ic75cb6ba85a90c81c1d762067d89a10caaa13b92
-rw-r--r-- | ethosu/vela/tflite_graph_optimiser.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ethosu/vela/tflite_graph_optimiser.py b/ethosu/vela/tflite_graph_optimiser.py index 88d58a32..b2a34195 100644 --- a/ethosu/vela/tflite_graph_optimiser.py +++ b/ethosu/vela/tflite_graph_optimiser.py @@ -318,7 +318,9 @@ def convert_resizebilinear_to_nearest_neighbor_upscaling_and_pool(op): out_shape = np.array(op.ofm_shapes[0].get_hw_as_list()) # Calculate how many times 2x2 upscaling needs to be performed - upscale_factor = round(out_shape[1] / upscaled_shape[1]) + # Force the result of round to be an integer. This is because the behaviour of rounding numpy.float64 values changed + # between different versions of numpy. This consistency ensures that the kernel dimensions are kept integral + upscale_factor = int(round(out_shape[1] / upscaled_shape[1])) n = int(np.log2(upscale_factor)) # Perform 2x2 upscaling n-1 times |