mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 05:10:11 +01:00
teflon: Add support for the StridedSlice operation
Acked-by: Christian Gmeiner <cgmeiner@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36699>
This commit is contained in:
parent
83b9eb038f
commit
0001dab219
2 changed files with 24 additions and 0 deletions
|
|
@ -257,6 +257,18 @@ fill_operation(struct teflon_delegate *delegate, TfLiteContext *tf_context, TfLi
|
||||||
memcpy(operation->transpose.perm, perm, 4 * sizeof(*operation->transpose.perm));
|
memcpy(operation->transpose.perm, perm, 4 * sizeof(*operation->transpose.perm));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case kTfLiteBuiltinStridedSlice: {
|
||||||
|
int *begin = tf_context->tensors[node->inputs->data[1]].data.data;
|
||||||
|
int *end = tf_context->tensors[node->inputs->data[2]].data.data;
|
||||||
|
int *strides = tf_context->tensors[node->inputs->data[3]].data.data;
|
||||||
|
|
||||||
|
operation->type = PIPE_ML_OPERATION_TYPE_STRIDED_SLICE;
|
||||||
|
memcpy(operation->slice.begin, begin, sizeof(operation->slice.begin));
|
||||||
|
memcpy(operation->slice.end, end, sizeof(operation->slice.end));
|
||||||
|
memcpy(operation->slice.strides, strides, sizeof(operation->slice.strides));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -405,6 +417,9 @@ dump_graph(struct pipe_tensor *tensors, unsigned tensor_count, struct pipe_ml_op
|
||||||
case PIPE_ML_OPERATION_TYPE_TRANSPOSE:
|
case PIPE_ML_OPERATION_TYPE_TRANSPOSE:
|
||||||
teflon_debug("%-6s ", "TRANSPOSE");
|
teflon_debug("%-6s ", "TRANSPOSE");
|
||||||
break;
|
break;
|
||||||
|
case PIPE_ML_OPERATION_TYPE_STRIDED_SLICE:
|
||||||
|
teflon_debug("%-6s ", "STRIDED_SLICE");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned j = 0; j < operations[i].input_count; j++) {
|
for (unsigned j = 0; j < operations[i].input_count; j++) {
|
||||||
|
|
@ -612,6 +627,8 @@ tflite_builtin_op_name(TfLiteBuiltinOperator op)
|
||||||
return "FC";
|
return "FC";
|
||||||
case kTfLiteBuiltinMean:
|
case kTfLiteBuiltinMean:
|
||||||
return "MEAN";
|
return "MEAN";
|
||||||
|
case kTfLiteBuiltinStridedSlice:
|
||||||
|
return "STRIDED_SLICE";
|
||||||
default:
|
default:
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1054,6 +1054,7 @@ enum pipe_ml_operation_type {
|
||||||
PIPE_ML_OPERATION_TYPE_LOGISTIC,
|
PIPE_ML_OPERATION_TYPE_LOGISTIC,
|
||||||
PIPE_ML_OPERATION_TYPE_SUBTRACT,
|
PIPE_ML_OPERATION_TYPE_SUBTRACT,
|
||||||
PIPE_ML_OPERATION_TYPE_TRANSPOSE,
|
PIPE_ML_OPERATION_TYPE_TRANSPOSE,
|
||||||
|
PIPE_ML_OPERATION_TYPE_STRIDED_SLICE,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum pipe_ml_pooling_type {
|
enum pipe_ml_pooling_type {
|
||||||
|
|
@ -1232,6 +1233,12 @@ struct pipe_ml_operation
|
||||||
struct {
|
struct {
|
||||||
unsigned perm[4];
|
unsigned perm[4];
|
||||||
} transpose;
|
} transpose;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
int begin[4];
|
||||||
|
int end[4];
|
||||||
|
int strides[4];
|
||||||
|
} slice;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue