tf.contrib.legacy_seq2seq.basic_rnn_seq2seq 函数 example 最简单实现
来源:互联网 发布:淘宝家具店招图片 编辑:程序博客网 时间:2024/06/18 16:46
tf.contrib.legacy_seq2seq.basic_rnn_seq2seq 函数 example 最简单实现
函数文档:https://www.tensorflow.org/api_docs/python/tf/contrib/legacy_seq2seq/basic_rnn_seq2seq
import tensorflow as tfimport numpy as npsteps=10batch_size=10input_size=10encoder_inputs = tf.placeholder("float", [None, steps, input_size])decoder_inputs = tf.placeholder("float", [None, steps, input_size])en_input=np.zeros(shape=[steps,batch_size,input_size])de_input=np.zeros(shape=[steps,batch_size,input_size])cell=tf.nn.rnn_cell.BasicLSTMCell(10)def get_result(encoder_inputs,decoder_inputs,cell): encoder_inputs=tf.unstack(encoder_inputs,axis=1) decoder_inputs=tf.unstack(decoder_inputs,axis=1) result=tf.contrib.legacy_seq2seq.basic_rnn_seq2seq( encoder_inputs, decoder_inputs, cell, dtype=tf.float32, scope=None ) return resultresult=get_result(encoder_inputs,decoder_inputs,cell)init=tf.global_variables_initializer()with tf.Session() as sess: sess.run(init) result_value=sess.run(result,feed_dict={encoder_inputs:en_input,decoder_inputs:de_input}) print(result_value)
http://www.tensorflownews.com/
阅读全文
0 0
- tf.contrib.legacy_seq2seq.basic_rnn_seq2seq 函数 example 最简单实现
- tf.contrib.seq2seq.sequence_loss example:seqence loss 实例代码
- tf.contrib
- 使用tf.contrib.learn构建输入函数
- tf.nn.embedding_lookup TensorFlow embedding_lookup 函数最简单实例
- tf.contrib.slim
- tf.contrib.slim
- tf.contrib.layers.xavier_initializer
- tf.contrib.layers.embed_sequence
- Grunt Contrib Watch Example
- tf.contrib.rnn.BasicLSTMCell, tf.contrib.rnn.MultiRNNCell深度解析
- tf.contrib.learn.preprocessing.VocabularyProcessor
- tf.contrib.learn快速入门
- 05:Tensorflow高级API的进阶--利用tf.contrib.learn建立输入函数
- TensorFlow-5: 用 tf.contrib.learn 来构建输入函数
- #tensorflow学习笔记#tf.contrib.framework.get_or_create_global_step
- tensorflow之tf.contrib.learn Quickstart
- TensorFlow-4: tf.contrib.learn 快速入门
- 数据的替换
- laravel使用多个数据库连接
- C++ 函数模板 实例化和具体化
- hdu--6069--Counting Divisors
- hdu1556 Color the ball
- tf.contrib.legacy_seq2seq.basic_rnn_seq2seq 函数 example 最简单实现
- java 根据给定的日期得到给定日期的前一天的日期
- Flume使用大全之kafka source-kafka channel-hdfs
- jquery Ajax请求本地json
- Oracle基础 用户管理
- spring mvc 设置@Scope("prototype")
- 将tensorflow的backend设置为theano的backend
- python爬虫03
- 安装Levenshtein出错