Contents

MLMultiArray

A machine learning collection type that stores numeric values in an array with multiple dimensions.

Declaration

class MLMultiArray

Mentioned in

Overview

A multidimensional array, or multiarray, is one of the underlying types of an MLFeatureValue that stores numeric values in multiple dimensions. All elements in an MLMultiArray instance are one of the same type, and one of the types that MLMultiArrayDataType defines:

MLMultiArrayDataType.int32

32-bit integer

MLMultiArrayDataType.float16

16-bit floating point number

MLMultiArrayDataType.float32

32-bit floating point number (also known as float)

float64

64-bit floating point number (also known as double in Swift or MLMultiArrayDataTypeDouble in Objective-C)

Each dimension in a multiarray is typically significant or meaningful. For example, a model could have an input that accepts images as a multiarray of pixels with three dimensions, C x H x W. The first dimension, C,_ _represents the number of color channels, and the second and third dimensions, H and W, represent the image’s height and width, respectively. The number of dimensions and size of each dimension define the multiarray’s shape.

The shape property is an integer array that has an element for each dimension in the multiarray. Each element in shape defines the size of the corresponding dimension. To inspect the shape and constraints of a model’s multiarray input or output feature:

  1. Access the model’s modelDescription property.

  2. Find the multiarray input or output feature in the model description’s inputDescriptionsByName or outputDescriptionsByName property, respectively.

  3. Access the feature description’s multiArrayConstraint property.

  4. Inspect the multiarray constraint’s shape and shapeConstraint.

Topics

Creating a multiarray

Inspecting a multiarray

Transfering the contents

Providing buffer access

Accessing a multiarray’s elements

Initializers

Default Implementations

See Also

Supporting types