Shape Constructor

Function Usage

Constructs an object of class Shape.

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.
    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.
    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.
    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.
    1
    Shape &operator=(const Shape &other)
    

Parameters

Parameter

Input/Output

Description

args

Input

All dimension values of the shape.

other

Input

Source shape object.

Returns

Generated initialized Shape object.

Constraints

None

Examples

1
Shape shape({3, 256, 256}); // The first three dimensions of dim_num_=3  dims_ are 3, 256, and 256.