<!--
{
  "availability" : [
    "iOS: 14.0.0 - 17.4.0",
    "iPadOS: 14.0.0 - 17.4.0",
    "macCatalyst: 14.0.0 - 17.4.0",
    "macOS: 11.0.0 - 14.3.0",
    "tvOS: 14.0.0 - 17.4.0"
  ],
  "documentType" : "symbol",
  "framework" : "MLCompute",
  "identifier" : "/documentation/MLCompute/MLCSliceLayer",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "ML Compute"
    ],
    "preciseIdentifier" : "c:objc(cs)MLCSliceLayer"
  },
  "title" : "MLCSliceLayer"
}
-->

# MLCSliceLayer

A layer that extracts a slice from a tensor.

```
class MLCSliceLayer
```

## Overview

The framework supports positive stride.

Use a slice layer to slice a given source. Slicing won’t decrease the tensor dimension. The start, end, and stride vectors must be of the same size, equal to the source tensor dimension.

## Topics

### Creating Slice Layers

[`init(start:end:stride:)`](/documentation/MLCompute/MLCSliceLayer/init(start:end:stride:))

Creates a slice layer with the start, end, and stride you specify.

[`+  sliceLayerWithStart:end:stride:`](/documentation/MLCompute/MLCSliceLayer/sliceLayerWithStart:end:stride:)

Creates a slice layer with the specified start, end, and stride.

### Inspecting Slice Layers

[`start`](/documentation/MLCompute/MLCSliceLayer/start-6wsh6)

The start vector.

[`end`](/documentation/MLCompute/MLCSliceLayer/end-9xw91)

The end vector.

[`stride`](/documentation/MLCompute/MLCSliceLayer/stride-84fhb)

The stride vector.

[`start`](/documentation/MLCompute/MLCSliceLayer/start-6dnjn)

The start vector.

[`end`](/documentation/MLCompute/MLCSliceLayer/end-8z0wi)

The end vector.

[`stride`](/documentation/MLCompute/MLCSliceLayer/stride-8dnpu)

The stride vector.

## Relationships

### Conforms To

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

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

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

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

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

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

### Inherits From

[`MLCLayer`](/documentation/MLCompute/MLCLayer)

---

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)