blob: bec93c171f991f7afb4e921a6ab17b82b3a1d6fc [file] [log] [blame]
//
// This confidential and proprietary software may be used only as
// authorised by a licensing agreement from ARM Limited
// (C) COPYRIGHT 2020-2021 ARM Limited
// ALL RIGHTS RESERVED
// The entire notice above must be reproduced on all authorised
// copies and copies may only be made to the extent permitted
// by a licensing agreement from ARM Limited.
== Operators
=== Operator Parameters
An operator processes input operands to produce output operands. An operator can have three types of parameters:
* An input operand. This must be a tensor or a list of tensors and data is read by the operation.
* An output operand. This must be a tensor or a list of tensors and data is written by the operation.
* An attribute. This is a parameter that is constant for a particular instance of the operator. It may have any data type supported by TOSA. It is expected to be set at compile time.
=== Operator Graphs
A TOSA graph is a collection of TOSA operators where:
* The output of an operator in the graph may be connected to one or more inputs of other operators in the graph
* When an output is connected to an input the tensor list shapes must match
* The attributes of the operators are defined and considered part of the graph
* The attributes must be in the valid range permitted for the operator
* The tensor dimensions must be in the valid range permitted for the operator
Some operators, such as control flow operators, take a graph of other operators as an attribute. The type tosa_graph_t will denote a graph of operators and the following functions define the tensor shape list for the graph input and outputs:
[source,c++]
----
shape_list_t tosa_input_shape(tosa_graph_t graph);
shape_list_t tosa_output_shape(tosa_graph_t graph);
----
Similarly the type tensor_list_t will be used for a list of tensors and the following function returns the shape of a tensor list:
[source,c++]
----
shape_list_t tensor_list_shape(tosa_list_t tensor_list);
----
The following function denotes the execution of a TOSA graph, on an input tensor list to produce an output tensor list.
[source,c++]
----
tosa_execute_graph(tosa_graph_t graph, tosa_list_t input_list, tosa_list_t output_list) {
ERROR_IF(tensor_list_shape(input_list) != tosa_input_shape(graph));
ERROR_IF(tensor_list_shape(output_list) != tosa_output_shape(graph));
for_each(operator in graph order) {
ERROR_IF(operator input tensors do not meet requirement of operator Arguments inputs)
ERROR_IF(operator attributes do not meet requirement of operator Arguments attributes)
ERROR_IF(operator output tensors do not meet requirement of operator Arguments outputs)
ERROR_IF(operator data types do not meet requirement of operator Supported Data Types)
<Execute operator as defined by the Operation Function pseduo-code>
}
}
----
include::tensor_ops.adoc[]
include::activation_funcs.adoc[]
include::ewise_binary.adoc[]
include::ewise_unary.adoc[]
include::ewise_ternary.adoc[]
include::comparison.adoc[]
include::reduction.adoc[]
include::data_layout.adoc[]
include::scatter_gather.adoc[]
include::image.adoc[]
include::type_conversion.adoc[]
include::data_nodes.adoc[]
include::custom.adoc[]
include::control_flow.adoc[]