---
title: "init(_:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Initializer
path: "metalperformanceshadersgraph/mpsgraphtensordata/init(_:)-4bnfb"
---

# init(_:)

Initializes an MPSGraphTensorData with an MPS ndarray.

## Declaration

```swift
init(_ ndarray: MPSNDArray)
```

## Parameters

- `ndarray`: MPSNDArray to be used within the MPSGraphTensorData.

## Return Value

Return Value A valid MPSGraphTensorData, or nil if allocation failure.

## Discussion

Discussion The device of the MPSNDArray will be used to get the MPSDevice for this MPSGraphTensorData.
