diff options
author | Dominic Symes <dominic.symes@arm.com> | 2023-05-09 10:14:49 +0100 |
---|---|---|
committer | Dominic Symes <dominic.symes@arm.com> | 2023-08-16 11:50:24 +0100 |
commit | 830b43b1d1bd82edd57dee1f5cac12e2b5cf0e04 (patch) | |
tree | 971d15dc6ae00118d7be2df9a50dd7445d8428d9 /chapters/pseudocode.adoc | |
parent | e1f517c541a61d18defc671028b24824c1eadd57 (diff) | |
download | specification-830b43b1d1bd82edd57dee1f5cac12e2b5cf0e04.tar.gz |
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 <dominic.symes@arm.com>
Change-Id: I484bd44452453b5e05d0d8a82689564587b224e4
Diffstat (limited to 'chapters/pseudocode.adoc')
-rw-r--r-- | chapters/pseudocode.adoc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/chapters/pseudocode.adoc b/chapters/pseudocode.adoc index 146b5d7..c026089 100644 --- a/chapters/pseudocode.adoc +++ b/chapters/pseudocode.adoc @@ -94,6 +94,12 @@ size_t tensor_size(dim_t shape) { } return size; } + +// Return the size of the tensor in the given axis +// For a rank=0 tensor, returns 1 for all axes +size_t shape_dim(dim_t shape, int axis) { + return (axis >= rank(shape)) ? 1 : shape[axis]; +} ---- ==== Tensor Read |