Expand (Outputting a New Shape)
Description
Expands dimensions of a shape and writes the result into a specified output shape object.
Prototype
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.
Restrictions
None
Example
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