<!--
{
  "availability" : [
    "iOS: 16.0.0 - 18.0.0",
    "iPadOS: 16.0.0 - 18.0.0",
    "macCatalyst: 16.0.0 - 18.0.0",
    "macOS: 13.0.0 - 15.0.0",
    "tvOS: 16.0.0 - 18.0.0",
    "visionOS: 1.0.0 - 2.0.0",
    "watchOS: 9.0.0 - 11.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/BNNSShuffle(_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@BNNSShuffle"
  },
  "title" : "BNNSShuffle(_:_:_:_:)"
}
-->

# BNNSShuffle(_:_:_:_:)

Rearranges elements in a tensor according to shuffle type.

```
func BNNSShuffle(_ type: BNNSShuffleType, _ input: UnsafePointer<BNNSNDArrayDescriptor>, _ output: UnsafeMutablePointer<BNNSNDArrayDescriptor>, _ filter_params: UnsafePointer<BNNSFilterParameters>?) -> Int32
```

## Parameters

`type`

A constant that specifies the shuffle type.

`input`

A pointer to the input descriptor.

`output`

A pointer to the output descriptor.

`filter_params`

The filter runtime parameters.

## Discussion

Use [`BNNSShuffle(_:_:_:_:)`](/documentation/Accelerate/BNNSShuffle(_:_:_:_:)) to rearrange the elements in a tensor between the depth dimension and blocks of 2D spatial data.

Pass a shuffle type of [`BNNSShuffleTypePixelShuffleNCHW`](/documentation/Accelerate/BNNSShuffleTypePixelShuffleNCHW) to specify that the function rearranges elements in a tensor of shape `(N,C×r×r,H,W)` to a tensor of shape `(N,C,H×r,W×r)`, where `r` is an upscale factor.

Pass [`BNNSShuffleTypePixelUnshuffleNCHW`](/documentation/Accelerate/BNNSShuffleTypePixelUnshuffleNCHW) to specify that the function elements in a tensor of shape `(N,C,H×r,W×r)` to a tensor of shape `(N,C×r×r,H,W)`, where `r` is a downscale factor.

---

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)