欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

Tensorflow tf.layers

发布时间:2025/7/25 编程问答 44 豆豆
生活随笔 收集整理的这篇文章主要介绍了 Tensorflow tf.layers 小编觉得挺不错的,现在分享给大家,帮大家做个参考.
import tensorflow as tf 复制代码/anaconda3/envs/py35/lib/python3.5/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.from ._conv import register_converters as _register_converters 复制代码 inputs = tf.placeholder(tf.float32, [None, 10]) 复制代码output = tf.layers.dense(inputs, 1) 复制代码output.get_shape() 复制代码TensorShape([Dimension(None), Dimension(1)]) 复制代码 inputs = tf.placeholder(tf.float32, [None, 32, 32, 3]) 复制代码output = tf.layers.conv2d(inputs, 64, 5) 复制代码output.get_shape() 复制代码TensorShape([Dimension(None), Dimension(28), Dimension(28), Dimension(64)]) 复制代码 output = tf.layers.conv2d(inputs, 64, 5, strides=(2,2), padding='same') 复制代码output.get_shape() 复制代码TensorShape([Dimension(None), Dimension(16), Dimension(16), Dimension(64)]) 复制代码 out2 = tf.layers.max_pooling2d(output, 2, 2) 复制代码out2.get_shape() 复制代码TensorShape([Dimension(None), Dimension(8), Dimension(8), Dimension(64)]) 复制代码

总结

以上是生活随笔为你收集整理的Tensorflow tf.layers的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。