November 2017
Intermediate to advanced
274 pages
6h 16m
English
It performs the average pooling on the input tensor. Each entry in the output is the mean of the corresponding size ksize window in value. It is defined using the tf.nn.avg_pool method:
avg_pool( value, ksize, strides, padding, data_format='NHWC', name=None)
Let's look at the code example where avg_pool is used in a simple 2D tensor:
import tensorflow as tfbatch_size=1input_height = 3input_width = 3input_channels = 1def main(): sess = tf.InteractiveSession() layer_input = tf.constant([ [ [[1.0], [0.2], [2.0]], [[0.1], [1.2], [1.4]], [[1.1], [0.4], [0.4]] ] ]) # The strides will look at the entire input by using the image_height and image_width kernel = [batch_size, input_height, input_width, input_channels] avg_pool = tf.nn.avg_pool(layer_input, ...
Read now
Unlock full access