---
title: MLMultiArray
framework: coreml
role: symbol
role_heading: Class
path: coreml/mlmultiarray
---

# MLMultiArray

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

## Declaration

```swift
class MLMultiArray
```

## Mentioned in

Making Predictions with a Sequence of Inputs

## Overview

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: 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. note: Some models use a one-dimensional multiarray for an input or output. This type of multiarray is conceptually identical to a conventional array. 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: Access the model’s modelDescription property. Find the multiarray input or output feature in the model description’s inputDescriptionsByName or outputDescriptionsByName property, respectively. Access the feature description’s multiArrayConstraint property. Inspect the multiarray constraint’s shape and shapeConstraint.

## Topics

### 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(dataPointer:shape:dataType:strides:deallocator:)](coreml/mlmultiarray/init(datapointer:shape:datatype:strides:deallocator:).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)

### Inspecting a multiarray

- [count](coreml/mlmultiarray/count.md)
- [dataType](coreml/mlmultiarray/datatype.md)
- [shape](coreml/mlmultiarray/shape.md)
- [strides](coreml/mlmultiarray/strides.md)

### Transfering the contents

- [transfer(to:)](coreml/mlmultiarray/transfer(to:).md)

### Providing buffer access

- [withUnsafeBufferPointer(ofType:_:)](coreml/mlmultiarray/withunsafebufferpointer(oftype:_:).md)
- [withUnsafeBytes(_:)](coreml/mlmultiarray/withunsafebytes(_:).md)
- [withUnsafeMutableBufferPointer(ofType:_:)](coreml/mlmultiarray/withunsafemutablebufferpointer(oftype:_:).md)
- [withUnsafeMutableBytes(_:)](coreml/mlmultiarray/withunsafemutablebytes(_:).md)

### Accessing a multiarray’s elements

- [subscript(_:)](coreml/mlmultiarray/subscript(_:).md)
- [pixelBuffer](coreml/mlmultiarray/pixelbuffer.md)
- [dataPointer](coreml/mlmultiarray/datapointer.md)

### Initializers

- [init(coder:)](coreml/mlmultiarray/init(coder:).md)
- [init(concatenating:axis:dataType:)](coreml/mlmultiarray/init(concatenating:axis:datatype:).md)

### Default Implementations

- [MLMultiArray Implementations](coreml/mlmultiarray/mlmultiarray-implementations.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Supporting types

- [MLFeatureType](coreml/mlfeaturetype.md)
- [MLShapedArray](coreml/mlshapedarray.md)
- [MLShapedArrayProtocol](coreml/mlshapedarrayprotocol.md)
- [MLSequence](coreml/mlsequence.md)
