<!--
{
  "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/Downsampler",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Create ML Components"
    ],
    "preciseIdentifier" : "s:18CreateMLComponents11DownsamplerV"
  },
  "title" : "Downsampler"
}
-->

# Downsampler

A temporal transformer that down samples the input stream.

```
struct Downsampler<Input> where Input : Sendable
```

## Topics

### Creating a transformer

[`init(factor: Int)`](/documentation/CreateMLComponents/Downsampler/init(factor:))

Creates a down sample temporal transformer.

### Getting the sample factor

[`let factor: Int`](/documentation/CreateMLComponents/Downsampler/factor)

The down sample factor to the input stream.

### Performing the transformation

[`func applied<S>(to: S, eventHandler: EventHandler?) throws -> Downsampler<Input>.DownStreamSequence`](/documentation/CreateMLComponents/Downsampler/applied(to:eventHandler:))

Down samples the input sequence

[`struct DownStreamSequence`](/documentation/CreateMLComponents/Downsampler/DownStreamSequence)

An async sequence of down stream elements.

## Relationships

### Conforms To

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

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

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

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

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

---

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)