---
title: "inverse(input:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/inverse(input:name:)"
---

# inverse(input:name:)

Computes the inverse of an input tensor.

## Declaration

```swift
func inverse(input inputTensor: MPSGraphTensor, name: String?) -> MPSGraphTensor
```

## Parameters

- `inputTensor`: The input tensor.
- `name`: The name for the operation.

## Return Value

Return Value A valid MPSGraphTensor object containing the inverse of the input tensor.

## Discussion

Discussion The framework computes the inverse of a square matrix by calling LU decomposition and LU solver. All dimensions after the first 2 are treated as batch dimensions and the inverse for each batch is computed. Results are undefined for ill conditioned matrices.
