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

# init(shape:scalarType:strides:)

Creates an array with the specified shape, scalar type, and strides.

## Declaration

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

## Parameters

- `shape`: The length of each dimension.
- `scalarType`: The scalar element type.
- `strides`: The distance, in elements, between consecutive values along each dimension.

## Discussion

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

## See Also

### Creating an array

- [init(shape:scalarType:)](coreai/ndarray/init(shape:scalartype:).md)
- [init(descriptor:)](coreai/ndarray/init(descriptor:).md)
