实测用LSTMcell替换掉最简单的RNNcell的意义
来源:互联网 发布:剑网三明教脸型数据 编辑:程序博客网 时间:2024/06/08 08:44
import tensorflow as tffrom tensorflow.contrib import rnnx = tf.constant([[1]], dtype = tf.float32)x2 = tf.constant([[0]], dtype = tf.float32)rnn_cell = rnn.BasicRNNCell(2)lstm_cell = rnn.BasicLSTMCell(2)outputs1, states1 = rnn.static_rnn(rnn_cell, [x,x2,x2,x2,x2,x2,x2,x2,x2], dtype=tf.float32)outputs2, states2 = rnn.static_rnn(lstm_cell, [x,x2,x2,x2,x2,x2,x2,x2,x2], dtype=tf.float32)init = tf.global_variables_initializer()with tf.Session() as sess: sess.run(init) outouts_print1 = sess.run(outputs1) states_print1 = sess.run(states1) print(outouts_print1) outouts_print2 = sess.run(outputs2) states_print2 = sess.run(states2) print(outouts_print2)
print结果:
[array([[-0.72937429, 0.54721737]], dtype=float32),
array([[-0.06861426, 0.71071303]], dtype=float32),
array([[ 0.47969401, 0.19322841]], dtype=float32),
array([[ 0.45349428, -0.45451662]], dtype=float32),
array([[-0.04894456, -0.51678276]], dtype=float32),
array([[-0.42092162, -0.03447074]], dtype=float32),
array([[-0.31019336, 0.42457983]], dtype=float32),
array([[ 0.12409887, 0.38893288]], dtype=float32),
array([[ 0.3786993 , -0.06912003]], dtype=float32)]
[array([[-0.04175898, 0.12050378]], dtype=float32),
array([[-0.03201877, 0.08375908]], dtype=float32),
array([[-0.0199711 , 0.05475891]], dtype=float32),
array([[-0.01223832, 0.0354035 ]], dtype=float32),
array([[-0.00733993, 0.02265788]], dtype=float32),
array([[-0.00429717, 0.01438016]], dtype=float32),
array([[-0.0024411, 0.0090563]], dtype=float32),
array([[-0.0013303 , 0.00565884]], dtype=float32),
array([[-0.00068016, 0.00350584]], dtype=float32)]
可见最简单的RNNcell的每次output之间没有任何规律可言,而LSTMcell的每次output表现了信息在有规律的减弱
- 实测用LSTMcell替换掉最简单的RNNcell的意义
- tensorflow中RNNcell源码分析以及自定义RNNCell的方法
- Tensorflow RNN源代码解析笔记1:RNNCell的基本实现
- 用函数实测字符串的长度
- 一些简单符号的意义
- WORD的简单替换
- 多线程意义最通俗的总结
- 串口的波特率实测【多图】
- 实测linux的sleep问题
- 劲爆!实测目前最火的人脸识别技术(百度、腾讯、微软、旷视、虹软)
- 简单的链接背景替换
- 【sed】替换的简单用法
- Vim简单的查找替换
- 如此简单而又意义的Flash
- IOC的简单实现及其意义.
- 简单谈谈使用SSH的优点、意义
- Sql Server2005用Row_Number分页存储过程的性能实测
- Sql Server2005用Row_Number分页存储过程的性能实测
- 2017 一季度全球最畅销手机前5名
- impdp参数+impdp交互模式的命令列表
- spark sql 读取指定json字段
- 不可实例化的类
- 浙大玉泉Ubuntu14.04/16.04有线网配置
- 实测用LSTMcell替换掉最简单的RNNcell的意义
- fig10.6
- Oracle分页查询Sql语句例子
- 自己设计编程strcmp
- Linux下scp的用法
- 初识Maven
- Android 7.0自动安装
- Web页面中调用迅雷进行单文件和批量下载
- 蓝桥杯 BASIC-16 基础练习 分解质因数