---
title: "init(unsafeUninitializedShape:initializingWith:)"
framework: coreml
role: symbol
role_heading: Initializer
path: "coreml/mlshapedarrayslice/init(unsafeuninitializedshape:initializingwith:)"
---

# init(unsafeUninitializedShape:initializingWith:)

Creates a shaped array slice from a shape and a closure that initializes its memory.

## Declaration

```swift
init(unsafeUninitializedShape shape: [Int], initializingWith initializer: (inout UnsafeMutableBufferPointer<Scalar>, [Int]) throws -> Void) rethrows
```

## Parameters

- `shape`: An integer array. Each element represents the size of the shaped array’s corresponding dimension.
- `initializer`: A closure you provide that initializes the shaped array’s underlying memory. The initializer calls your closure with a pointer to the memory and an array of strides that correspond to the shaped array’s dimensions.
