
tensorflow
fly_Xiaoma
技术分享,技术学习
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Field 0 in record 0 is not a valid float32
tensorflow读取csv格式数据时,有两个方面可能会导致这个错误:csv文件有表头 tf.data.TextLineDataset(data_file) 数据解格式为 0.0,但是实际上你的csv文件中可能有多个小数位方案1的解决:...原创 2019-10-15 18:03:32 · 815 阅读 · 1 评论 -
Tensorflow训练模型报错:must be from the same graph as Tensor
在训练wide&deep这个模型时报了错误,下面是错误详情:ValueError: Tensor("num_parallel_calls:0", shape=(), dtype=int32, device=/device:CPU:0) must be from the same graph as Tensor("FlatMapDataset_1:0", shape=(), dtyp...原创 2019-10-15 17:43:08 · 4123 阅读 · 0 评论 -
tf.contrib.layers.python.layers.initializers.xavier_initializer()
xavier_initializer( uniform=True, seed=None, dtype=tf.float32)该函数返回一个用于初始化权重的初始化程序 “Xavier” 。这个初始化器是用来保持每一层的梯度大小都差不多相同。参数:uniform: 使用uniform或者normal分布来随机初始化。 seed: 可以认为是用来生成随机数...原创 2019-08-30 18:06:20 · 2027 阅读 · 5 评论 -
tf.trainable_variables()
tf.trainable_variable(scope=None)返回使用 trainable=True 创建的所有变量.传递 trainable=True 时,Variable() 构造函数会自动将新变量添加到图形集合 GraphKeys.TRAINABLE_VARIABLES 中.这个便利函数返回该集合的内容.函数参数:scope:(可选)一个字符串.如果提供,对结果列表进行...原创 2019-08-30 18:18:26 · 8849 阅读 · 0 评论 -
tensorflow训练模型时打印日志小技巧
定义方法:import loggingdef get_logger(log_file): logger=logging.getLogger(log_file) logger.setLevel(logging.DEBUG) fh=logging.FileHandler(log_file) ch=logging.StreamHandler() ch.se...原创 2019-09-02 18:39:13 · 4393 阅读 · 0 评论 -
Tensorflow报错:TensorArray has size zero,but element shape [?,300] is not fully defined
报错:tensorflow.python.framework.errors_impl.UnimplementedError: 2 root error(s) found. (0) Unimplemented: TensorArray has size zero, but element shape [?,300] is not fully defined. Currently only s...原创 2019-09-19 14:46:41 · 3072 阅读 · 0 评论 -
OutOfRangeError (see above for traceback): Read less bytes than requested
Pycharm远程调用服务器时,中间网络中断过一段时间,后来在运行程序会报这个错误。一开始以为是哪一部分代码写错了,耗费 了好几个小时,后来参考别人的错误发现:pycharm同步ckpt文件时,如果中断过,后面每次pycharm自动同步的时候,会使ckpt文件残缺,即使是init_checkpoint的时候也会使初始加载的模型数据残缺目前有两种解决方法:对于在初始化模型时中断的情况,建议...原创 2019-09-29 19:02:28 · 1894 阅读 · 3 评论 -
tf.concat(values,dims,names)
tf.concat是连接两个矩阵的操作 tf.concat(concat_dim, values, name='concat')除去name参数用以指定该操作的name,与方法有关的一共两个参数:concat_dim:必须是一个数,表明在哪一维上连接如果concat_dim是0,那么在某一个shape的第一个维度上连,对应到实际,就是叠放到列上t1 = [[1,...原创 2019-10-07 21:04:45 · 324 阅读 · 0 评论 -
tf.assign(A , new_number)
tf.assign(A, new_number): 把A的值变为new_number如:A = tf.Variable(tf.constant(0.0), dtype=tf.float32)with tf.Session() as sess: sess.run(tf.initialize_all_variables()) print sess.run(A) se...原创 2019-10-07 21:07:34 · 131 阅读 · 0 评论 -
tf.get_variable()与tf.variable_scope()的区别
在tensorflow中提供了tf.get_variable函数来创建或者获取变量。当tf.get_variable用于创建变量时,则与tf.Variable的功能基本相同。#定义的基本等价v = tf.get_variable("v",shape=[1],initializer.constant_initializer(1.0))v = tf.Variable(tf.constan...原创 2019-08-30 18:01:50 · 238 阅读 · 0 评论 -
tensorflow.concat()
深度学习中,我们经常要使用的技术之一,连接连个通道作为下一个网络层的输入,那么在tensorflow怎么来实现呢?我查看了tensorflow的API,找到了这个函数:tf.concat(concat_dim, values, name='concat')concat_dim是tensor连接的方向(维度),values是要连接的tensor链表,name是操作名。cancat_dim...原创 2019-08-30 17:02:51 · 428 阅读 · 0 评论 -
张量(边)、节点(数据计算或操作)-----图(Graph)
节点(Node)--数据计算或操作 边--代表数据传输(或者张量的流动),通常一个张量代表一个n维的数组 图--节点和边组成计算图Tensorflow通常是"client-master-worker"的架构分布式系统。# -*- coding: utf-8 -*-#@Time :2019/8/18 0:09#@Author :XiaoMaimport tensorflow...原创 2019-08-18 00:24:53 · 1541 阅读 · 0 评论 -
使用TensorFlow构建神经网络
模型:单层多神经元的结构1.查看一下版本号import tensorflow as tfprint(tf.__version__)版本号: 2.调入官方数据集from tensorflow.examples.tutorials.mnist import input_data#onehot=True 使用展开的onehotmnist=input_data.re...原创 2019-02-14 20:11:07 · 243 阅读 · 0 评论 -
导入TensorFlow模块后报错''ImportError: DLL load failed: 找不到指定的模块''
亲测,有用。参考原文地址:https://www.cnblogs.com/yingchuan-hxf/p/7715575.html工具:PyCharm 模块:TensorFlow 若是你也遇到这个问题,说明你也没有理解tensorflow到底在哪里。当安装了anaconda3.6后,在PyCharm中设置interpreter,这个解释器决定了你在PyCharm环境中写的代码采...转载 2019-02-14 20:58:36 · 13216 阅读 · 3 评论 -
Window10下使用pip导入TensorFlow模块
目录1.进入命令行模式2.进入PyChram中的Setting模块3.如果是通过Anaconda安装的TensorFlow模块目前常用的window下添加TensorFlow模块有两种方式使用Anaconda添加TensorFlow 使用pip命令1.进入命令行模式pip install tensorflow会有如下图所示: 最终Tensor...原创 2019-02-14 21:38:33 · 609 阅读 · 0 评论 -
使用TensorFlow训练神经网络------手写体数字识别
目录1.导入工具库2.数据情况总览3. 数据展示4.定义用于训练的网络5.使用训练的模型做一个测试目标:使用TensorFlow实现一个简单的手写数字识别网络,并用这个网络来做个简单的识别示例设计知识:dropout、learningrate decay、初始化等。将网络最终在validation数据上的得分尽可能的提高。1.导入工具库import numpy...原创 2019-02-15 15:09:38 · 1109 阅读 · 0 评论 -
Windows10下用Anaconda3安装TensorFlow教程
原文章地址:https://www.cnblogs.com/HongjianChen/p/8385547.html本人亲测,很有用! 1. 安装好Anaconda3版本(1) 注:可以发现最新版本是Anaconda5了(没关系,下载就是了) (2) 注意安装anaconda时一定要把环境变量加入windows环境中。要没有勾选,安装完后还有手动加入。而且注意3.4版本是默认不...转载 2019-02-14 15:45:54 · 1804 阅读 · 0 评论 -
使用清华镜像下载
如安装tensorflow:pip install tensorflow-gpu==1.14 -i https://pypi.tuna.tsinghua.edu.cn/simple#或者tensorflow-gpu==2.0.0-alpha0#或者tensorflow==2.0.0原创 2019-08-13 18:50:18 · 4618 阅读 · 0 评论 -
通过MNIST数据集构建网络模型
# -*- coding: utf-8 -*-#@Time :2019/8/18 21:07#@Author :XiaoMaimport structimport gzipimport osfrom six.moves.urllib.request import urlretrieveimport numpy as npimport tensorflow as tfd...原创 2019-08-18 23:16:06 · 707 阅读 · 0 评论 -
使用CBOW构建网络模型
# 这些都是我们稍后将要使用的模块.在继续操作之前,请确保可以导入它们%matplotlib inlineimport collectionsimport mathimport numpy as npimport osimport randomimport tensorflow as tfimport bz2from matplotlib import pylabfrom s...原创 2019-08-20 00:34:04 · 775 阅读 · 1 评论 -
Tensorflow入门
符号式定义变量1.示例import tensorflow as tfimport numpy as npa=tf.Variable(np.ones(10),dtype=tf.float32,name='a')print(a)<tf.Variable 'a:0' shape=(10,) dtype=float32_ref>b=tf.Variable(np.on...原创 2019-02-14 18:44:16 · 159 阅读 · 2 评论