
tensorflow
xiaoming_tju
年少不被层楼误,余生不羁尽自由。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
tensorflow中tf.cast()用法
tf.cast(x, dtype, name=None)将x的数据格式转化成dtype数据类型.例如,原来x的数据格式是bool.参数x:输入dtype:转换目标类型name:名称返回:Tensorimport tensorflow as tfa = tf.Variable([1.0, 1.3, 2.1, 3.41, 4.51])b = tf.cast(a, dtype=t...原创 2019-03-22 22:59:49 · 479 阅读 · 0 评论 -
tensorflow中tf.reduce_mean()
1.作用tf.reduce_mean函数的作用是:计算张量tensor沿着指定的数轴(tensor的某一维度)上的的平均值,主要用作降维或者计算tensor(图像)的平均值。2.表达式reduce_mean(input_tensor, axis=None, keep_dims=False, name=None)第...原创 2019-03-22 23:12:19 · 406 阅读 · 0 评论 -
tf.random函数汇总
1、输出服从正太分布random_normal(shape, mean=0.0, stddev=1.0, dtype=tf.float32)shape:一个一维整数张量或Python数组。代表张量的形状。mean:数据类型为dtype的张量值或Python值。是正态分布的均值。stddev:数据类型为dtype的张量值或Python值。是正态分布的标准差。举例:import t...原创 2019-03-24 10:00:36 · 1211 阅读 · 0 评论 -
tensorflow简单神经网络预测MNIST数据集
from tensorflow.examples.tutorials.mnist import input_dataimport tensorflow as tffile = "./MNIST"mnist = input_data.read_data_sets(file, one_hot=True)# 模型的输入和输出'''模型的输入x是一个22维的浮点数张量。它的大小为shape=...原创 2019-03-24 15:48:13 · 349 阅读 · 0 评论 -
tensorflow的初始化变量函数tf.Variable()
tf.Variable(initializer, name)initializer是初始化参数,可以有tf.random_normal(),tf.ones(),tf.constant()等,name就是变量的名字import tensorflow as tfx = tf.Variable(tf.zeros([3,4]))y = tf.Variable(tf.zeros([10]))w...原创 2019-03-24 16:11:57 · 1139 阅读 · 0 评论