EsCreateConst
Applicability
Product |
Supported or Not |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function Usage
Creates a Const operator of a specified type (original pointer version).
Prototype
1 2 | template <typename T> EsCTensorHolder *EsCreateConst(EsCGraphBuilder *graph, const T *value, const int64_t *dims, int64_t dim_num, ge::DataType dt, ge::Format format = FORMAT_ND) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
T |
Input |
Tensor data type. |
graph |
Input |
Pointer to the graph builder. |
value |
Input |
Pointer to the tensor data. |
dims |
Input |
Pointer to the tensor dimension array. |
dim_num |
Input |
Number of dimensions. |
dt |
Input |
Tensor data type. |
format |
Input |
Tensor format. The default value is FORMAT_ND. |
Returns
Parameter |
Type |
Description |
|---|---|---|
- |
EsCTensorHolder * |
Tensor holder operator of the created Const. If the operation fails, nullptr is returned. |
Constraints
None
Examples
1 2 3 4 | EsCGraphBuilder *graph = EsCreateGraphBuilder("graph_name"); std::vector<int64_t> data = {1, 2, 3}; std::vector<int64_t> dims = {3}; auto const_tensor = ge::es::EsCreateConst<int64_t>(graph, data.data(), dims.data(), dims.size(), ge::DT_INT64); |
Parent topic: EsGraphBuilder