- 博客(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
477
原创 流畅的python笔记1.2
1.2 如何使用特殊方法 首先创建类: #coding=utf-8\ from math import hypot class Vector: def __init__(self, x=0, y=0): self.x = x self.y = y #pythonz中有一个内置函数repr,能将一个对象以字符串的形式表达出来以便辨认 def
2017-09-05 22:18:03
498
原创 流畅的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
839
原创 rnn decoder
1.rnn_decoder def _extract_argmax_and_embed(embedding, output_projection=None, update_embedding=True): """Get a loop_function that extrac
2017-08-31 15:18:53
1142
原创 pure seq2seq
1.pure seq2seq enc_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
409
原创 关于多gpu测试的疑问
1.首先保存模型以及值: import tensorflow as tf input = 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
906
原创 存储与读取变量
1.存储模型并且指定存储的变量 #coding=utf-8 import tensorflow as tf x = 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
394
原创 建立与读取.pb文件
#coding=utf-8 import tensorflow as tf from tensorflow.python.framework import graph_util x = tf.placeholder(shape=[1], dtype=tf.float32, name='x') varibale_1 = tf.get_variable('v1', [1], tf.float32,
2017-08-16 21:58:17
6182
原创 从collection中取op
#coding=utf-8 import tensorflow as tf with 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
419
原创 用tensorflow创建文件目录以及删除目录下所有内容
#coding=utf-8 import tensorflow as tf tf.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
1842
1
转载 tensorflow学习1
1.图的创建与选择 import tensorflow as tf g1 = tf.Graph() with g1.as_default(): v = tf.get_variable("v", [1], initializer = tf.zeros_initializer()) # 设置初始值为0 g2 = tf.Graph() with g2.as_default():
2017-07-28 22:02:38
282
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅