harmony 鸿蒙tensor.h
tensor.h
Overview
Provides APIs for creating and modifying tensor information.
Since
9
Related Modules
Summary
Types
Name | Description |
---|---|
OH_AI_TensorHandle | Defines the handle of a tensor object. |
Functions
Name | Description |
---|---|
OH_AI_TensorCreate (const char *name, OH_AI_DataType type, const int64_t *shape, size_t shape_num, const void *data, size_t data_len) |
Creates a tensor object. |
OH_AI_TensorDestroy (OH_AI_TensorHandle *tensor) | Destroys a tensor object. |
OH_AI_TensorClone (OH_AI_TensorHandle tensor) | Clones a tensor. |
OH_AI_TensorSetName (OH_AI_TensorHandle tensor, const char *name) | Sets the tensor name. |
OH_AI_TensorGetName (const OH_AI_TensorHandle tensor) | Obtains the tensor name. |
OH_AI_TensorSetDataType (OH_AI_TensorHandle tensor, OH_AI_DataType type) | Sets the data type of a tensor. |
OH_AI_TensorGetDataType (const OH_AI_TensorHandle tensor) | Obtains the tensor type. |
OH_AI_TensorSetShape (OH_AI_TensorHandle tensor, const int64_t *shape, size_t shape_num) |
Sets the tensor shape. |
OH_AI_TensorGetShape (const OH_AI_TensorHandle tensor, size_t *shape_num) | Obtains the tensor shape. |
OH_AI_TensorSetFormat (OH_AI_TensorHandle tensor, OH_AI_Format format) | Sets the tensor data format. |
OH_AI_TensorGetFormat (const OH_AI_TensorHandle tensor) | Obtains the tensor data format. |
OH_AI_TensorSetData (OH_AI_TensorHandle tensor, void *data) | Sets the tensor data. |
OH_AI_TensorGetData (const OH_AI_TensorHandle tensor) | Obtains the pointer to tensor data. |
OH_AI_TensorGetMutableData (const OH_AI_TensorHandle tensor) | Obtains the pointer to variable tensor data. If the data is empty, memory will be allocated. |
OH_AI_TensorGetElementNum (const OH_AI_TensorHandle tensor) | Obtains the number of tensor elements. |
OH_AI_TensorGetDataSize (const OH_AI_TensorHandle tensor) | Obtains the number of bytes of the tensor data. |
OH_AI_TensorSetUserData (OH_AI_TensorHandle tensor, void *data, size_t data_size) | Sets the tensor as the user data. This function allows you to reuse user data as the model input, which helps to reduce data copy by one time. |
你可能感兴趣的鸿蒙文章
0
赞
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦