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

# divisionNoNaN(_:_:name:)

Divides the first input tensor by the second, with the result being 0 if the denominator is 0.

## Declaration

```swift
func divisionNoNaN(_ primaryTensor: MPSGraphTensor, _ secondaryTensor: MPSGraphTensor, name: String?) -> MPSGraphTensor
```

## Parameters

- `primaryTensor`: The LHS tensor of the binary Op.
- `secondaryTensor`: The RHS tensor of the binary Op.
- `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 resultTensor = select(secondaryTensor, primaryTensor / secondaryTensor, 0)
