在tf.nn.max_pool
的定义中,ksize
用于什么?
tf.nn.max_pool(value, ksize, strides, padding, data_format='NHWC', name=None)
Performs the max pooling on the input.
Args:
value: A 4-D Tensor with shape [batch, height, width, channels] and type tf.float32.
ksize: A list of ints that has length >= 4. The size of the window for each dimension of the input tensor.
例如,如果input value
是tensor : [1, 64, 64, 3]
和ksize=3
。那是什么意思?
ksize:长度> = 4的整数列表。输入张量的每个维度的窗口大小。
通常对于图像,输入的形状为[batch_size, 64, 64, 3]
,用于64x64像素的RGB图像。
内核大小ksize
通常是[1, 2, 2, 1]
,如果你有一个2x2窗口,你取得最大值。在批量大小维度和渠道维度上,ksize
是1
,因为我们不希望在多个示例或多个通道上取最大值。