---
title: "reshaped(to:)"
framework: coreml
role: symbol
role_heading: Instance Method
path: "coreml/mltensor/reshaped(to:)"
---

# reshaped(to:)

Reshape to the specified shape.

## Declaration

```swift
func reshaped(to newShape: [Int]) -> MLTensor
```

## Parameters

- `newShape`: The new shape of the array. The number of scalars matches the new shape.

## Discussion

Discussion For example: let x = MLTensor(shape: [2], scalars: [1, 2], scalarType: Float.self) let y = x.reshaped(at: [1, 2, 1]) y.shape // is [1, 2, 1]

## See Also

### Reshaping the tensor

- [flattened()](coreml/mltensor/flattened().md)
