diff options
Diffstat (limited to 'chapters/operators.adoc')
-rw-r--r-- | chapters/operators.adoc | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/chapters/operators.adoc b/chapters/operators.adoc index 3a4c831..d6d1f13 100644 --- a/chapters/operators.adoc +++ b/chapters/operators.adoc @@ -9,23 +9,14 @@ == Operators -=== Operator Arguments +=== Operator Parameters -Operators process input arguments to produce output arguments. -Their behavior can be configured using attribute arguments. -Arguments may have one of the following types: +An operator processes input operands to produce output operands. An operator can have three types of parameters: -* `tensor_t<element_type>`, abbreviated `T<element_type>`, represents a tensor whose elements are of type `element_type` where `element_type` can be any of the data types supported in TOSA. -* `tensor_list_t` represents a list of tensors. When lists are homogeneous, i.e. contain tensors of the same type, their type is further qualified as follows: `tensor_list_t<T<element_type>>`. -* `tosa_graph_t` represents a TOSA graph (see <<operator-graphs>>). +* 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. -Arguments belong to one of three categories: Input, Output, or Attribute. The category to which an argument belongs further constrains its type: - -* An Input argument must be a tensor or a list of tensors used to provide the data read by the operation. -* An Output argument must be a tensor or a list of tensors into which the data produced by the operation is written. -* An Attribute argument is constant, i.e. its value is known at compilation time. It may have any data type supported by TOSA. - -[[operator-graphs]] === Operator Graphs A TOSA graph is a collection of TOSA operators where: @@ -36,7 +27,7 @@ A TOSA graph is a collection of TOSA operators where: * 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: +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++] ---- @@ -50,16 +41,11 @@ Similarly the type tensor_list_t will be used for a list of tensors and the foll shape_list_t tensor_list_shape(tosa_list_t tensor_list); ---- -The following function denotes the execution of a TOSA graph within a TOSA context, -on an input tensor list to produce an output tensor list. A TOSA context, represented -by `tosa_context_t` provides the environment in which a TOSA graph is executed. -Any side-effects that result from the execution of a graph within a context are not -observable by graphs executing in a different context. Operators are executed in an -implementation-defined order that must be a topological ordering of the TOSA graph. +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_context_t context, tosa_graph_t graph, tosa_list_t input_list, tosa_list_t output_list, tosa_level_t level) { +tosa_execute_graph(tosa_graph_t graph, tosa_list_t input_list, tosa_list_t output_list, tosa_level_t level) { 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) { @@ -68,7 +54,7 @@ tosa_execute_graph(tosa_context_t context, tosa_graph_t graph, tosa_list_t input 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 the operator as defined by the operation function pseduo-code - tosa_execute_operator(context, operator, level); + tosa_execute_operator(operator, level); } } ---- |