mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 22:00:13 +01:00
teflon: Support tests with inputs with less than 4 dims
Needed in models such as YOLOX. Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32485>
This commit is contained in:
parent
140150083e
commit
1e117478d4
1 changed files with 6 additions and 4 deletions
|
|
@ -295,10 +295,12 @@ run_model(TfLiteModel *model, enum executor executor, std::vector<std::vector<ui
|
|||
TfLiteTensor *input_tensor = TfLiteInterpreterGetInputTensor(interpreter, i);
|
||||
|
||||
if (generate_random_input) {
|
||||
int shape[4] = {input_tensor->dims->data[0],
|
||||
input_tensor->dims->data[1],
|
||||
input_tensor->dims->data[2],
|
||||
input_tensor->dims->data[3]};
|
||||
std::vector<size_t> 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<uint8_t> a = xt::random::randint<uint8_t>(shape, 0, 255);
|
||||
input.push_back({a.begin(), a.end()});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue