---
title: "reversed(alongAxes:)"
framework: coreml
role: symbol
role_heading: Instance Method
path: "coreml/mltensor/reversed(alongaxes:)"
---

# reversed(alongAxes:)

Returns a new tensor with the specified dimensions reversed.

## Declaration

```swift
func reversed(alongAxes axes: Int...) -> MLTensor
```

## Parameters

- `axes`: The indices of the dimensions to reverse. Must be in the range [-rank, rank).

## Return Value

Return Value A new tensor with the same shape and scalar type with the specified dimensions reversed.

## Discussion

Discussion For example: let x = MLTensor(shape: [4], scalars: [0,  1,  2,  3], scalarType: Float.self) let y = x.reversed(alongAxes: 0) // [3, 2, 1, 0]
