---
title: "squeeze(_:axis:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/squeeze(_:axis:name:)"
---

# squeeze(_:axis:name:)

Creates a squeeze operation and returns the result tensor.

## Declaration

```swift
func squeeze(_ tensor: MPSGraphTensor, axis: Int, name: String?) -> MPSGraphTensor
```

## Parameters

- `tensor`: The input tensor.
- `axis`: The axis to squeeze.
- `name`: The name for the operation.

## Return Value

Return Value A valid MPSGraphTensor object.

## Discussion

Discussion Squeezes the tensor, removing a dimension with size 1 at the specified axis. The size of the input tensor must be 1 at the specified axis.
