---
title: "subscript(_:)"
framework: coreml
role: symbol
role_heading: Instance Subscript
path: "coreml/mlshapedarrayprotocol/subscript(_:)"
---

# subscript(_:)

A slice of the shaped array for the selected leading axes.

## Declaration

```swift
subscript<C>(indices: C) -> MLShapedArraySlice<Self.Scalar> where C : Collection, C.Element == Int { get set }
```

## Parameters

- `indices`: The indices to slice the array.

## Overview

Overview The slice has a rank of self.rank - indices.count. For example, given a shaped array m with the shape being 3 x 3, m[[1]] returns a slice of shape [3] with the contents labeld as x below.  O  O  O  x  x  x  O  O  O

## See Also

### Accessing elements

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