<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShadersGraph",
  "identifier" : "/documentation/MetalPerformanceShadersGraph/MPSGraph/sliceGradientTensor(_:fwdInShapeTensor:starts:ends:strides:startMask:endMask:squeezeMask:name:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal Performance Shaders Graph",
      "MetalPerformanceShadersGraph"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSGraph(im)sliceGradientTensor:fwdInShapeTensor:starts:ends:strides:startMask:endMask:squeezeMask:name:"
  },
  "title" : "sliceGradientTensor(_:fwdInShapeTensor:starts:ends:strides:startMask:endMask:squeezeMask:name:)"
}
-->

# sliceGradientTensor(_:fwdInShapeTensor:starts:ends:strides:startMask:endMask:squeezeMask:name:)

Creates a strided-slice gradient operation and returns the result tensor.

```
func sliceGradientTensor(_ inputGradientTensor: MPSGraphTensor, fwdInShapeTensor: MPSGraphTensor, starts: [NSNumber], ends: [NSNumber], strides: [NSNumber], startMask: UInt32, endMask: UInt32, squeezeMask: UInt32, name: String?) -> MPSGraphTensor
```

## Parameters

`inputGradientTensor`

The input gradient.

`fwdInShapeTensor`

The shape of the forward pass input, that is the shape of the gradient output.

`starts`

An array of numbers that specify the starting points for each dimension.

`ends`

An array of numbers that specify the ending points for each dimension.

`strides`

An array of numbers that specify the strides for each dimension.

`startMask`

A bitmask that indicates dimensions whose `starts` values the operation should ignore.

`endMask`

A bitmask that indicates dimensions whose `ends` values the operation should ignore.

`squeezeMask`

A bitmask that indicates dimensions the operation will squeeze out from the result.

`name`

The name for the operation.

## Return Value

A valid MPSGraphTensor object

---

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)