---
title: "leakyReLU(with:alpha:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/leakyrelu(with:alpha:name:)"
---

# leakyReLU(with:alpha:name:)

Computes the leaky rectified linear unit (ReLU) activation function on the input tensor.

## Declaration

```swift
func leakyReLU(with tensor: MPSGraphTensor, alpha: Double, name: String?) -> MPSGraphTensor
```

## Parameters

- `tensor`: An input tensor.
- `alpha`: The scalar value alpha used by all elements in the input tensor.
- `name`: The name for the operation.

## Return Value

Return Value A valid MPSGraphTensor object

## Discussion

Discussion The operation is: f(x) = max(x, alpha).
