tensorflow学习笔记(三十七):如何自定义LSTM的initial state
来源:互联网 发布:软件测试学不会 编辑:程序博客网 时间:2024/06/05 20:52
如何初始化LSTM的state
LSTM
需要 initial state
。一般情况下,我们都会使用 lstm_cell.zero_state()
来获取 initial state
。但有些时候,我们想要给 lstm_cell
的 initial state
赋予我们想要的值,而不是简单的用 0
来初始化,那么,应该怎么做呢?
当然,当我们设置了state_is_tuple=False
的时候,是很简单的,当state_is_tuple=True
的时候,应该怎么做呢?
需要用到LSTMStateTuple
LSTMStateTuple(c ,h)
可以把 LSTMStateTuple()
看做一个op
from tensorflow.contrib.rnn.python.ops.core_rnn_cell_impl import LSTMStateTuple...c_state = ...h_state = ...# c_state , h_state 都为Tensorinitial_state = LSTMStateTuple(c_state, h_state)
当然,GRU
就没有这么麻烦了,因为GRU
没有两个state
。
1 0
- tensorflow学习笔记(三十七):如何自定义LSTM的initial state
- 自学笔记:LSTM理论联系实际的TENSORFLOW代码研究, state和ouput的数据结构
- tensorflow学习笔记(六):LSTM 与 GRU
- tensorflow学习笔记(六):LSTM 与 GRU
- TensorFlow学习笔记(1):LSTM相关代码
- TensorFlow学习笔记9:LSTM搭建
- tensorflow学习笔记:LSTM 与 GRU
- 学习Tensorflow的LSTM的RNN例子
- 我对LSTM学习的整理--Tensorflow
- LSTM学习总结(Based tensorflow)
- tensorflow中lstm学习
- TensorFlow实现经典深度学习网络(6):TensorFlow实现基于LSTM的语言模型
- 《白话深度学习与Tensorflow》学习笔记(3)HMM RNN LSTM
- 软件工程视频学习笔记(三十七)
- 信息安全工程师 学习笔记(三十七)
- Tensorflow学习笔记--MNIST LSTM分类器代码
- TensorFlow学习笔记(四):手写数字识别之LSTM网络
- lstm的tensorflow实现
- tflearn安装报错scipy not supported!
- Java客户端Jedis
- C和C++的区别 06.引用
- Caffe源码中Solver文件分析
- Win10 内置Intel AC-3165无法开启热点 解决
- tensorflow学习笔记(三十七):如何自定义LSTM的initial state
- jQuery的 $.ajax防止重复提交的两种方法(推荐)
- 杂项(三)
- spring-boot websocket 配置和实现(包括html)
- git常见用法
- 使用Workbench使用将excel文件导入mysql
- iOS 手机号码 身份证号码验证
- swift 定时器
- spring boot 入门(一):IntelliJ IDEA 实现hello world