import tensorflow as tf

w1= tf.Variable(tf.random_normal([2, 3], stddev=1, seed=1))
w2= tf.Variable(tf.random_normal([3, 1], stddev=1, seed=1))
x = tf.constant([[0.7, 0.9]]) a = tf.matmul(x, w1)
y = tf.matmul(a, w2) sess = tf.Session()
sess.run(w1.initializer)
sess.run(w2.initializer)
print(sess.run(y))
sess.close()

x = tf.placeholder(tf.float32, shape=(1, 2), name="input")
a = tf.matmul(x, w1)
y = tf.matmul(a, w2) sess = tf.Session() init_op = tf.global_variables_initializer()
sess.run(init_op) print(sess.run(y, feed_dict={x: [[0.7,0.9]]}))

x = tf.placeholder(tf.float32, shape=(3, 2), name="input")
a = tf.matmul(x, w1)
y = tf.matmul(a, w2) sess = tf.Session()
#使用tf.global_variables_initializer()来初始化所有的变量
init_op = tf.global_variables_initializer()
sess.run(init_op) print(sess.run(y, feed_dict={x: [[0.7,0.9],[0.1,0.4],[0.5,0.8]]}))

吴裕雄 python 神经网络——TensorFlow 三层简单神经网络的前向传播算法的更多相关文章

  1. 卷积神经网络 cnnff.m程序 中的前向传播算法 数据 分步解析

    最近在学习卷积神经网络,哎,真的是一头雾水!最后决定从阅读CNN程序下手! 程序来源于GitHub的DeepLearnToolbox 由于确实缺乏理论基础,所以,先从程序的数据流入手,虽然对高手来讲, ...

  2. 深度神经网络(DNN)模型与前向传播算法

    深度神经网络(Deep Neural Networks, 以下简称DNN)是深度学习的基础,而要理解DNN,首先我们要理解DNN模型,下面我们就对DNN的模型与前向传播算法做一个总结. 1. 从感知机 ...

  3. 卷积神经网络(CNN)前向传播算法

    在卷积神经网络(CNN)模型结构中,我们对CNN的模型结构做了总结,这里我们就在CNN的模型基础上,看看CNN的前向传播算法是什么样子的.重点会和传统的DNN比较讨论. 1. 回顾CNN的结构 在上一 ...

  4. 吴裕雄 python 神经网络TensorFlow实现LeNet模型处理手写数字识别MNIST数据集

    import tensorflow as tf tf.reset_default_graph() # 配置神经网络的参数 INPUT_NODE = 784 OUTPUT_NODE = 10 IMAGE ...

  5. 吴裕雄 python 神经网络——TensorFlow训练神经网络:不使用滑动平均

    import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data INPUT_NODE = 784 ...

  6. 吴裕雄 python 神经网络——TensorFlow训练神经网络:不使用隐藏层

    import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data INPUT_NODE = 784 ...

  7. 吴裕雄 python 神经网络——TensorFlow训练神经网络:不使用激活函数

    import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data INPUT_NODE = 784 ...

  8. 吴裕雄 python 神经网络——TensorFlow训练神经网络:不使用指数衰减的学习率

    import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data INPUT_NODE = 784 ...

  9. 吴裕雄 python 神经网络——TensorFlow训练神经网络:不使用正则化

    import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data INPUT_NODE = 784 ...

随机推荐

  1. Windows常用批处理命令 CMD BAT (CMD目录操作等dir)

    Windows常用批处理 CMD BAT CMD获取文件夹下所有文件的名称并打印(输出)到指定目录 dir C:\Users\\Desktop\png\*.*/s >c:\.txt //cmd ...

  2. jQuery添加/删除元素

    jQuery append() 方法 jQuery append() 方法在被选元素的结尾插入内容(仍然该元素的内部). 追加前:<p>这是一个文本段落</p> $(" ...

  3. dojo - 相关教程

    https://blog.csdn.net/dojotoolkit/article/details/6688058

  4. count(*)、count(1)、count(column)的区别

    count(*)对行的数目进行计算,包含NULL count(column)对特定的列的值具有的行数进行计算,不包含NULL值. count()还有一种使用方式,count(1)这个用法和count( ...

  5. Go操作Elasticsearch

    文章转自   Elasticsearch Elasticsearch 下载 https://www.elastic.co/cn/start 运行 解压后cd到解压目录 ./bin/elasticsea ...

  6. 514 ,css不同选择器的权重(css层叠的规则)

    !important规则最重要,大于其它规则 行内样式规则,加1000 eg,<html>   <head>  </head>  <body>    & ...

  7. Led Candle Light - Safe, Cost-Effective, Versatile, Realistic Flame Lighting

    Candles have been used to remove light for centuries, but it took hundreds of years to make better c ...

  8. 每天进步一点点------FIR(一)

    在数字信号处理系统中,有限脉冲响应(finite impulse response,FIR)数字滤波器是一个非常重要的基本单元.近年来,由于FPGA具有高速度.高集成度和高可靠性的特点而得到快速发展. ...

  9. 博客下方有一个2D动画

    第一步 第二步 第三步 将下面一段代码放入 支持 js代码的那里  (如果没有申请是不可以使用js代码的,记得申请) <script src="https://eqcn.ajz.mie ...

  10. input file弹出框选择文件后缀限制

    在页面选择文件时的弹出框默认显示的是所有类型的文件,有时候文件太多不好选择,我们就要过滤掉不想展示的文件,这是需要用到input的accept属性,只有在type="file"才有 ...