init(descriptor:)
Creates an array with the shape and preferred strides from the specified descriptor.
Declaration
init(descriptor: consuming NDArrayDescriptor)Parameters
- descriptor:
The descriptor that defines the array’s shape and scalar type.
Discussion
The resulting array may not have a contiguous layout. The strides match the values returned by the descriptor’s preferred strides, so contiguousElements on a view of this array may return nil. In that case, use withUnsafePointer or withUnsafeMutablePointer to access the data while respecting the strides.
If the descriptor has an NDArray.InterleaveLayout, the resulting ndArray will carry that interleave metadata. See NDArray.InterleaveLayout for details on how interleaved layouts affect stride semantics.
The descriptor’s hasDynamicShape must be false. If the descriptor has dynamic shapes, call resolvingDynamicDimensions(_:) first.