<p><code>space_to_depth</code> is a convolutional practice used very often for lossless spatial dimensionality reduction. Applied to tensor <code>(example_dim, width, height, channels)</code> with <code>block_size = k</code> it produces a tensor with shape <code>(example_dim, width / block_size, height / block_size, channels * block_size ** 2)</code>. It works in a following manner (<code>example_dim</code> is skipped for simplicity):</p>

<ol>
<li><p><strong>Cut image / feature map into chunks of size (block_size, block_size, channels)</strong>: e.g. the following image (with <code>block_size = 2</code>):</p>

<pre><code>[[[1], [2], [3], [4]],
 [[5], [6], [7], [8]],
 [[9], [10], [11], [12]],
 [[13], [14], [15], [16]]]
</code></pre>

<p>is divided into the following chunks:</p>

<pre><code>[[[1], [2]],       [[[3], [4]],
 [[5], [6]]]        [[7], [8]]]

[[[9], [10],]      [[[11], [12]],
 [[13], [14]]]      [[15], [16]]]
</code></pre></li>
<li><p><strong>Flatten each chunk to a single array</strong>:</p>

<pre><code>[[1, 2, 5, 6]],      [[3, 4, 7, 8]]
[[9 10, 13, 14]],    [[11, 12, 15, 16]]
</code></pre></li>
<li><p><strong>Spatially rearrange chunks according to their initial position:</strong></p>

<pre><code>[[[1, 2, 5, 6]], [[3, 4, 7, 8]],
 [[9 10, 13, 14]], [[11, 12, 15, 16]]]
</code></pre></li>
</ol>

<p>So - as you may see - the initial image with size <code>(4, 4, 1)</code> was rearranged to feature map with shape <code>(2, 2, 4)</code>. The following strategy is usually used for applications like object detection, segmentation or superresolution when it's important to decrease the spatial size of an image without losing reduction (like <code>pooling</code>). An example of an application of this technique might be found e.g. <a href="https://arxiv.org/pdf/1612.08242.pdf" rel="noreferrer">here</a>.</p>
What are the uses of tf.space_to_depth?
<p>I am reading this document on <a href="https://www.tensorflow.org/api_docs/python/tf/space_to_depth" rel="nofollow noreferrer"><code>tf.space_to_depth</code></a>. There, it says about the use of the function: </p>

<blockquote>
  <p>This operation is useful for resizing the activations between
  convolutions (but keeping all data), e.g. instead of pooling. It is
  also useful for training purely convolutional models.</p>
</blockquote>

<p>However, I still don't get a clear understanding of this. Why is it sometimes necessary to resize the activations in a model?</p>