---
title: "init(shape:sampleMode:alignsCorners:)"
framework: ML Compute
role: symbol
role_heading: Initializer
platforms: [iOS 14.0+, iPadOS 14.0+, Mac Catalyst 14.0+, macOS 11.0+, tvOS 14.0+]
path: "mlcompute/mlcupsamplelayer/init(shape:samplemode:alignscorners:)"
---

# init(shape:sampleMode:alignsCorners:)

Creates an upsample layer with the shape, upsampling algorithm, and corner alignment option you specify.

## Declaration

```swift
convenience init?(shape: [Int], sampleMode: MLCSampleMode, alignsCorners: Bool)
```

## Parameters

- `shape`: An array representing the dimensions of the result tensor.
- `sampleMode`: The upsampling algorithm type; the default value is nearest.
- `alignsCorners`: A Boolean that indicates whether the layer aligns the corner pixels of the input and output tensors.

## See Also

### Creating Upsample Layers

- [init(shape:)](mlcompute/mlcupsamplelayer/init(shape:).md)
- [MLCSampleMode](mlcompute/mlcsamplemode.md)
