Lines Matching refs:tensor
28 * @file tensor.h
51 * @brief Create a tensor object.
52 * @param name The name of the tensor.
53 * @param type The data type of the tensor.
54 * @param shape The shape of the tensor.
65 * @brief Destroy the tensor object.
66 * @param tensor Tensor object handle address.
69 OH_AI_API void OH_AI_TensorDestroy(OH_AI_TensorHandle *tensor);
72 * @brief Obtain a deep copy of the tensor.
73 * @param tensor Tensor object handle.
77 OH_AI_API OH_AI_TensorHandle OH_AI_TensorClone(OH_AI_TensorHandle tensor);
80 * @brief Set the name for the tensor.
81 * @param tensor Tensor object handle.
82 * @param name The name of the tensor.
85 OH_AI_API void OH_AI_TensorSetName(OH_AI_TensorHandle tensor, const char *name);
88 * @brief Obtain the name of the tensor.
89 * @param tensor Tensor object handle.
90 * @return The name of the tensor.
93 OH_AI_API const char *OH_AI_TensorGetName(const OH_AI_TensorHandle tensor);
96 * @brief Set the data type for the tensor.
97 * @param tensor Tensor object handle.
98 * @param type The data type of the tensor.
101 OH_AI_API void OH_AI_TensorSetDataType(OH_AI_TensorHandle tensor, OH_AI_DataType type);
104 * @brief Obtain the data type of the tensor.
105 * @param tensor Tensor object handle.
106 * @return The date type of the tensor.
109 OH_AI_API OH_AI_DataType OH_AI_TensorGetDataType(const OH_AI_TensorHandle tensor);
112 * @brief Set the shape for the tensor.
113 * @param tensor Tensor object handle.
118 OH_AI_API void OH_AI_TensorSetShape(OH_AI_TensorHandle tensor, const int64_t *shape, size_t shape_num);
121 * @brief Obtain the shape of the tensor.
122 * @param tensor Tensor object handle.
124 * @return The shape array of the tensor.
127 OH_AI_API const int64_t *OH_AI_TensorGetShape(const OH_AI_TensorHandle tensor, size_t *shape_num);
130 * @brief Set the format for the tensor.
131 * @param tensor Tensor object handle.
132 * @param format The format of the tensor.
135 OH_AI_API void OH_AI_TensorSetFormat(OH_AI_TensorHandle tensor, OH_AI_Format format);
138 * @brief Obtain the format of the tensor.
139 * @param tensor Tensor object handle.
140 * @return The format of the tensor.
143 OH_AI_API OH_AI_Format OH_AI_TensorGetFormat(const OH_AI_TensorHandle tensor);
146 * @brief Obtain the data for the tensor.
147 * @param tensor Tensor object handle.
148 * @param data A pointer to the data of the tensor.
151 OH_AI_API void OH_AI_TensorSetData(OH_AI_TensorHandle tensor, void *data);
154 * @brief Obtain the data pointer of the tensor.
155 * @param tensor Tensor object handle.
156 * @return The data pointer of the tensor.
159 OH_AI_API const void *OH_AI_TensorGetData(const OH_AI_TensorHandle tensor);
162 * @brief Obtain the mutable data pointer of the tensor. If the internal data is empty, it will allocate memory.
163 * @param tensor Tensor object handle.
164 * @return The data pointer of the tensor.
167 OH_AI_API void *OH_AI_TensorGetMutableData(const OH_AI_TensorHandle tensor);
170 * @brief Obtain the element number of the tensor.
171 * @param tensor Tensor object handle.
172 * @return The element number of the tensor.
175 OH_AI_API int64_t OH_AI_TensorGetElementNum(const OH_AI_TensorHandle tensor);
178 * @brief Obtain the data size fo the tensor.
179 * @param tensor Tensor object handle.
180 * @return The data size of the tensor.
183 OH_AI_API size_t OH_AI_TensorGetDataSize(const OH_AI_TensorHandle tensor);
186 * @brief Set the data for the tensor with user-allocated data buffer.
190 * Note: The tensor won't free the data provided by invoker. Invoker has the responsibility to free it. And this
191 * free action should not be preformed before destruction of the tensor. \n
193 * @param tensor Tensor object handle.
199 OH_AI_API OH_AI_Status OH_AI_TensorSetUserData(OH_AI_TensorHandle tensor, void *data, size_t data_size);