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

# truncate(_:name:)

Applies the truncate operation to the input tensor elements.

## Declaration

```swift
func truncate(_ tensor: MPSGraphTensor, name: String?) -> MPSGraphTensor
```

## Parameters

- `tensor`: The input tensor.
- `name`: An optional string which serves as an identifier for the operation.

## Return Value

Return Value A valid MPSGraphTensor object containing the elementwise result of the applied operation.

## Discussion

Discussion This operation applies the floor operation to positive inputs and ceiling operation to negative inputs.
