<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreAI",
  "identifier" : "/documentation/CoreAI/NDArray/init(shape:scalarType:strides:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core AI",
      "CoreAI"
    ],
    "preciseIdentifier" : "s:13CoreAIRuntime7NDArrayV5shape10scalarType7stridesACSaySiG_AC06ScalarF0OAGtcfc"
  },
  "title" : "init(shape:scalarType:strides:)"
}
-->

# init(shape:scalarType:strides:)

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

```
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

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)