teflon: Set unused dimensions to 1
So drivers don't need to superfluously watch out for zeroes when multiplying among dimensions. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34498>
This commit is contained in:
@@ -223,7 +223,13 @@ fill_tensor(struct teflon_delegate *delegate, TfLiteContext *tf_context, struct
|
||||
tensor->resource = create_resource(context, tf_tensor);
|
||||
|
||||
tensor->index = index;
|
||||
memcpy(tensor->dims, tf_tensor.dims->data, tf_tensor.dims->size * sizeof(*tensor->dims));
|
||||
for (int out_dim = 0; out_dim < 4; out_dim++) {
|
||||
int in_dim = tf_tensor.dims->size - 4 + out_dim;
|
||||
if (in_dim >= 0)
|
||||
tensor->dims[out_dim] = tf_tensor.dims->data[in_dim];
|
||||
else
|
||||
tensor->dims[out_dim] = 1;
|
||||
}
|
||||
|
||||
if (tf_tensor.quantization.type == kTfLiteAffineQuantization) {
|
||||
const TfLiteAffineQuantization *quant = (const TfLiteAffineQuantization *)tf_tensor.quantization.params;
|
||||
|
||||
Reference in New Issue
Block a user