init(_:dataLayout:stride:)
Returns a new shape with the specified size, data layout, and stride.
Declaration
init(_ size: [Int], dataLayout: BNNS.DataLayout? = nil, stride: [Int]? = nil)Parameters
- size:
An array that specifies the number of values in each dimension.
- dataLayout:
The number of dimensions of the array, and how it stores the data.
- stride:
An array specifying the increment, in values, between a value and the next in each dimension.
Discussion
Pass nil to dataLayout to have init(size:dataLayout:stride:) return a shape with the default layout for the rank that’s equal to the count of size. The default layouts for each dimensionality are:
- 1D
- 2D
- 3D
- 4D
- 5D
- 6D
- 7D
- 8D
This initializer interprets a stride value of 0 to mean that values are contiguous for that axis.