Q:

Standalone image patch extraction op in Tensorflow

In the Tensorflow docs, the tf.nn.conv2d-operation is described to:

Flatten the filter to a 2-D matrix with shape [filter_height * filter_width * in_channels, output_channels].
Extract image patches from the input tensor to form a virtual tensor of shape [batch, out_height, out_width, filter_height * filter_width * in_channels].
For each patch, right-multiply the filter matrix and the image patch vector.

Is there an operation to apply just step 2? I cannot find anything like that in the API docs. I might be searching with the wrong keywords.

A:

This is now added to the tensorflow api: https://www.tensorflow.org/versions/r0.9/api_docs/python/array_ops.html#extract_image_patches

