<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTL4MachineLearningPipelineDescriptor/setInputDimensions(_:bufferIndex:)-34gir",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(cs)MTL4MachineLearningPipelineDescriptor(im)setInputDimensions:atBufferIndex:"
  },
  "title" : "setInputDimensions(_:bufferIndex:)"
}
-->

# setInputDimensions(_:bufferIndex:)

Sets the dimension of an input tensor at a buffer index.

```
func setInputDimensions(_ dimensions: MTLTensorExtents?, bufferIndex: Int)
```

## Parameters

`dimensions`

the dimensions of the tensor.

`bufferIndex`

Index of the tensor to modify.

## Discussion

When the compiled model declares the input as unranked (unknown rank), any concrete `dimensions` are accepted.
Otherwise `dimensions.rank` must equal the model’s input rank, and each static (non `-1`) dimension must match.

---

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)