• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# OH_NN_Tensor
2
3
4## Overview
5
6Defines the tensor structure.
7
8It is usually used to construct data nodes and operator parameters in a model graph. When constructing a tensor, you need to specify the data type, number of dimensions, dimension information, and quantization information.
9
10**Since:**
119
12
13**Related Modules:**
14
15[NeuralNeworkRuntime](_neural_nework_runtime.md)
16
17
18## Summary
19
20
21### Member Variables
22
23| Name | Description |
24| -------- | -------- |
25| [dataType](#datatype) | Data type of the specified tensor. The value must be an enumerated value of [OH_NN_DataType](_neural_nework_runtime.md#oh_nn_datatype).  |
26| [dimensionCount](#dimensioncount) | Number of dimensions of the specified tensor  |
27| [dimensions](#dimensions) | Dimension information (shape) of the specified tensor  |
28| [quantParam](#quantparam) | Quantization information of the specified tensor. The data type must be [OH_NN_QuantParam](_o_h___n_n___quant_param.md).  |
29| [type](#type) | Specifies the tensor type. The value of **type** is related to the tensor usage. When the tensor is used as the input or output of the model, set **type** to [OH_NN_TENSOR](_neural_nework_runtime.md). When a tensor is used as an operator parameter, select any enumerated value except [OH_NN_TENSOR](_neural_nework_runtime.md) from [OH_NN_TensorType](_neural_nework_runtime.md#oh_nn_tensortype).  |
30
31
32## Member Variable Description
33
34
35### dataType
36
37
38```
39OH_NN_DataType OH_NN_Tensor::dataType
40```
41**Description**<br>
42Data type of the specified tensor. The value must be an enumerated value of [OH_NN_DataType](_neural_nework_runtime.md#oh_nn_datatype).
43
44
45### dimensionCount
46
47
48```
49uint32_t OH_NN_Tensor::dimensionCount
50```
51**Description**<br>
52Number of dimensions of the specified tensor
53
54
55### dimensions
56
57
58```
59const int32_t* OH_NN_Tensor::dimensions
60```
61**Description**<br>
62Dimension information (shape) of the specified tensor
63
64
65### quantParam
66
67
68```
69const OH_NN_QuantParam* OH_NN_Tensor::quantParam
70```
71**Description**<br>
72Quantization information of the specified tensor. The data type must be [OH_NN_QuantParam](_o_h___n_n___quant_param.md).
73
74
75### type
76
77
78```
79OH_NN_TensorType OH_NN_Tensor::type
80```
81**Description**<br>
82Specifies the tensor type. The value of **type** is related to the tensor usage. When the tensor is used as the input or output of the model, set **type** to [OH_NN_TENSOR](_neural_nework_runtime.md). When a tensor is used as an operator parameter, select any enumerated value except [OH_NN_TENSOR](_neural_nework_runtime.md) from [OH_NN_TensorType](_neural_nework_runtime.md#oh_nn_tensortype).
83