Expand (Outputting a New Shape)
Function Usage
Expands dimensions of a shape and writes the result into a specified output shape object.
Prototype
1 | ge::graphStatus Expand(const Shape &shape, Shape &out_shape) const |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
shape |
Input |
Input shape before dimension expansion. |
out_shape |
Output |
Output shape after dimension expansion. |
Returns
ge::GRAPH_SUCCESS on success; ge::GRAPH_FAILED on failure.
For details about the definition of the ge::graphStatus type, see ge::graphStatus.
Constraints
None
Examples
1 2 3 4 5 6 7 8 | Shape origin_shape({3, 256, 256}); // Set the original shape to 3 x 256 x 256. Shape out_shape; ExpandDimsType type1("1000"); ExpandDimsType type2("10000"); ExpandDimsType type3("1001"); auto ret = type1.Expand(origin_shape, out_shape); // ret = ge::GRAPH_SUCCESS, out_shape = 1,3,256,256 ret = type2.Expand(origin_shape, out_shape); // ret = ge::GRAPH_FAILED ret = type3.Expand(origin_shape, out_shape); // ret = ge::GRAPH_SUCCESS, out_shape = 1,3,256,1,256 |
Parent topic: ExpandDimsType