EsCreateEsCTensor
Applicability
Product |
Supported or Not |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Header File/Library File
- Header file: #include <ge/esb_funcs.h>
- Library files: libeager_style_graph_builder_base.so and libeager_style_graph_builder_base_static.a
Function Usage
Creates an EsCTensor by a C user.
Prototype
1 | EsCTensor *EsCreateEsCTensor(const void *data, const int64_t *dim, int64_t dim_num, C_DataType data_type,C_Format format) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
data |
Input |
Pointer to the tensor data. |
dim |
Input |
Pointer to the tensor dimension array. |
dim_num |
Input |
Number of tensor dimensions. |
data_type |
Input |
Enumerated value of DataType of a tensor. |
format |
Input |
Tensor format. |
Returns
Parameter |
Type |
Description |
|---|---|---|
- |
EsCTensor * |
Anonymous pointer to the tensor. If the operation fails, nullptr is returned. |
Constraints
None
Examples
1 2 3 4 | std::vector<float> data = {5.0, 6.1}; int64_t dims[] = {2}; auto tmp = data.data(); auto es_tensor = EsCreateEsCTensor(tmp, dims, 1, C_DT_FLOAT, C_FORMAT_ND); |
Parent topic: C/C++ APIs