- 博客(11)
- 收藏
- 关注
原创 流畅的python笔记2.2 列表推导式和生成器表达式
1.列表推导式#coding=utf-8\colors = ['black', 'white']sizes = ['S', 'M', 'L']tshirts = [(color, size) for color in colors for size in sizes]print(tshirts) 当列表推导式中有多个for时,按如下顺序生成列表:[('black', 'S'), (
2017-09-08 21:50:26 386
原创 流畅的python笔记1.2
1.2 如何使用特殊方法首先创建类:#coding=utf-8\from math import hypotclass Vector: def __init__(self, x=0, y=0): self.x = x self.y = y #pythonz中有一个内置函数repr,能将一个对象以字符串的形式表达出来以便辨认 def
2017-09-05 22:18:03 411
原创 流畅的python笔记1.1
1.1 一摞python风格的纸牌首先,创建纸牌类:#coding=utf-8\import collections#利用collections.namedtuple创建一个类,名字叫Card,类中只有属性没有方法,#含有属性‘rank’,‘suit’Card = collections.namedtuple('Card', ['rank', 'suit'])class Fr
2017-09-04 20:44:53 744
原创 rnn decoder
1.rnn_decoderdef _extract_argmax_and_embed(embedding, output_projection=None, update_embedding=True): """Get a loop_function that extrac
2017-08-31 15:18:53 1061
原创 pure seq2seq
1.pure seq2seqenc_inputs = tf.placeholder( tf.int32, shape=[None, enc_sentence_length], name='input_sentences') #enc_sentence_length:为encoder端的time_setp数sequence_lengths = t
2017-08-31 14:50:14 333
原创 关于多gpu测试的疑问
1.首先保存模型以及值:import tensorflow as tfinput = tf.placeholder(tf.float32, [], 'input')with tf.name_scope('hans'): weights = tf.get_variable('weights', [], tf.float32, tf.ones_initializer(tf.floa
2017-08-19 00:02:47 786
原创 存储与读取变量
1.存储模型并且指定存储的变量#coding=utf-8import tensorflow as tfx = tf.placeholder(shape=[1], dtype=tf.float32, name='xx')variable_0 = tf.get_variable('v0', [1], tf.float32, initializer=tf.random_normal_ini
2017-08-16 22:29:41 304
原创 建立与读取.pb文件
#coding=utf-8import tensorflow as tffrom tensorflow.python.framework import graph_utilx = tf.placeholder(shape=[1], dtype=tf.float32, name='x')varibale_1 = tf.get_variable('v1', [1], tf.float32,
2017-08-16 21:58:17 5990
原创 从collection中取op
#coding=utf-8import tensorflow as tfwith tf.name_scope("hello") as name_scope: arr1 = tf.get_variable("arr1", shape=[2,10],dtype=tf.float32) a = tf.Variable(0,name='a')arr2 = tf.get_varia
2017-08-16 17:10:10 353
原创 用tensorflow创建文件目录以及删除目录下所有内容
#coding=utf-8import tensorflow as tftf.app.flags.DEFINE_string('checkpoint_path', 'E:/E/test/src/checkpoint', '')tf.app.flags.DEFINE_boolean('restore', False, 'whether to resotre from checkpoint')
2017-08-16 15:30:37 1682 1
转载 tensorflow学习1
1.图的创建与选择import tensorflow as tfg1 = tf.Graph()with g1.as_default(): v = tf.get_variable("v", [1], initializer = tf.zeros_initializer()) # 设置初始值为0g2 = tf.Graph()with g2.as_default():
2017-07-28 22:02:38 205
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人