EsSetShape
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
Sets the shape of a tensor. If no shape is set, the default value [] is used, that is, a scalar.
Prototype
1 | uint32_t EsSetShape(EsCTensorHolder *tensor, const int64_t *shape, int64_t dim_num) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
tensor |
Input |
Pointer to the holder. |
shape |
Input |
Array pointer. |
dim_num |
Input |
Number of array dimensions. |
Returns
Parameter |
Type |
Description |
|---|---|---|
- |
uint32_t |
0: success; non-zero value: failure |
Constraints
None
Examples
1 2 3 4 5 6 7 8 | / 1. Create a graph builder (EsCGraphBuilder). EsCGraphBuilder *builder = EsCreateGraphBuilder("graph_name"); // 2. Add a start node. EsCTensorHolder *data0 = EsCreateInput(builder, 0); // Add input node 0. The default value is a [] scalar. int64_t input_shape[] = {1, 3, 224, 224}; // Compute the number of dimensions (dim_num). int64_t dim_num = sizeof(input_shape) / sizeof(input_shape[0]); // The result is 4. EsSetShape(data0, input_shape, dim_num); // Set the shape of input node 0. |
Parent topic: C/C++ APIs