vx_nodes.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * Copyright (c) 2012-2017 The Khronos Group Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef _OPENVX_NODES_H_
  17. #define _OPENVX_NODES_H_
  18. /*!
  19. * \file vx_nodes.h
  20. * \brief The "Simple" API interface for OpenVX. These APIs are just
  21. * wrappers around the more verbose functions defined in <tt>\ref vx_api.h</tt>.
  22. */
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /*! \brief [Graph] Performs element wise multiplications on element values in the input tensor data with a scale.
  27. * \param [in] graph The handle to the graph.
  28. * \param [in] input1 Input tensor data. Implementations must support input tensor data type <tt>\ref VX_TYPE_INT16</tt> with fixed_point_position 8,
  29. * and tensor data types <tt>\ref VX_TYPE_UINT8</tt> and <tt>\ref VX_TYPE_INT8</tt>, with fixed_point_position 0.
  30. * \param [in] input2 Input tensor data. The dimensions and sizes of input2 match those of input1, unless the vx_tensor of one or more dimensions in input2 is 1.
  31. * In this case, those dimensions are treated as if this tensor was expanded to match the size of the corresponding dimension of input1,
  32. * and data was duplicated on all terms in that dimension. After this expansion, the dimensions will be equal.
  33. * The data type must match the data type of Input1.
  34. * \param [in] scale A non-negative <tt>\ref VX_TYPE_FLOAT32</tt> multiplied to each product before overflow handling.
  35. * \param [in] overflow_policy A <tt>\ref vx_convert_policy_e</tt> enumeration.
  36. * \param [in] rounding_policy A <tt>\ref vx_round_policy_e</tt> enumeration.
  37. * \param [out] output The output tensor data with the same dimensions as the input tensor data.
  38. * \ingroup group_vision_function_tensor_multiply
  39. * \return <tt>\ref vx_node</tt>.
  40. * \returns A node reference <tt>\ref vx_node</tt>. Any possible errors preventing a
  41. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  42. */
  43. VX_API_ENTRY vx_node VX_API_CALL vxTensorMultiplyNode(vx_graph graph, vx_tensor input1, vx_tensor input2, vx_scalar scale, vx_enum overflow_policy,
  44. vx_enum rounding_policy, vx_tensor output);
  45. /*! \brief [Graph] Performs arithmetic addition on element values in the input tensor data.
  46. * \param [in] graph The handle to the graph.
  47. * \param [in] input1 Input tensor data. Implementations must support input tensor data type <tt>\ref VX_TYPE_INT16</tt> with fixed_point_position 8,
  48. * and tensor data types <tt>\ref VX_TYPE_UINT8</tt> and <tt>\ref VX_TYPE_INT8</tt>, with fixed_point_position 0.
  49. * \param [in] input2 Input tensor data. The dimensions and sizes of input2 match those of input1, unless the vx_tensor of one or more dimensions in input2 is 1.
  50. * In this case, those dimensions are treated as if this tensor was expanded to match the size of the corresponding dimension of input1,
  51. * and data was duplicated on all terms in that dimension. After this expansion, the dimensions will be equal.
  52. * The data type must match the data type of Input1.
  53. * \param [in] policy A <tt>\ref vx_convert_policy_e</tt> enumeration.
  54. * \param [out] output The output tensor data with the same dimensions as the input tensor data.
  55. * \ingroup group_vision_function_tensor_add
  56. * \return <tt>\ref vx_node</tt>.
  57. * \returns A node reference <tt>\ref vx_node</tt>. Any possible errors preventing a
  58. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  59. */
  60. VX_API_ENTRY vx_node VX_API_CALL vxTensorAddNode(vx_graph graph, const vx_char* name, vx_size name_len, vx_tensor input1, vx_tensor input2, vx_enum policy, vx_tensor output);
  61. /*! \brief [Graph] Performs arithmetic subtraction on element values in the input tensor data.
  62. * \param [in] graph The handle to the graph.
  63. * \param [in] input1 Input tensor data. Implementations must support input tensor data type <tt>\ref VX_TYPE_INT16</tt> with fixed_point_position 8,
  64. * and tensor data types <tt>\ref VX_TYPE_UINT8</tt> and <tt>\ref VX_TYPE_INT8</tt>, with fixed_point_position 0.
  65. * \param [in] input2 Input tensor data. The dimensions and sizes of input2 match those of input1, unless the vx_tensor of one or more dimensions in input2 is 1.
  66. * In this case, those dimensions are treated as if this tensor was expanded to match the size of the corresponding dimension of input1,
  67. * and data was duplicated on all terms in that dimension. After this expansion, the dimensions will be equal.
  68. * The data type must match the data type of Input1.
  69. * \param [in] policy A <tt>\ref vx_convert_policy_e</tt> enumeration.
  70. * \param [out] output The output tensor data with the same dimensions as the input tensor data.
  71. * \ingroup group_vision_function_tensor_subtract
  72. * \return <tt>\ref vx_node</tt>.
  73. * \returns A node reference <tt>\ref vx_node</tt>. Any possible errors preventing a
  74. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  75. */
  76. VX_API_ENTRY vx_node VX_API_CALL vxTensorSubtractNode(vx_graph graph, vx_tensor input1, vx_tensor input2, vx_enum policy, vx_tensor output);
  77. /*! \brief [Graph] Performs LUT on element values in the input tensor data.
  78. * \param [in] graph The handle to the graph.
  79. * \param [in] input1 Input tensor data. Implementations must support input tensor data type <tt>\ref VX_TYPE_INT16</tt> with fixed_point_position 8,
  80. * and tensor data types <tt>\ref VX_TYPE_UINT8</tt>, with fixed_point_position 0.
  81. * \param [in] lut The look-up table to use, of type <tt>\ref vx_lut</tt>.
  82. * The elements of input1 are treated as unsigned integers to determine an index into the look-up table.
  83. * The data type of the items in the look-up table must match that of the output tensor.
  84. * \param [out] output The output tensor data with the same dimensions as the input tensor data.
  85. * \ingroup group_vision_function_tensor_tablelookup
  86. * \return <tt>\ref vx_node</tt>.
  87. * \returns A node reference <tt>\ref vx_node</tt>. Any possible errors preventing a
  88. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  89. */
  90. VX_API_ENTRY vx_node VX_API_CALL vxTensorTableLookupNode(vx_graph graph, vx_tensor input1, vx_lut lut, vx_tensor output);
  91. /*! \brief Copy data from one object to another.
  92. * \note An implementation may optimize away the copy when virtual data objects are used.
  93. * \param [in] graph The reference to the graph.
  94. * \param [in] input The input data object.
  95. * \param [out] output The output data object with meta-data identical to the input data object.
  96. * \return <tt>\ref vx_node</tt>.
  97. * \retval vx_node A node reference. Any possible errors preventing a successful creation
  98. * should be checked using <tt>\ref vxGetStatus</tt>
  99. * \ingroup group_vision_function_copy
  100. */
  101. VX_API_ENTRY vx_node VX_API_CALL vxCopyNode(vx_graph graph, vx_reference input, vx_reference output);
  102. #ifdef __cplusplus
  103. }
  104. #endif
  105. #endif