---
title: MLShapedArraySlice
framework: coreml
role: symbol
role_heading: Structure
path: coreml/mlshapedarrayslice
---

# MLShapedArraySlice

A multidimensional subset of elements from a shaped array type.

## Declaration

```swift
struct MLShapedArraySlice<Scalar> where Scalar : MLShapedArrayScalar
```

## Topics

### Creating a shaped array slice

- [init(scalar:)](coreml/mlshapedarrayslice/init(scalar:).md)
- [init(scalars:shape:)](coreml/mlshapedarrayslice/init(scalars:shape:).md)
- [init(mutating:shape:)](coreml/mlshapedarrayslice/init(mutating:shape:).md)

### Creating a shaped array slice from another type

- [init(_:)](coreml/mlshapedarrayslice/init(_:).md)
- [init(concatenating:alongAxis:)](coreml/mlshapedarrayslice/init(concatenating:alongaxis:).md)

### Creating a shaped array slice with pointers to memory

- [init(unsafeUninitializedShape:initializingWith:)](coreml/mlshapedarrayslice/init(unsafeuninitializedshape:initializingwith:).md)

### Creating a shaped array slice with data

- [init(data:shape:)](coreml/mlshapedarrayslice/init(data:shape:).md)
- [init(data:shape:strides:)](coreml/mlshapedarrayslice/init(data:shape:strides:).md)

### Shaping the array slice

- [changingLayout(to:)](coreml/mlshapedarrayslice/changinglayout(to:).md)
- [expandingShape(at:)](coreml/mlshapedarrayslice/expandingshape(at:).md)
- [reshaped(to:)](coreml/mlshapedarrayslice/reshaped(to:).md)
- [squeezingShape()](coreml/mlshapedarrayslice/squeezingshape().md)
- [transposed()](coreml/mlshapedarrayslice/transposed().md)
- [transposed(permutation:)](coreml/mlshapedarrayslice/transposed(permutation:).md)

### Modifying a shaped array type

- [withUnsafeMutableShapedBufferPointer(using:_:)](coreml/mlshapedarrayslice/withunsafemutableshapedbufferpointer(using:_:).md)

### Encoding and decoding an array slice

- [init(from:)](coreml/mlshapedarrayslice/init(from:).md)
- [encode(to:)](coreml/mlshapedarrayslice/encode(to:).md)

### Default Implementations

- [Decodable Implementations](coreml/mlshapedarrayslice/decodable-implementations.md)
- [Encodable Implementations](coreml/mlshapedarrayslice/encodable-implementations.md)

## Relationships

### Conforms To

- [BidirectionalCollection](swift/bidirectionalcollection.md)
- [Collection](swift/collection.md)
- [Copyable](swift/copyable.md)
- [Decodable](swift/decodable.md)
- [Encodable](swift/encodable.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [ExpressibleByArrayLiteral](swift/expressiblebyarrayliteral.md)
- [MLShapedArrayProtocol](coreml/mlshapedarrayprotocol.md)
- [MutableCollection](swift/mutablecollection.md)
- [RandomAccessCollection](swift/randomaccesscollection.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [Sequence](swift/sequence.md)

## See Also

### Supporting types

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