全部博文(510)
发布时间:2020-04-18 16:11:50
参考转自https://blog.csdn.net/u010960155/article/details/81707498实验如下import tensorflow as tfimport numpy as np def dynamic_rnn(rnn_type='lstm'): # 创建输入数据,3代表batch size,6代表输入序列的最大步长(max time),8代表每个序列的维度 X = np.random.randn(3, 6, 4.........【阅读全文】
发布时间:2020-04-17 12:30:52
Tensorflow中的交叉熵函数tensorflow中自带四种交叉熵函数,可以轻松的实现交叉熵的计算。tf.nn.softmax_cross_entropy_with_logits()tf.nn.sparse_softmax_cross_entropy_with_logits()tf.nn.sigmoid_cross_entropy_with_logits()tf.nn.weighted_cross_entropy_with_logits()注意:tensorflow交叉熵计算函数输.........【阅读全文】
发布时间:2020-04-14 08:28:43
注意区别和numpy,tf中-1不能用于维度,None 常量和变量中不能用#标量x = tf.constant(-3.0, dtype=tf.float32)print xTensor("Const:0", shape=(), dtype=float32)#标量x1 = tf.constant(-3.0,shape=[], dtype=tf.float32)print x1Tensor("Const_1:0", shape=(), dtype=float32)#向量x2 = tf.constant(-.........【阅读全文】
发布时间:2020-04-13 11:27:49
是用来保存tensorflow训练模型的,默认保存全部参数(2). 用来加载参数, :只加载存储在data中的权重和偏置项等需要训练的参数,其他一律不加载,包括meta文件中的图模型文件:.ckpt文件:是旧版本的输出saver.save(sess),相当于你的.ckpt-data“che.........【阅读全文】
发布时间:2020-04-13 10:10:42
saver.save会在"./model"中自动保存checkpoint文件MODEL_SAVE_PATH = "./model/"MODEL_NAME = "mnist_model"saver = tf.train.Saver()with tf.Session() as sess: init_op = tf.global_variables_initializer() sess.run(init_op) #加入断点续训功能 ckpt =.........【阅读全文】
AAAA888AA82013-11-21 19:26
用 sed 寫一個程式, 從 stdin 讀進, 過濾後寫到 stdout. 過濾條件如下:
將 comment 刪除.
若 commnet 刪除後為一空行, 則刪掉這行.
若為一空行, 則刪掉這行.
若 $ 後接一串數字, 則把 $ 刪除.
把 $klim 換成 $milk
把 $milk 換成 $oak
範例如下:
=======this-is-my-prompt====== cat IN-5
# this is a comment line.
$klim owes $milk $1000 # comment here
$milk wins $oak 20000
Klim owes milk $$1000 # comment
# comment line also
milk wins $oak $20000
=======this-is-my-prompt====== ./ex5 < IN-5
$milk owes $oak 1000
$oak wins $oak 20000
Klim owes milk $1000
milk wins $oak 20000
想請問這串 若 $ 後接一串數字, 則把 $ 刪除.
爬了不少聞問過不少人 都沒辦法只刪除前面的$ 請問這要怎麼打..