---
title: "init(shape:scalarType:strides:interleaveLayout:)"
framework: coreai
role: symbol
role_heading: Initializer
path: "coreai/ndarray/init(shape:scalartype:strides:interleavelayout:)"
---

# init(shape:scalarType:strides:interleaveLayout:)

Initialize an NDArray with the provided shape, scalar type, strides, and interleaved dimension.

## Declaration

```swift
init(shape: [Int], scalarType: NDArray.ScalarType, strides: [Int], interleaveLayout: NDArray.InterleaveLayout)
```

## Parameters

- `shape`: The length of each dimension of the ndArray.
- `scalarType`: The type of elements in the ndArray.
- `strides`: The strides of the ndArray.
- `interleaveLayout`: Which dimension is interleaved and by what factor. See doc://com.apple.coreai/documentation/CoreAI/NDArray/InterleaveLayout-swift.struct.

## Discussion

Discussion shape and strides must have the same number of elements.
