<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateMLComponents",
  "identifier" : "/documentation/CreateMLComponents/Reshaper",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents8ReshaperV"
  },
  "title" : "Reshaper"
}
-->

# Reshaper

A transformer that reshapes a shaped array.

```
struct Reshaper<Scalar> where Scalar : MLShapedArrayScalar, Scalar : Decodable, Scalar : Encodable
```

## Topics

### Creating a transformer

[`init(shape: [Int])`](/documentation/CreateMLComponents/Reshaper/init(shape:))

Creates a reshape transformer.

### Getting the shape

[`var shape: [Int]`](/documentation/CreateMLComponents/Reshaper/shape)

The target shape.

### Performing the transformation

[`func applied<S>(S, eventHandler: EventHandler?) throws -> [MLShapedArray<Scalar>]`](/documentation/CreateMLComponents/Reshaper/applied(_:eventHandler:))

Reshapes a sequence of inputs.

[`func applied(to: MLShapedArray<Scalar>, eventHandler: EventHandler?) throws -> MLShapedArray<Scalar>`](/documentation/CreateMLComponents/Reshaper/applied(to:eventHandler:))

Reshapes the input.

## Relationships

### Conforms To

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Equatable`](/documentation/Swift/Equatable)

[`Decodable`](/documentation/Swift/Decodable)

[`Escapable`](/documentation/Swift/Escapable)

[`Encodable`](/documentation/Swift/Encodable)

[`Copyable`](/documentation/Swift/Copyable)

[`Sendable`](/documentation/Swift/Sendable)

[`Transformer`](/documentation/CreateMLComponents/Transformer)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

---

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)