aboutsummaryrefslogtreecommitdiff
path: root/chapters/tensor_ops.adoc
AgeCommit message (Collapse)Author
2024-03-14Tighten ARGMAX definitionEric Kunze
Define behavior if multiple values are tied for the maximum. Define behavior if NaN values are encountered. Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: Id05a680cd11a331ba84a8e38f9a7c77a71bcbb78
2024-01-15Move operator pseudocode to separate filesKevin Petit
This makes it easier to process the pseudocode automatically. Change-Id: I84394192598e589de07d43a7af60b96788e14f86 Signed-off-by: Kevin Petit <kevin.petit@arm.com>
2023-09-21TRANSPOSE_CONV2D: Remove redundant out_shape argumentDominic Symes
The output shape can be calculated from the input shape and attributes so the out_shape argument is redundant. Change-Id: I7e6b0b7f03dc75ccdf967261fad4185c513ed187 Signed-off-by: Dominic Symes <dominic.symes@arm.com>
2023-08-17Change TOSA specification to signless typesEric Kunze
Integer inputs and outputs to TOSA operators are now defined as signless values. In most instances the operator will used signed arithmetic as indicated in previous versions of the specification resulting in little functional change to the specification. New attributes have been added to the RESCALE operator to indicate whether the input and output values should be treated as signed or unsigned. Explicit use of static_cast, sign_extend, zero_extend and truncate are added to the pseudocode to avoid ambiguity. Change-Id: I71c67d3e5aeaabc418c768f821fce6ee3eebb65b
2023-08-07Allow bias tensors to be broadcastDominic Symes
Bias tensors often have the same value for each channel. To allow for this the number of bias channels, BC, is permitted to be 1 or the output channel size. If BC == 1 then the bias is broadcast. Change-Id: I3262a6c699bd045f44201e2a123f9b792b9f67c9 Signed-off-by: Dominic Symes <dominic.symes@arm.com>
2023-05-18Remove orphaned pseudocode linesEric Kunze
The lines using the flattened pad values were removed, but the flatten call remained. Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: I2b33945fa40ba413a657c4daaaf1820dd5b1c3d4
2023-03-21Update Argmax's rank maximum to MAX_RANKJerry Ge
Signed-off-by: Jerry Ge <jerry.ge@arm.com> Change-Id: Idc68dfee54f1855782e57a8855b4e4120e25e74d
2023-01-17RFFT2D: Adjust output height to be same as the inputLuke Hutton
The expected output shape of RFFT2d should be (N, H, W/2+1) as opposed to (N, H/2+1, W/2+1). Change-Id: I66d830f1ffa86417b57572b3cd904db0290cac42
2022-12-05Add Levels defintionDominic Symes
Add definition of Level 1.0. Signed-off-by: Dominic Symes <dominic.symes@arm.com> Change-Id: I1b34ae22396f273cc5ecdf99198fdbece6e2809c
2022-10-19Define the index type for tensor co-ordinatesDominic Symes
Tensor co-ordinate indices are signed 32-bit values in this version of the specification. Signed-off-by: Dominic Symes <dominic.symes@arm.com> Change-Id: I6b8dde500ef9c4c4c5688c1a43f8d658863e4a49
2022-08-25TRANSPOSED_CONV2D: Invert pad definitionDominic Symes
Increasing output pad values reduces the size of the output region in the old definition. This is counter-intuitive. This patch inverts the sign of the output pad values such that increasing values leads to increasing pad. It also specifies a pad limit range of output pad values that give an output dependent on the whole input. Signed-off-by: Dominic Symes <dominic.symes@arm.com> Change-Id: I47ff4ee67942aec9e728f0b42d87d20117f0b97a
2022-08-19Machine parsable specificationEric Kunze
This converts portions of the asciidoc specification into an xml document and schema. For the html and pdf outputs, the xml is converted to asciidoc files that are included into the existing specification. The xml allows future automated uses of the tosa specification while maintaining rough compatibility with the existing document. No significant functional changes are included in this change. Change-Id: I7f1f95c527638e270c157d58fcdec6a3510daea5 Signed-off-by: Eric Kunze <eric.kunze@arm.com>
2022-06-17Initial work on floating-point type definitionEric Kunze
Define operations in terms of common floating-point data types. Definitions for the data types are in the introduction. Added a section to describe status of the different profiles. Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: Iac57026806acfb7913f40af61176322fb02b7cc1
2022-06-13Fix typo on CONV3D pseudocodeEric Kunze
Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: Ib953cc4b635469034300662b9ae997d0a1bd58a7
2022-06-02Make the use of inverse in FFT2D definition consistentEric Kunze
The captions for the images used 'direction', instead of 'inverse' which is the attribute name. Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: I4d8ab9642288efb984d03b7862068e09334ce8f6
2022-06-01Add FFT operators to MI/MT profilesEric Kunze
Adds FFT2D for complex->complex FFT Adds RFFT2D for real->complex FFT Change-Id: Id50f96b8f66f17c3020767c002f0c1f41a76d62e Signed-off-by: Eric Kunze <eric.kunze@arm.com>
2022-05-04Specify width of integer types for all operator argumentsKevin Petit
Signed-off-by: Kevin Petit <kevin.petit@arm.com> Change-Id: I15ba640629433f87648ece24ffe723a60c8aaf11
2022-05-03Change from assignment to a check for output dims for tensor opsJeremy Johnson
Output dimensions should have been worked out correctly by the end of the compilation to TOSA Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com> Change-Id: I0193958d7d51bf1c6915a0953daa514f86516710
2022-04-14Specify output dimension formulae for tensor opsDominic Symes
For each tensor op clarify how the output dimensions of output height (OH) and output width (OW) relate to the input height (IH) and input width (IW). Signed-off-by: Dominic Symes <dominic.symes@arm.com> Change-Id: Iad36041f54e439c944cacf08afac5567dd2bad3f
2022-01-07Fix range of C iteration in DEPTHWISE_CONV2DEric Kunze
The for_each already runs over 0 <= m < M, we don't need c to also iterate over M. Change-Id: Ia72b4be7e68e2f210e9bfc75e3958089d9930c47 Signed-off-by: Eric Kunze <eric.kunze@arm.com>
2021-11-12Use in_out_t when a type is used for input and outputEric Kunze
Also change acc_t to out_t when the value is being used as an output. This should make the argument tables easier to follow. Change-Id: I2a57f3c4eaf937f29da785ff5c11576663a39494
2021-10-28Readability fixes for pseudocodeEric Kunze
Avoid use of acc for variables when they are not convolution accumulators. Use argument types appropriately. Add missing pseudocode for some MI operators Change-Id: I9113f9228dbcafb85206bcc39310e9599cb12c08
2021-10-28Remove zp subtraction from tensor_read pseudocodeEric Kunze
Operators which use the zero-point functionalty for 8-bit integer processing are updated to do the zero-point subtract in their pseudocode. Note that the PAD operator no longer takes a zero point argument, and instead requires callers to account for the zero point in the pad_const argument. Change-Id: I3bca1cae85aa2093000c420f0433633c347a29de
2021-10-08Force output shape to be correct for pooling operationsMatthew Haddon
The avg_pool2d and max_pool2d operators trigger an error_if statement if the output shape provided does not match the output shape generated by the operation given the input arguments. * Add pseudocode for floor operation * Fixed type in RESCALE op Signed-off-by: Matthew Haddon <matthew.haddon@arm.com> Change-Id: I087faa331c30becc05719cd1261f436019dcdeb5
2021-10-04Move quantization parameters into argument tablesEric Kunze
The TOSA specification doesn't have quantized types. Without those types, it is cleaner to move effects of quantization such as the zero points into the standard list of arguments, rather than existing as a separate table. Change-Id: I18ea2959e9d3e4a3e9a0ead7a8ca319bb4426a47
2021-09-29Allow PAD operator to pad with non-zeroEric Kunze
PAD now takes an additional attribute, with the padding value. Will generally be zero, but other values are allowed. tensor_read now requires the coordinates to be within the given tensor, with unpredictable behavior occurring if an access outside of the tensor occurs. Callers of tensor_read are expected to check the coordinates and take the appropriate action. The primary impact of this is to move the responsibility for padding to each operator. In practice, this is expected to not be a functional change, but a cleanup to make the behavior more clear. Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: I4f21ca9a13d82d422bbd66c400f23aa9a0bd2aa0
2021-09-24Don't allow pooling ops with excessive paddingEric Kunze
Padding larger than the kernel size leads to the odd effect where no values from the input tensor are used. This leads to a divide by 0 in AVG_POOL2D, as it only divides by the number of valid input values used, not padding. Change MAX_POOL2D to have the same limitation for consistency. Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: I9cd0c0619f88f570d30c83053280460ae3d1cbfb
2021-09-16Clarify range limitations for tensorsEric Kunze
Catch zero and negative sized tensors. Clarify configuration of bool_t in the reference model. int4_t limitations on -8 to stay symmetric around 0. Pad values must be >= 0. Stride,dilation values must be >= 1. Change-Id: Idb6ef740f855912a8340475ba319816f90c9b051 Signed-off-by: Eric Kunze <eric.kunze@arm.com>
2021-09-03MAX_POOL2D: Fix padding behaviourDominic Symes
Change-Id: Idcf4b99161ce05e56391fbc9107a19617cb1ad21 Signed-off-by: Dominic Symes <dominic.symes@arm.com>
2021-08-23Fix pooling argument tablesEric Kunze
Make the input tensor shape dimensions correct for the pseudocode. Clarify the count used for average pooling only includes valid elements. Remove stale reference to PLACEHOLDER nodes. Change-Id: Ia0b9f0aa404008c6a36671da12188cb0999712d4 Signed-off-by: Eric Kunze <eric.kunze@arm.com>
2021-07-13Add definition of TOSA complianceDominic Symes
Signed-off-by: Dominic Symes <dominic.symes@arm.com> Change-Id: I2e25d0467843adb078d5ab9fd681af40b2ffa52e
2021-06-24Replace assert with REQUIRE()Eric Kunze
REQUIRE is a direct replacement for the asserts, and uses the unpredictable() function in pseudocode to describe the required conditions for operators Change-Id: I35dc81e083d8e41f16728d992bdb8b06b0271226 Signed-off-by: Eric Kunze <eric.kunze@arm.com>
2021-03-16Note limits on axis parameterEric Kunze
This also adds a restriction on CONCAT to have all inputs be the same rank. Update the ARGMAX pseudocode to handle corner cases properly and use axis/rank consistent with other operators. Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: I941ac172ee79424ac04d562cedebb75da76659a5
2021-03-11Make pseudocode block tags consistentEric Kunze
They are all now [source,c++] and use ---- as the delimiter. Also made the pseudocode indentation consistent (4 spaces) in the introduction sections. Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: I1287a60cfeae8b7e3c63b9fc8885b1ebf3d3386d
2021-03-11Adjust pseudocode types to account for zero pointEric Kunze
When reading tensor values with zero point, the returned value has one more bit than the original to account for zero point. Update cases of apply_clip to properly represent the types involved. Change-Id: I60c17b1b244c34b4f04f042807936ae0f282ce93
2021-03-08Consistency cleanupEric Kunze
Attempt to get consistent across the pseudocode. Change the data types to all be intN_t instead of some cases of intN. Use float_t as the general floating point data type. Be consistent on use of the term "floating-point" Move general pseudocode helpers to their own section. Change-Id: Ie77666cd3ee438c71f39c62b9c424fe687b0bb51 Signed-off-by: Eric Kunze <eric.kunze@arm.com>
2021-02-09Add batch dimension to MatMulDominic Symes
Add batch dimension for consistency with other operators. Change-Id: I9b1734a1a60304f46a14a6cda1bd6be6678f1037 Signed-off-by: Dominic Symes <dominic.symes@arm.com>
2021-01-25Remove aint8 typeEric Kunze
The aint8 type represented an asymmetrically quantized range. With the change to move scaling fully into the RESCALE operator, the aint8 and int8 types didn't have significant differences in their use with operators. Unifying to a single data type makes things simpler. Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: I3ee89cbdafdc61293ef1f1bec52398d744e716a1
2020-11-29Fix minor spec issuesEric Kunze
Profile for EXP operator TANH table formatting Remove dilation from TRANSPOSE_CONV2D Change-Id: I2a265fecfb25ad997fdc992ad8542000014ac7c0
2020-11-05Fix output argument type for convolutionsEric Kunze
Was out_t, which wasn't in the data types table. Switch to acc_t, the size of the accumulator, which is the output type for the convolutions. Also added some types into the pseudocode to clarify what types variables are. Signed-off-by: Eric Kunze <eric.kunze@arm.com> Change-Id: I210220199c2d39b16938094022339286df040545
2020-11-03Change weights to input for training profileEric Kunze
Weights remain as an attribute for inference profile devices. Change-Id: I1cdbbd2ccd95fc1b7afc0f05a1425fb53560b432 Signed-off-by: Eric Kunze <eric.kunze@arm.com>
2020-10-22Make rank() consistent across filesDominic Symes
Complete the function naming change from dimensions() to rank(). Fix MATMUL to use apply_add() for additions, consistent with the other operations. Signed-off-by: Dominic Symes <dominic.symes@arm.com> Change-Id: I6ba84cf8b016505e8477b04dd00f2a2bf3194492
2020-10-01TOSA spec 0.20.0, initial public versionv0.20.0Eric Kunze
Change-Id: I7c528ebf7e78759ada4bb951b2471c367d3f4525