From 830b43b1d1bd82edd57dee1f5cac12e2b5cf0e04 Mon Sep 17 00:00:00 2001 From: Dominic Symes Date: Tue, 9 May 2023 10:14:49 +0100 Subject: Add DIM operator and operations on shape_t values Shape inference derives the shape of tensors in the graph from input shapes. Operations such as RESHAPE may need calculations to derive the new tensor shape. This patch: - Adds a DIM operator to get the size of a tensor in a given axis as a rank 0 tensor of type shape_t - Allows RESHAPE to take a 1D shape tensor as input for the new shape - Allows RESIZE, TILE, PAD to take input sizes based on shape tensors. - Allows ADD, SUB, MUL, INTDIV to operate on rank 0 shape_t tensors - Allows CONCAT to concatenate 0D shape_t tensors to a 1D shape_t tensor - Adds CONST support for shape_t tensors In this version of the specification shape tensors must be resolvable to constants at backend compile time. Signed-off-by: Dominic Symes Change-Id: I484bd44452453b5e05d0d8a82689564587b224e4 --- tosa.xml | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 8 deletions(-) (limited to 'tosa.xml') diff --git a/tosa.xml b/tosa.xml index 40128f7..d3889a2 100644 --- a/tosa.xml +++ b/tosa.xml @@ -773,6 +773,7 @@ + @@ -907,6 +908,7 @@ + LOGICAL_AND @@ -1118,6 +1120,7 @@ + @@ -1185,6 +1188,7 @@ + @@ -1863,7 +1867,7 @@ List of input tensors. All inputs must have the same rank and data type - + Axis along which concatenation is to occur, in range from 0 to rank(shape)-1 @@ -1882,6 +1886,7 @@ + @@ -1902,7 +1907,7 @@ Input tensor - + Number of pad elements at the start and end of each dimension @@ -1936,6 +1941,43 @@ + + DIM + + + Input tensor + + + + + Axis in range from 0 to rank(shape) - 1 + + + + Output rank 0 tensor giving the size of the shape for the given axis + + + + + + + + + + + + + + + + + + + + + + + RESHAPE @@ -1944,8 +1986,8 @@ - - List of values, with each element giving the size of the result tensor for the given dimension. At most one dimension may be given as -1 to automatically calculate the dimension size. + + 1D shape tensor giving the new shape. @@ -1998,6 +2040,7 @@ + @@ -2060,7 +2103,7 @@ used. Input tensor - + Number of times to replicate input1 in each dimension @@ -2212,17 +2255,17 @@ used. Input tensor - + [scale_y_n, scale_y_d, scale_x_n, scale_x_d] - + [offset_y, offset_x] - + [border_y, border_x] @@ -2464,6 +2507,7 @@ used. + -- cgit v1.2.1