GetShape
Supported Products
Product |
Supported (√/x) |
|---|---|
√ |
|
√ |
|
x |
|
x |
|
x |
|
x |
Functions
Returns the Shape object that describes the tensor shape.
Prototype
1 2 | __aicore__ inline constexpr decltype(auto) GetShape() {} __aicore__ inline constexpr decltype(auto) GetShape() const {} |
Command-Line Options
None
Return Value Description
Shape object that describes the tensor shape. The Shape structure is an alias of the Std::tuple type and is defined as follows:
1 2 | template <typename... Shapes> using Shape = Std::tuple<Shapes...>; |
Restrictions
None
Examples
1 2 3 4 5 6 7 8 9 10 | // Initialize the Layout data structure and obtain the corresponding value. AscendC::Shape<int,int,int> shape = AscendC::MakeShape(10, 20, 30); AscendC::Stride<int,int,int> stride = AscendC::MakeStride(1, 100, 200); auto layoutMake = AscendC::MakeLayout(shape, stride); AscendC::Layout<AscendC::Shape<int, int, int>, AscendC::Stride<int, int, int>> layoutInit(shape, stride); int value = AscendC::Std::get<0>(layoutMake.GetShape()); // value = 10 value = AscendC::Std::get<1>(layoutMake.GetShape()); // value = 20 value = AscendC::Std::get<2>(layoutMake.GetShape()); // value = 30 |
Parent topic: Layout