init(dataPointer:shape:dataType:strides:deallocator:)
Creates a multiarray from a data pointer.
Declaration
init(dataPointer: UnsafeMutableRawPointer, shape: [NSNumber], dataType: MLMultiArrayDataType, strides: [NSNumber], deallocator: ((UnsafeMutableRawPointer) -> Void)? = nil) throwsParameters
- 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 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 Dealloc method.
Discussion
The caller is responsible for freeing the memory the dataPointer points to, by providing a deallocator closure.