From 3b0c760a6856bf76a65f73cf4df46b6a905dfa4c Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Tue, 31 Oct 2023 21:53:21 -0700 Subject: [PATCH] Fix arm_backend.py script (#1120) Summary: data["scratch_shape"][0] is a number. Pull Request resolved: https://github.com/pytorch/executorch/pull/1120 Reviewed By: digantdesai Differential Revision: D50863106 Pulled By: kirklandsign fbshipit-source-id: 933ed4750a2f615244d5d8af01ff12f0814bb6b2 --- backends/arm/arm_backend.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/backends/arm/arm_backend.py b/backends/arm/arm_backend.py index fc2fe45c1a..264c2fbcb0 100644 --- a/backends/arm/arm_backend.py +++ b/backends/arm/arm_backend.py @@ -196,6 +196,8 @@ def vela_compile(tosa_fb): # Add a block for scratch, inputs and outputs; scratch shape is a 1 element # array giving us size in bytes so extract this and add a block of 0's. # Currently we preallocated this on the host to provide SRAM for computation. + if not isinstance(data["scratch_shape"][0], np.int64): + raise RuntimeError("Expected scratch to be int64") block_length = int(data["scratch_shape"][0]) bin_blocks["scratch_data"] = b"\x00" * block_length