<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreML",
  "identifier" : "/documentation/CoreML/MLTensorRangeExpression",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Core ML"
    ],
    "preciseIdentifier" : "s:6CoreML23MLTensorRangeExpressionP"
  },
  "title" : "MLTensorRangeExpression"
}
-->

# MLTensorRangeExpression

A type that can be used to slice a dimension of a tensor. Don’t use this type directly.

```
protocol MLTensorRangeExpression : Sendable
```

## Topics

### Expanding and squeezing the tensor

[`static var newAxis: any MLTensorRangeExpression`](/documentation/CoreML/MLTensorRangeExpression/newAxis)

Expand the tensor at the specified dimension.

[`static var squeezeAxis: any MLTensorRangeExpression`](/documentation/CoreML/MLTensorRangeExpression/squeezeAxis)

Squeeze the tensor at the specified dimension.

[`static var fillAll: any MLTensorRangeExpression`](/documentation/CoreML/MLTensorRangeExpression/fillAll)

The same as the ellipsis literal `...` used to indicate unspecified dimensions of the tensor.

### Slicing the tensor

[`static func closedRange(ClosedRange<Int>, stride: Int) -> any MLTensorRangeExpression`](/documentation/CoreML/MLTensorRangeExpression/closedRange(_:stride:))

Slice the tensor at the specified dimension.

[`static func index(Int) -> any MLTensorRangeExpression`](/documentation/CoreML/MLTensorRangeExpression/index(_:))

Slice the tensor at the specified dimension.

[`static func partialRangeFrom(PartialRangeFrom<Int>, stride: Int) -> any MLTensorRangeExpression`](/documentation/CoreML/MLTensorRangeExpression/partialRangeFrom(_:stride:))

Slice the tensor at the specified dimension.

[`static partialRangeUpTo(_:stride:)`](/documentation/CoreML/MLTensorRangeExpression/partialRangeUpTo(_:stride:))

Slice the tensor at the specified dimension.

[`static func range(Range<Int>, stride: Int) -> any MLTensorRangeExpression`](/documentation/CoreML/MLTensorRangeExpression/range(_:stride:))

Slice the tensor at the specified dimension.

## Relationships

### Inherits From

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)