Stride Constructor
Function Usage
Constructs an object of class Stride.
Prototype
In the following, dim_num_ indicates the number of dimensions, and strides_ indicates the specific step information.
- Constructs a stride by default. In the default stride object, dim_num_ is 0.
1Stride() : dim_num_(0), strides_{0}
- Constructs a stride using the strides_ value. For example, Stride({18,9,3,1}) indicates that a stride object is created with four dimensions, and the values of each dimension are 18, 9, 3, and 1.
1Stride(const std::initializer_list<int64_t> &args) : Stride()
- Serves as a copy constructor. To improve performance, the space where strides_ exceeds the source stride object dim_num_ is not copied. Dirty data may exist.
1Stride(const Stride &other)
- Serves as a copy assignment operator. To improve performance, the space where strides_ exceeds the source stride object dim_num_ is not copied. Dirty data may exist.
1Stride &operator=(const Stride &other)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
args |
Input |
All stride values of the stride object. |
other |
Input |
Source stride object. |
Returns
Initialized stride object.
Constraints
None
Examples
1 | Stride stride({3, 256, 256}); // The first three dimensions of dim_num_=3 strides_ are 3, 256, and 256. |
Parent topic: Stride