---
title: "BNNSShuffle(_:_:_:_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/bnnsshuffle(_:_:_:_:)"
---

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

Rearranges elements in a tensor according to shuffle type.

## Declaration

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

Discussion Use BNNSShuffle(_:_:_:_:) to rearrange the elements in a tensor between the depth dimension and blocks of 2D spatial data. Pass a shuffle type of 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 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.

## See Also

### Errors

- [BNNS.Error](accelerate/bnns/error.md)
- [BNNSBandPart(_:_:_:_:_:)](accelerate/bnnsbandpart(_:_:_:_:_:).md)
- [BNNSShuffleType](accelerate/bnnsshuffletype.md)
- [BNNSTile(_:_:_:)](accelerate/bnnstile(_:_:_:).md)
- [BNNSTileBackward(_:_:_:)](accelerate/bnnstilebackward(_:_:_:).md)
