<!--
{
  "availability" : [
    "iOS: 14.0.0 - 17.0.0",
    "iPadOS: 14.0.0 - 17.0.0",
    "macCatalyst: 14.0.0 - 17.0.0",
    "macOS: 11.0.0 - 14.0.0",
    "tvOS: 14.0.0 - 17.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "MLCompute",
  "identifier" : "/documentation/MLCompute/MLCUpsampleLayer/init(shape:sampleMode:alignsCorners:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "ML Compute",
      "MLCompute"
    ],
    "preciseIdentifier" : "s:So16MLCUpsampleLayerC9MLComputeE5shape10sampleMode13alignsCornersABSgSaySiG_So09MLCSampleF0VSbtcfc"
  },
  "title" : "init(shape:sampleMode:alignsCorners:)"
}
-->

# init(shape:sampleMode:alignsCorners:)

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

```
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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)