TensorFlow基础篇
ooMelloo
☆人工智能/机器学习/深度学习工程师进击中
☆立志成为数学好编程好业务好的三好青年
☆人必有痴 而后有成
展开
-
TensorFlow基础篇(八)——tf.contrib.layers.l1regularizer()-12_regularizer(lambda)
TensorFlow中计算L1正则化和L2正则化的函数:L1正则化:tf.contrib.layers.l1regularizer(lambda)(w),它可以返回一个函数,这个函数可以计算一个给定参数的L1正则化项的值。L2正则化:tf.contrib.layers.12_regularizer(lambda)(w),可以计算L2正则化项的值 。lambda参数表示了正则化项的权重...原创 2019-11-21 20:58:40 · 1077 阅读 · 0 评论 -
TensorFlow基础篇(七)——tf.nn.conv2d()
tf.nn.conv2d是TensorFlow里面实现卷积的函数,是搭建卷积神经网络比较核心的一个方法。函数格式:tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu = Noen, name = None)参数说明:第一个参数input:指需要做卷积的输入图像,它要求是一个4维的Tensor,类型为fl...原创 2019-11-21 20:54:43 · 996 阅读 · 0 评论 -
TensorFlow基础篇(六)——tf.nn.max_pool()和tf.nn.avg_pool()
tf.nn.max_pool()和tf.nn.avg_pool()是TensorFlow中实现最大池化和平均池化的函数,在卷积神经网络中比较核心的方法。有些和卷积很相似,可以参考TensorFlow基础篇(七)——tf.nn.conv2d()(附代码详解)两个函数调用方式相同,下边讲解以tf.nn.max_pool()为例子进行加讲解。函数格式:tf.nn.max_pool(va...原创 2019-11-21 20:19:49 · 985 阅读 · 1 评论 -
TensorFlow基础篇(五)——tf.constant()
tf.constant()可以实现生成一个常量数值。tf.constant()格式为:tf.constant(value,dtype,shape,name)参数说明:value:常量值dtype:数据类型shape:表示生成常量数的维度name:数据名称下边生成一个0.1常量大小为2*2的数据:import tensorflow as tfv = tf.c...原创 2019-11-21 20:13:07 · 1062 阅读 · 1 评论 -
TensorFlow基础篇(四)—— tf.nn.relu()
tf.nn.relu()函数是将大于0的数保持不变,小于0的数置为0,函数如图1所示。ReLU函数是常用的神经网络激活函数之一。下边为ReLU例子:import tensorflow as tfv = tf.constant([-3, 5, 6, -6,9])sess = tf.Session()print('v的原始值为:', end='')print(...原创 2019-11-21 20:09:00 · 548 阅读 · 0 评论 -
TensorFlow基础篇(三)——tf.nn.softmax_cross_entropy_with_logits
tf.nn.softmax_cross_entropy_with_logits()函数是TensorFlow中计算交叉熵常用的函数。后续版本中,TensorFlow更新为:tf.nn.softmax_cross_entropy_with_logits_v2格式为:cross_entropy = tf.nn.softmax_cross_entropy_with_logits(label...原创 2019-11-21 20:01:06 · 221 阅读 · 0 评论 -
TensorFlow基础篇(二)——tf.get_variable()和tf.get_variable_scope()
1、tf.get_variable()tf.get_variable()用来创建变量时,和tf.Variable()函数的功能基本等价。v = tf.get_variable("v", shape=[1], initializer=tf.ones_initializer(1.0))v = tf.Variable(tf.constant(1.0, shape=[1]), name="v...原创 2019-11-21 19:57:00 · 561 阅读 · 0 评论 -
TensorFlow基础篇(一)——tf.train.exponential_decay()
tf.train.exponential_decay实现指数衰减率。通过这个函数,可以先使用较大的学习率来快速得到一个比较优的解,然后随着迭代的继续逐步减小学习率,使得模型在训练后期更加稳定。tf.train.exponential_decay:tf.train.exponential_decay(learning_rate, global_, decay_steps, decay_ra...原创 2019-11-21 19:53:13 · 243 阅读 · 0 评论