---
title: "makeTensor(descriptor:attachments:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtldevice/maketensor(descriptor:attachments:)"
---

# makeTensor(descriptor:attachments:)

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

## Declaration

```swift
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

Return Value A tensor, or nil if validation fails.

## Discussion

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