---
title: "select(predicate:trueTensor:falseTensor:name:)"
framework: metalperformanceshadersgraph
role: symbol
role_heading: Instance Method
path: "metalperformanceshadersgraph/mpsgraph/select(predicate:truetensor:falsetensor:name:)"
---

# select(predicate:trueTensor:falseTensor:name:)

Selects values from either the true or false predicate tensor, depending on the values in the first input.

## Declaration

```swift
func select(predicate predicateTensor: MPSGraphTensor, trueTensor truePredicateTensor: MPSGraphTensor, falseTensor falseSelectTensor: MPSGraphTensor, name: String?) -> MPSGraphTensor
```

## Parameters

- `predicateTensor`: The predicate tensor.
- `truePredicateTensor`: The tensor to select values from if predicate is true.
- `falseSelectTensor`: The tensor to select values from if predicate is false.
- `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 creates a select operation and returns the result tensor. It supports broadcasting as well. resultTensor = select(predicateTensor, truePredicateTensor, falseSelectTensor)
