[译] TF-api(1) tf.nn.max_pool
来源:互联网 发布:jsp mysql 编辑:程序博客网 时间:2024/05/22 10:19
tf.nn.max_pool
Args:
value: A 4-D
Tensor
with shape[batch, height, width, channels]
and typetf.float32
.
value是一个4D的tensor,是我们对其进行maxpooling的对象,它的shape是[batch, height, width, channels]
ksize: A list of ints that has length >= 4. The size of the window for each dimension of the input tensor.
ksize表示对于输入的tensor的每一维的池化尺度,比如在height那一维是2的话,表示在height轴会以2作为池化尺度。因为往往不会对batch和channel作池化,所以值一般为1。即ksize
=[1, kheight, kwidth, 1]
。
strides: A list of ints that has length >= 4. The stride of the sliding window for each dimension of the input tensor.
strides表示步长, 意同conv2d里面的strides,每一维度都表示窗口的在对应维度上的滑动步长。
padding: A string, either
'VALID'
or'SAME'
. The padding algorithm. See the @{tf.nn.convolution$comment here}
padding表示pooling的模式,意同conv2d里面的strides。SAME
模式就是将滑动窗口与矩阵进行左对齐,然后向右滑动。一直滑到与矩阵最右边那一列不相交为止。
data_format: A string. ‘NHWC’ and ‘NCHW’ are supported.
数据格式,这个一般都是默认的,不需要改变,具体是什么作用暂时不清楚。
name: Optional name for the operation.
op名字
Returns: A
Tensor
with typetf.float32
. The max pooled output tensor.
举例:
import tensorflow as tfimport numpy as npdata = np.random.randint(1, 9, size=[1, 5, 5, 1])print(np.transpose(data, (0, 3, 1, 2)))input_ = tf.convert_to_tensor(data, dtype=tf.float32)res = tf.nn.max_pool(input_, ksize=[1, 2, 2, 1], strides=[1, 1, 1, 1],padding='SAME')with tf.Session() as sess: tf.global_variables_initializer().run() output = sess.run(res, feed_dict={input_: data}) output = np.array(output) print(np.transpose(output, (0, 3, 1, 2)))
- [译] TF-api(1) tf.nn.max_pool
- Tensorflow(r1.4)API--tf.nn.max_pool
- tf.nn.max_pool 实例
- tf.nn.max_pool
- tf.nn.max_pool
- [译]TF-api(2) tf.nn.lrn
- [译] TF-api(3) tf.nn.softmax_cross_entropy_with_logits
- tf.nn.max_pool作什么用?
- 池化操作 tensorflow tf.nn.max_pool
- tf.nn.max_pool参数含义和用法
- 第一阶段-入门详细图文讲解tensorflow1.4 API-tf.nn.max_pool
- tf API 研读1:tf.nn,tf.layers, tf.contrib概述
- 【TensorFlow】tf.nn.max_pool实现池化操作
- TensorFlow--tf.nn.max_pool实现池化操作
- 【TensorFlow】tf.nn.max_pool实现池化操作
- TensorFlow 用 tf.nn.max_pool 实现最大池化操作
- TensorFlow学习---tf.nn.max_pool实现池化操作
- 【TensorFlow】tf.nn.max_pool实现池化操作
- java中使用Jedis操作Redis实例
- MyBatis中Like语句使用方式
- php 抓取页面乱码
- Android框架--Glide图片框架
- IntelliJ IDEA 2017 完美注册方法
- [译] TF-api(1) tf.nn.max_pool
- Effective C++第七章-模板和泛型编程之模板中实现继承
- Tree 【最小生成树】
- ArcGIS Web Appbuilder代码改动为不需要protal步骤初探
- jsp页面中用绝对路径${pageContext.request.contextPath}出现错误,解决办法
- 安装TC2层出现的问题
- 不管你从事哪个行业你都应该了解的:2017十大突破性科技
- 在Matplotlib图中插入LaTex公式
- 真正的沉浸式模式状态栏