随笔分类 -  deep learning

摘要:# from keras.models import Sequential# from keras.layers.core import Dense,Activation,Flatten#creating the Sequential model# model=Sequential()# #laye 阅读全文

posted @ 2019-08-11 17:58 happygril3 阅读(275) 评论(0) 推荐(0)

摘要:import tensorflow as tffrom tensorflow.examples.tutorials.mnist import input_datamnist=input_data.read_data_sets("MNIST_data/",one_hot=True)feature_co 阅读全文

posted @ 2019-08-11 17:57 happygril3 阅读(206) 评论(0) 推荐(0)

摘要:# from keras.models import Sequential# from keras.layers.core import Dense,Activation,Flatten#creating the Sequential model# model=Sequential()# #laye 阅读全文

posted @ 2019-08-11 17:56 happygril3 阅读(151) 评论(0) 推荐(0)

摘要:import tensorflow as tfimg1 = tf.constant(value=[[[[1],[2],[3],[4]],[[1],[2],[3],[4]],[[1],[2],[3],[4]],[[1],[2],[3],[4]]]],dtype=tf.float32)img2 = tf 阅读全文

posted @ 2019-05-29 19:04 happygril3 阅读(5652) 评论(0) 推荐(0)

摘要:import numpy as npfilter_primes = np.array([2., 3., 5., 7., 11., 13.], dtype=np.float32)x = tf.constant(np.arange(1, 13+1, dtype=np.float32).reshape([ 阅读全文

posted @ 2019-05-29 17:36 happygril3 阅读(155) 评论(0) 推荐(0)

摘要:import tensorflow as tftf.reset_default_graph()v1 = tf.Variable(tf.constant(1.0, shape=[1]), name="v1")v2 = tf.Variable(tf.constant(2.0), name="v2")v3 阅读全文

posted @ 2019-05-29 14:56 happygril3 阅读(330) 评论(0) 推荐(0)

摘要:tf.truncated_normal(shape, mean, stddev) :shape表示生成张量的维度,mean是均值,stddev是标准差。这个函数产生正太分布,均值和标准差自己设定。 和一般的正太分布的产生随机数据比起来,这个函数产生的随机数与均值的差距不会超过两倍的标准差。c = t 阅读全文

posted @ 2019-05-27 15:24 happygril3 阅读(238) 评论(0) 推荐(0)

摘要:tf.nn.relu ( features, name = None ) 解释:这个函数的作用是计算激活函数 relu,即 max ( features, 0 )输入参数:features: 一个Tensor。数据类型必须是:float32,float64,int3, int64,uint8,int 阅读全文

posted @ 2019-05-07 11:13 happygril3 阅读(148) 评论(0) 推荐(0)

摘要:评估操作对于测量神经网络的性能是有用的。 由于它们是不可微分的,所以它们通常只是被用在评估阶段 tf.nn.top_k(input, k, name=None) 这个函数的作用是返回 input 中每行最大的 k 个数,并且返回它们所在位置的索引。 输入参数: input: 一个张量,数据类型必须是 阅读全文

posted @ 2019-05-07 10:56 happygril3 阅读(544) 评论(0) 推荐(1)

摘要:创建一个常数张量,传入list或者数值来填充 tensor = tf.constant([1, 2, 3, 4, 5, 6, 7]) with tf.Session() as sess: print(sess.run(tensor)) a = tf.constant([1, 2, 3, 4, 5, 阅读全文

posted @ 2019-05-07 10:43 happygril3 阅读(152) 评论(0) 推荐(0)

摘要:想要增加一维,可以使用tf.expand_dims(input, dim, name=None)函数 t = np.array(np.arange(1, 1 + 30).reshape([2, 3, 5]), dtype=np.float32) array([[[ 1., 2., 3., 4., 5 阅读全文

posted @ 2019-05-07 10:17 happygril3 阅读(294) 评论(0) 推荐(0)

摘要:import tensorflow as tfimport numpy as np 1.tf.placeholder placeholder()函数是在神经网络构建graph的时候在模型中的占位,此时并没有把要输入的数据传入模型,它只会分配必要的内存。 等建立session,在会话中,运行模型的时候 阅读全文

posted @ 2019-04-30 10:30 happygril3 阅读(392) 评论(0) 推荐(0)

摘要:tf.app.flags主要用于处理命令行参数的解析工作,可以理解为一个封装好了的argparse包(argparse是一种结构化的数据存储格式,类似于Json、XML) 1.导入了argparse包 2.创建一个解析器对象,argparse中的解析器类是ArgumentParser 3.定义_Fl 阅读全文

posted @ 2019-04-22 15:32 happygril3 阅读(196) 评论(0) 推荐(0)

导航