---
title: MLShapedArrayProtocol
framework: coreml
role: symbol
role_heading: Protocol
path: coreml/mlshapedarrayprotocol
---

# MLShapedArrayProtocol

An interface that defines a shaped array type.

## Declaration

```swift
protocol MLShapedArrayProtocol<Scalar> : ExpressibleByArrayLiteral, MutableCollection, RandomAccessCollection where Self.Index == Int
```

## Topics

### Creating a shaped array type

- [init(scalars:shape:)](coreml/mlshapedarrayprotocol/init(scalars:shape:).md)
- [init(repeating:shape:)](coreml/mlshapedarrayprotocol/init(repeating:shape:).md)
- [init(identityMatrixOfSize:)](coreml/mlshapedarrayprotocol/init(identitymatrixofsize:).md)
- [init(randomScalarsIn:shape:)](coreml/mlshapedarrayprotocol/init(randomscalarsin:shape:).md)
- [init(bytesNoCopy:shape:deallocator:)](coreml/mlshapedarrayprotocol/init(bytesnocopy:shape:deallocator:).md)
- [init(bytesNoCopy:shape:strides:deallocator:)](coreml/mlshapedarrayprotocol/init(bytesnocopy:shape:strides:deallocator:).md)
- [init(unsafeUninitializedShape:initializingWith:)](coreml/mlshapedarrayprotocol/init(unsafeuninitializedshape:initializingwith:).md)

### Creating a shaped array type from another type

- [init(_:)](coreml/mlshapedarrayprotocol/init(_:).md)
- [init(converting:)](coreml/mlshapedarrayprotocol/init(converting:).md)

### Inspecting a shaped array type

- [shape](coreml/mlshapedarrayprotocol/shape.md)
- [strides](coreml/mlshapedarrayprotocol/strides.md)
- [count](coreml/mlshapedarrayprotocol/count.md)
- [isScalar](coreml/mlshapedarrayprotocol/isscalar.md)
- [scalarCount](coreml/mlshapedarrayprotocol/scalarcount.md)
- [scalar](coreml/mlshapedarrayprotocol/scalar-swift.property.md)
- [scalars](coreml/mlshapedarrayprotocol/scalars.md)
- [withUnsafeShapedBufferPointer(_:)](coreml/mlshapedarrayprotocol/withunsafeshapedbufferpointer(_:).md)

### Accessing elements

- [subscript(scalarAt:)](coreml/mlshapedarrayprotocol/subscript(scalarat:).md)
- [subscript(_:)](coreml/mlshapedarrayprotocol/subscript(_:).md)

### Modifying a shaped array type

- [fill(with:)](coreml/mlshapedarrayprotocol/fill(with:).md)
- [withUnsafeMutableShapedBufferPointer(_:)](coreml/mlshapedarrayprotocol/withunsafemutableshapedbufferpointer(_:).md)

### Supporting types

- [Scalar](coreml/mlshapedarrayprotocol/scalar-swift.associatedtype.md)
- [MLShapedArraySlice](coreml/mlshapedarrayslice.md)
- [MLShapedArrayScalar](coreml/mlshapedarrayscalar.md)
- [MLShapedArrayRangeExpression](coreml/mlshapedarrayrangeexpression.md)

## Relationships

### Inherits From

- [BidirectionalCollection](swift/bidirectionalcollection.md)
- [Collection](swift/collection.md)
- [ExpressibleByArrayLiteral](swift/expressiblebyarrayliteral.md)
- [MutableCollection](swift/mutablecollection.md)
- [RandomAccessCollection](swift/randomaccesscollection.md)
- [Sequence](swift/sequence.md)

### Conforming Types

- [MLShapedArray](coreml/mlshapedarray.md)
- [MLShapedArraySlice](coreml/mlshapedarrayslice.md)

## See Also

### Supporting types

- [MLFeatureType](coreml/mlfeaturetype.md)
- [MLShapedArray](coreml/mlshapedarray.md)
- [MLMultiArray](coreml/mlmultiarray.md)
- [MLSequence](coreml/mlsequence.md)
