---
title: "reshape(shape:source:)"
framework: ML Compute
role: symbol
role_heading: Instance Method
platforms: [iOS 14.0+, iPadOS 14.0+, Mac Catalyst 14.0+, macOS 11.0+, tvOS 14.0+]
path: "mlcompute/mlcgraph/reshape(shape:source:)"
---

# reshape(shape:source:)

Adds a new reshape layer to the graph using the shape and source tensor you specify.

## Declaration

```swift
func reshape(shape: [Int], source: MLCTensor) -> MLCTensor?
```

## Parameters

- `shape`: An array representing the shape of result tensor.
- `source`: The source tensor.

## Return Value

Return Value A result tensor.

## See Also

### Adding New Layers to Graphs

- [split(source:splitCount:dimension:)](mlcompute/mlcgraph/split(source:splitcount:dimension:).md)
- [split(source:splitSectionLengths:dimension:)](mlcompute/mlcgraph/split(source:splitsectionlengths:dimension:).md)
- [concatenate(sources:dimension:)](mlcompute/mlcgraph/concatenate(sources:dimension:).md)
- [gather(withDimension:source:indices:)](mlcompute/mlcgraph/gather(withdimension:source:indices:).md)
- [scatter(withDimension:source:indices:copyFrom:reductionType:)](mlcompute/mlcgraph/scatter(withdimension:source:indices:copyfrom:reductiontype:).md)
- [transpose(dimensions:source:)](mlcompute/mlcgraph/transpose(dimensions:source:).md)
