tensorflow
农夫山泉2号
关于交流可以发邮件:778961303@qq.com
展开
-
tensorflow一些细节
设置GPU使用方式为按需分配gpus=tf.config.experimental.list_physical_devices('GPU')if gpus: try:#设置GPU显存占用为按需分配 for gpu in gpus: tf.config.experimental.set_memory_growth(gpu,True) logical_gpus=tf.confi...原创 2019-11-25 15:06:59 · 423 阅读 · 0 评论 -
tensorflow100天-第4天:逻辑回归
代码# coding:utf-8# zhongimport tensorflow as tf# Import MINST datafrom tensorflow.examples.tutorials.mnist import input_datamnist = input_data.read_data_sets("/tmp/data/", one_hot=True)learni...原创 2018-12-27 00:40:31 · 233 阅读 · 0 评论 -
tensorflow100天—第5天:最近邻算法
python代码import tensorflow as tf import numpy as np from tensorflow.examples.tutorials.mnist import input_datamnist = input_data.read_data_sets('/tmp/data/', one_hot=True)xtrain, ytrain = mnist....原创 2018-12-27 20:20:10 · 313 阅读 · 0 评论 -
Tensorflow100天—打印常量
import tensorflow as tfhello = tf.constant('hello, chenjun!')sess = tf.Session()print(sess.run(hello))>>>b'hello, chenjun!'原创 2018-12-24 19:28:56 · 468 阅读 · 0 评论 -
Tensorflow100天—第2天:基本运算\占位符
# 1. 使用占位符placeholderimport tensorflow as tfa = tf.placeholder(tf.int16)b = tf.placeholder(tf.int16)add = tf.add(a,b)mul = tf.multiply(a,b)with tf.Session() as sess: print('addition with vari...原创 2018-12-24 20:17:37 · 342 阅读 · 0 评论 -
tensorflow100天-第3天:线性回归
tensorflow版# tensorflow 实现线性回归import tensorflow as tfimport numpy as npimport matplotlib.pyplot as plt# plt.ion()rng = np.random# 超参数learning_rate = 0.01traing_epochs = 1000display_step = ...翻译 2018-12-25 23:58:42 · 242 阅读 · 0 评论 -
tensorflow交叉熵损失函数
在分类的时候,一般采用交叉熵损失函数,然而今天用tensorflow做分类的时候,发现采用tensorflow的自用函数,和自己写的,计算出来的结果不一样。而且采用自己实现时,我出现了loss为nan的情况# tensorflow自带loss = tf.reduce_mean( tf.nn.softmax_cross_entropy_with_logits(labels=y, logit...原创 2019-01-23 12:32:55 · 882 阅读 · 0 评论