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

# init(shape:scalarType:)

Creates an array with the specified shape and scalar type.

## Declaration

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

## Parameters

- `shape`: The length of each dimension.
- `scalarType`: The scalar element type.

## Discussion

Discussion This initializer creates an array with contiguous, row-major strides.

## See Also

### Creating an array

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