We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All

Constructor

Function Description

Constructs an object of class Shape.

Function Prototype

In the following, dim_num_ indicates the number of dimensions, and dims_ indicates the specific shape.

  • Constructs a shape by default. In the default shape instance, dim_num_ is 0.

    Collapse
    Word wrap
    Dark theme
    Copy code
    1. Shape() : dim_num_(0), dims_{0}
  • Constructs a shape using the dims_ value. For example, Shape({8,3,224,224}) indicates that a Shape instance is created with four dimensions, and the values of each dimension are 8, 3, 224, and 224.

    Collapse
    Word wrap
    Dark theme
    Copy code
    1. Shape(const std::initializer_list<int64_t> &args) : Shape()
  • Serves as a copy constructor. To improve performance, the space where dims_ exceeds the source shape dim_num_ is not copied. Dirty data may exist.

    Collapse
    Word wrap
    Dark theme
    Copy code
    1. Shape(const Shape &other)
  • Serves as a copy assignment operator. To improve performance, the space where dims_ exceeds the source shape dim_num_ is not copied. Dirty data may exist.

    Collapse
    Word wrap
    Dark theme
    Copy code
    1. Shape &operator=(const Shape &other)

Parameters

Expand
Parameter Input/Output Description
args Input All dimension values of the shape.
other Input Source shape object.

Return Value

Generated initialized Shape object.

Restrictions

None

Calling Example

Collapse
Word wrap
Dark theme
Copy code
  1. Shape shape({3, 256, 256}); // The first three dimensions of dims_ with dim_num_= 3 are 3, 256, and 256.
Search in Guides
Enter a keyword.