---
title: "ClikaRT::ops::pixel_shuffle"
sidebar_label: "pixel_shuffle"
description: "Rearranges channels into space (depth-to-space): channels-last [N, H, W, C] becomes [N, H*r, W*r, C/r^2]. input [N, H, W, C] with C divisible by r^2. upscale_factor r."
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--function">function</span>

## pixel\_shuffle() {#pixel_shuffle}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`pixel_shuffle`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int64_t` `upscale_factor`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`PixelShuffleMode`](./index.md#PixelShuffleMode) `mode` `=` [`PixelShuffleMode::CRD`](./index.md#PixelShuffleMode)<br />
)

</div>

Rearranges channels into space (depth-to-space): channels-last `[N, H, W, C]` becomes `[N, H*r, W*r, C/r^2]`.

**Parameters**

- `input`: `[N, H, W, C]` with `C` divisible by `r^2`.
- `upscale_factor`: `r`.
- `mode`: the channel unpack order (`CRD` / `DCR`). Default [`PixelShuffleMode::CRD`](./index.md#PixelShuffleMode).

**Throws**

- `ClikaRT::Error`: when the input's dtype/shape is not served for this operation (the machine-readable reason rides `code_name()`).

**Returns:** `[N, H*r, W*r, C/r^2]`.

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 4638

</div>
