TensorFlow for Machine Intelligence 第五章(下)所涉及程序

PS:

今天上午把 Common Layers (下)所涉及的程序实现了一下。 

1. 介绍

该书的tensorflow 适用的版本 0.12以下的; 所涉及的API有部分参数不对;经过修改以后上传至github 中: https://github.com/Leechen2014/TensorFlow-for-Machine-Intelligence 

《TensorFlow for Machine Intelligence 第五章(下)所涉及程序》 第五章(下)5.3  所涉及的程序

有以下两点API 版本不同导致的错误:
1.1 tf.contrib.layers.fully_connected 部分

在书中的第176 节中曾经介绍到 关于  tf.contrib.layers.fully_connected 的用法: 

《TensorFlow for Machine Intelligence 第五章(下)所涉及程序》 书中第176页涉及的程序片段

fc=tf.contrib.layers.fully_connected(features,num_output_units=2)

实际上应该事这样写的: 

#此处与之前的有所不同Attempting to use uninitialized value fully_connected/biases

fc = tf.contrib.layers.fully_connected(features,num_outputs=2)

(详情参见  tensorflow API: https://www.tensorflow.org/versions/r0.12/api_docs/python/contrib.layers.html#fully_connected

1.2  tf.contrib.layers.convolution2d 部分

《TensorFlow for Machine Intelligence 第五章(下)所涉及程序》 第175页书中原文

书中的原文写的是:

conv2d=tf.contrib.layers.convolution2d(image_input,


num_output_channels=4,  #这里参数写错了

kernel_size=(1,1),activation_fn=tf.nn.relu,stride=(1,1),trainable=True)

conv2d= tf.contrib.layers.convolution2d(

image_input,

num_outputs=3,    # 注意这里: num_output_channels=3,

kernel_size=(1,1),

activation_fn=tf.nn.relu,

stride=(1,1),

trainable=True)

这部分也是可以在tensorflow API 中可以找到  

过多的话不再解释; 有问题可以留言

二 感悟

2.1 尽信书不如书。

2.2 七夕节 快乐  , 祝有情人终成眷属 (祝福ing)

    原文作者:斐波那契的数字
    原文地址: https://www.jianshu.com/p/30cf970df929
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞