
Tensorflow
文章平均质量分 87
张博208
知识搬运工
展开
-
AutoGraph
graph details原创 2024-05-22 10:32:49 · 1028 阅读 · 0 评论 -
将python函数转化为tensorflow图函数
tensorflow 基础转载 2024-05-22 10:30:22 · 73 阅读 · 0 评论 -
How to train a GAN model in keras?
https://medium.com/dive-into-ml-ai/using-kerass-model-fit-to-train-a-gan-model-a0f02ed6d39eIn this article, I present three different methods for training a Discriminator-generator (GAN) model using keras(v2.4.3)on a tensorflow(v2.2.0)backend. The...转载 2021-03-01 11:32:31 · 198 阅读 · 0 评论 -
tf.py_func()函数
tensorflow由于构建的是静态图,所以导致在tf.Session().run()之前是没有实际值的,因此,在网络搭建的时候,是不能对tensor进行判值操作的,即不能插入if…else…之类的代码。第二,相较于numpy array,Tensorflow中对tensor的操作接口灵活性并没有那么高,使得Tensorflow的灵活性减弱。在笔者使用Tensorflow的一年中积累的编程经验来看,扩展Tensorflow程序的灵活性,有一个重要的手段,就是使用tf.py_func接口。 接口解析代原创 2021-02-26 11:19:45 · 164 阅读 · 0 评论 -
tf.TensorArray和tf.while_loop组合使用
TensorArrayTensorArray可以看做是具有动态size功能的Tensor数组。通常都是跟while_loop或map_fn结合使用。常用方法有write(index,value):将value写入TensorArray的第index个位置 stack:将TensorArray中的值作为Tensor返回while_loopfinal_state = tf.while_loop(cond, loop_body, init_state),作用是循环处理某个变量,中间处理的结果用来转载 2020-09-08 14:15:51 · 466 阅读 · 0 评论 -
tensorflow的函数自动求导是如何实现的?
https://www.jianshu.com/p/8550efaed7f8转载 2020-06-09 10:17:38 · 346 阅读 · 0 评论 -
分布式训练 单机多卡
【分布式训练】单机多卡的正确打开方式(一):理论基础https://zhuanlan.zhihu.com/p/72939003【分布式训练】单机多卡的正确打开方式(二):TensorFlowhttps://zhuanlan.zhihu.com/p/73580663【分布式训练】单机多卡的正确打开方式(三):PyTorchhttps://zhuanlan.zhihu.com/p/74792767【分布式训练】单机多卡的正确打开方式(四):Horovodhttps://zhuanla原创 2020-05-13 15:01:00 · 550 阅读 · 0 评论 -
TensorFlow用expand_dim()来增加维度
TensorFlow中,想要维度增加一维,可以使用tf.expand_dims(input, dim, name=None)函数。当然,我们常用tf.reshape(input, shape=[])也可以达到相同效果,但是有些时候在构建图的过程中,placeholder没有被feed具体的值,这时就会包下面的错误:TypeError: Expected binary or unicode stri...转载 2018-12-10 14:13:49 · 1901 阅读 · 0 评论 -
tf.expand_dims和tf.squeeze函数
tf.expand_dims()Functiontf.expand_dims(input, axis=None, name=None, dim=None)Inserts a dimension of 1 into a tensor’s shape. 在第axis位置增加一个维度Given a tensor input, this operation inserts a dimen...转载 2018-12-10 14:12:30 · 317 阅读 · 0 评论 -
tensorflow gfile文件操作详解
一、gfile模块是什么 gfile模块定义在tensorflow/python/platform/gfile.py,但其源代码实现主要位于tensorflow/tensorflow/python/lib/io/file_io.py,那么gfile模块主要功能是什么呢?google上的定义为:翻译过来为:没有线程锁的文件I / O操作包装器...对于TensorFlow的tf...转载 2018-12-10 11:12:59 · 302 阅读 · 0 评论 -
tensorflow的reshape操作tf.reshape()
https://blog.youkuaiyun.com/m0_37592397/article/details/78695318转载 2018-12-07 12:07:23 · 405 阅读 · 0 评论 -
Tensorflow实战Google深度学习框架 笔记
1. 定义两个不同的图import tensorflow as tfg1 = tf.Graph()with g1.as_default(): v = tf.get_variable("v", [1], initializer = tf.zeros_initializer) # 设置初始值为0g2 = tf.Graph()with g2.as_default(): v原创 2017-09-28 18:16:48 · 2113 阅读 · 1 评论 -
利用卷积神经网络实现图像风格迁移
相信很多人都对之前大名鼎鼎的 Prisma 早有耳闻,Prisma 能够将一张普通的图像转换成各种艺术风格的图像,今天,我们将要介绍一下Prisma 这款软件背后的算法原理。就是发表于 2016 CVPR 一篇文章,“ Image Style Transfer Using Convolutional Neural Networks”算法的流程图主要如下:总得来说,就翻译 2017-12-27 14:14:20 · 2008 阅读 · 0 评论 -
Tensorflow:tSNE数据非线性降维
深度学习巨头之一的Hinton大神在数据降维领域有一篇经典论文Visualizing Data using t-SNE。该方法是流形(非线性)数据降维的经典,从发表至今鲜有新的降维方法能全面超越。该方法相比PCA等线性方法能有效将数据投影到低维空间并保持严格的分割界面;缺点是计算复杂度大,一般推荐先线性降维然后再用tSNE降维。python sklearn有相应的实现。我现在用Tensorfl转载 2018-02-01 10:27:06 · 1832 阅读 · 0 评论 -
生成对抗网络(GAN)原理+tensorflow代码实现
https://blog.youkuaiyun.com/Jason160918/article/details/78248066转载 2018-08-06 18:04:49 · 1417 阅读 · 1 评论 -
参数随机初始化方法:xavier_init()
https://blog.youkuaiyun.com/nini_coded/article/details/79302820转载 2018-08-07 11:40:30 · 3130 阅读 · 0 评论 -
tensorflow tf.pad解析
tf.pad的作用是填充它的表达式如下: pad( tensor, paddings, mode='CONSTANT', name=None)tensor是要填充的张量 padings 也是一个张量,代表每一维填充多少行/列,但是有一个要求它的rank一定要和tensor的rank是一样的mode 可以取三个值,分别是"CONSTAN...转载 2018-08-30 11:01:38 · 230 阅读 · 0 评论 -
tf.concat, tf.stack和tf.unstack的用法
tf.concat, tf.stack和tf.unstack的用法tf.concat相当于numpy中的np.concatenate函数,用于将两个张量在某一个维度(axis)合并起来,例如:a = tf.constant([[1,2,3],[3,4,5]]) # shape (2,3)b = tf.constant([[7,8,9],[10,11,12]]) # shape (2,3)...转载 2018-12-07 17:19:20 · 361 阅读 · 1 评论 -
tf.argmax()以及axis解析
首先,明确一点,tf.argmax可以认为就是np.argmax。tensorflow使用numpy实现的这个API。 简单的说,tf.argmax就是返回最大的那个数值所在的下标。 这个很好理解,只是tf.argmax()的参数让人有些迷惑,比如,tf.argmax(array, 1)和tf.argmax(array, 0)有啥区别呢? 这里面就涉及到一...转载 2018-12-07 10:29:36 · 161 阅读 · 0 评论 -
Tensorflow 实战 笔记
TensorFlow第一步from tensorflow.examples.tutorials.mnist import input_datamnist=input_data.read_data_sets("MNIST_DATA/",one_hot=True)print(mnist.train.images.shape,mnist.train.labels.shape)print (mn原创 2017-09-17 17:33:21 · 746 阅读 · 0 评论