---
title: "init(dataPointer:shape:dataType:strides:deallocator:)"
framework: coreml
role: symbol
role_heading: Initializer
path: "coreml/mlmultiarray/init(datapointer:shape:datatype:strides:deallocator:)"
---

# init(dataPointer:shape:dataType:strides:deallocator:)

Creates a multiarray from a data pointer.

## Declaration

```swift
init(dataPointer: UnsafeMutableRawPointer, shape: [NSNumber], dataType: MLMultiArrayDataType, strides: [NSNumber], deallocator: ((UnsafeMutableRawPointer) -> Void)? = nil) throws
```

## Parameters

- `dataPointer`: A pointer to data in memory.
- `shape`: An integer array with an element for each dimension. An element represents the size of the corresponding dimension.
- `dataType`: An doc://com.apple.coreml/documentation/CoreML/MLMultiArrayDataType instance that represents the pointer’s data type.
- `strides`: An integer array with an element for each dimension. An element represents the number of memory locations that span the length of the corresponding dimension.
- `deallocator`: In Swift, a closure the multiarray calls in its deinitializer. In Objective-C, a block the multiarray calls in its doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/dealloc method.

## Discussion

Discussion The caller is responsible for freeing the memory the dataPointer points to, by providing a deallocator closure.

## See Also

### Creating a multiarray

- [init(_:)](coreml/mlmultiarray/init(_:).md)
- [init(shape:dataType:)](coreml/mlmultiarray/init(shape:datatype:).md)
- [init(shape:dataType:strides:)](coreml/mlmultiarray/init(shape:datatype:strides:).md)
- [init(byConcatenatingMultiArrays:alongAxis:dataType:)](coreml/mlmultiarray/init(byconcatenatingmultiarrays:alongaxis:datatype:).md)
- [init(pixelBuffer:shape:)](coreml/mlmultiarray/init(pixelbuffer:shape:).md)
- [MLMultiArrayDataType](coreml/mlmultiarraydatatype.md)
