From 1e117478d49cf53a10ce6dcde1e4d71dfbf6ee1b Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Wed, 2 Oct 2024 09:00:34 +0200 Subject: [PATCH] teflon: Support tests with inputs with less than 4 dims Needed in models such as YOLOX. Reviewed-by: Philipp Zabel Part-of: --- src/gallium/targets/teflon/test_executor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/gallium/targets/teflon/test_executor.cpp b/src/gallium/targets/teflon/test_executor.cpp index b8e57aabbbd..47ab686d20b 100644 --- a/src/gallium/targets/teflon/test_executor.cpp +++ b/src/gallium/targets/teflon/test_executor.cpp @@ -295,10 +295,12 @@ run_model(TfLiteModel *model, enum executor executor, std::vectordims->data[0], - input_tensor->dims->data[1], - input_tensor->dims->data[2], - input_tensor->dims->data[3]}; + std::vector shape; + + shape.resize(input_tensor->dims->size); + for (int j = 0; j < input_tensor->dims->size; j++) + shape[j] = input_tensor->dims->data[j]; + xt::xarray a = xt::random::randint(shape, 0, 255); input.push_back({a.begin(), a.end()}); }