上一页 1 2 3 4 5 6 7 8 ··· 21 下一页
摘要: 将mask中所有为true的抽取出来,放到一起,这里从n维降到1维度 tensor = [[1, 2], [3, 4], [5, 6]] import numpy as np mask=np.array([[True,True],[False,True],[False,False]]) z=tf.b 阅读全文
posted @ 2019-01-16 14:40 simple_wxl 阅读(1941) 评论(0) 推荐(0) 编辑
摘要: ubuntu下将程序挂后台命令 nohup python -u main.py > test.out 2>&1 & ubunut下查看后台进程 jobs -l 阅读全文
posted @ 2019-01-16 11:54 simple_wxl 阅读(1193) 评论(0) 推荐(0) 编辑
摘要: tf.sequence_mask >>> x=[1,2,3]>>> z=tf.sequence_mask(x)>>> sess.run(z)array([[ True, False, False], [ True, True, False], [ True, True, True]]) 阅读全文
posted @ 2019-01-14 11:57 simple_wxl 阅读(1592) 评论(1) 推荐(0) 编辑
摘要: graph即tf.Graph(),session即tf.Session(),很多人经常将两者混淆,其实二者完全不是同一个东西。 graph定义了计算方式,是一些加减乘除等运算的组合,类似于一个函数。它本身不会进行任何计算,也不保存任何中间计算结果。 session用来运行一个graph,或者运行gr 阅读全文
posted @ 2019-01-13 17:47 simple_wxl 阅读(504) 评论(0) 推荐(1) 编辑
摘要: tf.nn.embedding_lookup(params, ids, partition_strategy='mod', name=None, validate_indices=True, max_norm=None) 首先通过一下一个简单的例子来了解一下tf.nn.embedding_lookup()的用法 a = tf.constant([[1,2,3],[4,5,6],[7,8,9],[... 阅读全文
posted @ 2019-01-13 14:58 simple_wxl 阅读(312) 评论(0) 推荐(0) 编辑
摘要: eg: def lazy_sum(*args): def sum(): z = 0 for i in args: z += i return z return sum 1. 闭包产生条件 要创建闭包,必须满足以下条件: 必须包含一个嵌套函数... 阅读全文
posted @ 2019-01-12 22:22 simple_wxl 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 取中间的行数作为train.txt sed -n '1000000,170910580p' train.txt > trainv1.txt 取前面的行数作为dev.txt head -1000000 train.txt > dev.txt 取后面的行数作为test.txt tail -1000000 阅读全文
posted @ 2019-01-10 16:26 simple_wxl 阅读(435) 评论(0) 推荐(0) 编辑
摘要: 例如: deftest(): withopen(r"D:/PythonCode/sequence_tagging-master/data/hhhh.txt")asfr: forlineinfr: line=line.strip() yieldline fori,xinenumerate(test()): print(i,x) 阅读全文
posted @ 2019-01-09 20:45 simple_wxl 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 调用static_rnn实际上是生成了rnn按时间序列展开之后的图。打开tensorboard你会看到sequence_length个rnn_cell stack在一起,只不过这些cell是share weight的。因此,sequence_length就和图的拓扑结构绑定在了一起,因此也就限制了每 阅读全文
posted @ 2019-01-09 16:14 simple_wxl 阅读(2197) 评论(0) 推荐(0) 编辑
摘要: 集合update方法:是把要传入的元素拆分,做为个体传入到集合中,例如: >>> a = set('boy') >>> a.update('python') >>> a set(['b', 'h', 'o', 'n', 'p', 't', 'y']) set a & set b 两个集合取交集 up 阅读全文
posted @ 2019-01-09 14:13 simple_wxl 阅读(158) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 21 下一页