<!--
{
  "availability" : [
    "iOS: 15.4.0 -",
    "iPadOS: 15.4.0 -",
    "macCatalyst: 15.4.0 -",
    "macOS: 12.3.0 -",
    "tvOS: 15.4.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalPerformanceShadersGraph",
  "identifier" : "/documentation/MetalPerformanceShadersGraph/MPSGraph/bandPart(_:numLower:numUpper:name:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal Performance Shaders Graph",
      "MetalPerformanceShadersGraph"
    ],
    "preciseIdentifier" : "c:objc(cs)MPSGraph(im)bandPartWithTensor:numLower:numUpper:name:"
  },
  "title" : "bandPart(_:numLower:numUpper:name:)"
}
-->

# bandPart(_:numLower:numUpper:name:)

Computes the band part of an input tensor.

```
func bandPart(_ inputTensor: MPSGraphTensor, numLower: Int, numUpper: Int, name: String?) -> MPSGraphTensor
```

## Parameters

`inputTensor`

input tensor

`numLower`

the number of diagonals in the lower triangle to keep. If -1, the framework returns all sub diagnols.

`numUpper`

the number of diagonals in the upper triangle to keep. If -1,  the framework returns all super diagnols.

`name`

name for the operation.

## Return Value

A valid MPSGraphTensor object.

## Discussion

This operation copies a diagonal band of values from input tensor to a result tensor of the same size.
A coordinate `[..., i, j]` is in the band if

```md
(numLower < 0 || (i-j) <= numLower) && (numUpper < 0 || (j-i) <= numUpper) 
```

The values outside of the band are set to 0.

---

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)