![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
TensorFlow
Sailist
这个作者很懒,什么都没留下…
展开
-
TensorFlow入门_2_mnist数据集训练与相关函数解释
1.全部代码2.准备数据3.定义变量输入变量(图片和标签)变量预测值和loss预测结果与准确率4.初始化与训练1.全部代码from tensorflow.examples.tutorials.mnist import input_dataimport numpy as npimport tensorflow as tfimport matpl...原创 2018-04-04 12:52:51 · 262 阅读 · 0 评论 -
TensorFlow入门_3_命名空间与TensorBoard入门
整体代码代码在 TensorFlow入门_2_mnist数据集训练与相关函数解释中代码的基础之上修改了一些地方,主要是关于命名空间的from tensorflow.examples.tutorials.mnist import input_dataimport numpy as npimport tensorflow as tfimport matplotlib.pyplot a...原创 2018-04-04 13:25:06 · 487 阅读 · 0 评论 -
Keras使用使用动态LSTM/RNN
padding:def generate(mtp = 100,batch = 50):#最长时间步,词向量长度为200,batch_size = 50 origin_input = np.random.random_sample([batch,np.random.randint(mtp/2,mtp),200])#时间长随机从mtp/2-mtp选择 return pad_sequence...原创 2019-03-11 14:01:47 · 1330 阅读 · 0 评论 -
Keras 同时使用返回序列和最后的状态值 return_sequence,return_state
lstm返回3个值bilstm返回的是5个值lstm = LSTM(100,return_sequences=True,return_state=True)bilstm = Bidirectional(lstm , name = "bilstm")bl_seq,last_h1,_ = lstm(mask)bl_seq,last_h1,_,last_h2,_ = bilstm(mask)...原创 2019-03-11 14:04:20 · 667 阅读 · 0 评论 -
解释return_sequence和return_state
在TensorFlow中,递归layer无论是LSTM还是GRU,最终都是调用的RNN的call方法,返回的RNN的call方法返回的值,其实现链接位于recurrent.py对其进行简化,代码如下if self.return_sequences: output = outputselse: output = last_outputif self.return_state: ...原创 2019-03-21 20:33:34 · 1490 阅读 · 0 评论