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

# init(unsafeUninitializedShape:initializingWith:)

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

## Declaration

```swift
init(unsafeUninitializedShape shape: [Int], initializingWith initializer: (inout UnsafeMutableBufferPointer<Self.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.

## See Also

### Creating a shaped array type

- [init(scalars:shape:)](coreml/mlshapedarrayprotocol/init(scalars:shape:).md)
- [init(repeating:shape:)](coreml/mlshapedarrayprotocol/init(repeating:shape:).md)
- [init(identityMatrixOfSize:)](coreml/mlshapedarrayprotocol/init(identitymatrixofsize:).md)
- [init(randomScalarsIn:shape:)](coreml/mlshapedarrayprotocol/init(randomscalarsin:shape:).md)
- [init(bytesNoCopy:shape:deallocator:)](coreml/mlshapedarrayprotocol/init(bytesnocopy:shape:deallocator:).md)
- [init(bytesNoCopy:shape:strides:deallocator:)](coreml/mlshapedarrayprotocol/init(bytesnocopy:shape:strides:deallocator:).md)
