From 6a46b251062dcd42bc9fa2bc9effad407747f64f Mon Sep 17 00:00:00 2001 From: TatWai Chong Date: Fri, 12 Jan 2024 13:13:22 -0800 Subject: Shape infer dynamic model to static model prior to execution. Dynamic shape model cannot directly run on the refenence model as the concrete size of tensor is unknown therefore the volume of tensor is not able to be allocated. Furthemore, the operators also expect the input model is static-shaped. This change turns dynamic model to static model prior to execution. - Add `ifm_dynamic` field into json description to indicate whether the model has dynamic shape or not. - Add the shape inference pass into the compilation pipeline, firstly legalize the dynamic tf/tfl model to dynamic tosa model with unknown shapes, and then run the shape inference pass with static shapes input argument to resolve unknown dimensions. Change-Id: I5d2ffd452becc562dc30546789705bd01dd7a0b0 Signed-off-by: TatWai Chong --- verif/frameworks/write_test_json.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'verif/frameworks/write_test_json.py') diff --git a/verif/frameworks/write_test_json.py b/verif/frameworks/write_test_json.py index d52a777..4e3aa40 100644 --- a/verif/frameworks/write_test_json.py +++ b/verif/frameworks/write_test_json.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2022, ARM Limited. +# Copyright (c) 2020-2024, ARM Limited. # SPDX-License-Identifier: Apache-2.0 import json @@ -16,6 +16,7 @@ def write_test_json( ifm_name=None, ifm_file=None, ifm_shape=None, + ifm_dynamic=False, framework_exclusions=None, quantized=False, test_name=None, @@ -60,6 +61,9 @@ def write_test_json( ifm_shape = [ifm_shape] test_desc["ifm_shape"] = ifm_shape + if ifm_dynamic: + test_desc["ifm_dynamic"] = True + # Some tests cannot be used with specific frameworks. # This list indicates which tests should be excluded from a given framework. if framework_exclusions: -- cgit v1.2.1