---
title: "max(keepRank:)"
framework: coreml
role: symbol
role_heading: Instance Method
path: "coreml/mltensor/max(keeprank:)"
---

# max(keepRank:)

Returns the maximum value in the array.

## Declaration

```swift
func max(keepRank: Bool = false) -> MLTensor
```

## Parameters

- `keepRank`: A Boolean indicating whether to keep the reduced axes or not. The default value is false.

## Return Value

Return Value The reduced tensor.

## Discussion

Discussion let x = MLTensor(shape: [3, 2], scalars: [2, 3, 4, 5, 6, 7], scalarType: Float.self) let y = x.max() y.shape // is [] await y.shapedArray(of: Float.self) // is [7.0]

## See Also

### Accessing the minimum, maximum and mean

- [min(alongAxes:keepRank:)](coreml/mltensor/min(alongaxes:keeprank:).md)
- [min(keepRank:)](coreml/mltensor/min(keeprank:).md)
- [max(alongAxes:keepRank:)](coreml/mltensor/max(alongaxes:keeprank:).md)
- [mean(alongAxes:keepRank:)](coreml/mltensor/mean(alongaxes:keeprank:).md)
- [mean(keepRank:)](coreml/mltensor/mean(keeprank:).md)
