Contents

init(shape:dataType:)

Creates a multidimensional array with a shape and type.

Declaration

init(shape: [NSNumber], dataType: MLMultiArrayDataType) throws

Parameters

  • shape:

    An integer array that has an element for each dimension in a multiarray that represents its length.

  • dataType:

    An element type defined by Mlmultiarraydatatype.

Discussion

This method allocates a contiguous region of memory for the multiarray’s shape. You must set the contents of memory. The multiarray frees the memory in its deinitializer (Swift) or dealloc method (Objective-C).

The following code creates a 3 x 3 multiarray and sets its contents to the value 3.14159.

See Also

Creating a multiarray