---
title: "reshape(withSourceArray:shape:)"
framework: metalperformanceshaders
role: symbol
role_heading: Instance Method
path: "metalperformanceshaders/mpsndarrayidentity/reshape(withsourcearray:shape:)"
---

# reshape(withSourceArray:shape:)

## Declaration

```swift
func reshape(withSourceArray sourceArray: MPSNDArray, shape: [NSNumber]) -> MPSNDArray?
```

## Parameters

- `sourceArray`: The source NDArray.
- `shape`: The new shape in Tensorflow dimension order.

## Return Value

Return Value A new array view of sourceArray is returned. Or nil If aliasing is not possible.

## Discussion

Discussion Do a reshape operation on the CPU.
