<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLDevice/makeTensor(descriptor:attachments:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLDevice(im)newTensorWithDescriptor:attachments:error:"
  },
  "title" : "makeTensor(descriptor:attachments:)"
}
-->

# makeTensor(descriptor:attachments:)

Creates a tensor with the specified descriptor and per-plane buffer backing storage.

```
func makeTensor(descriptor: MTLTensorDescriptor, attachments: MTLTensorBufferAttachments) throws -> any MTLTensor
```

## Parameters

`descriptor`

The tensor descriptor configuring the data plane and
auxiliary planes.

`attachments`

The per-plane buffer backing storage. Must not be `nil`.

## Return Value

A tensor, or `nil` if validation fails.

## Discussion

This method validates the constraints documented on [`MTLTensorDescriptor`](/documentation/Metal/MTLTensorDescriptor)
and [`MTLTensorBufferAttachments`](/documentation/Metal/MTLTensorBufferAttachments), and additionally requires that every
plane configured in `descriptor` (data plane and all auxiliary planes) has
a corresponding entry in `attachments`.

---

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)