TensorFlow基础笔记(0) tensorflow的基本数据类型操作
import numpy as np
import tensorflow as tf #build a graph
print("build a graph")
#生产变量tensor
a=tf.constant([[1,2],[3,4]])
b=tf.constant([[1,1],[0,1]])
#获取tensor的数据类型和张量维度
print("a.dtype",a.dtype)
print(a.get_shape())
print("type of a:",type(a)) #基本的数据运算
c=tf.matmul(a,b)
d=tf.subtract(a,b)
e=tf.add(a,b)
print("a:",a)
print("b:",b)
#construct a 'Session' to excute the graph
sess=tf.Session()
# Execute the graph and store the value that `c` represents in `result`.
print("excuted in Session")
result_a=sess.run(a)
result_a2=a.eval(session=sess)
print("result_a:\n",result_a)
print("result_a2:\n",result_a2) result_b=sess.run(b)
print("result_b:\n",result_b) result_c=sess.run(c)
print("result_c:\n",result_c) result_d=sess.run(d)
print("result_d:\n",result_d) result_e=sess.run(e)
print("result_e:\n",result_e)
#Tensors常量值函数
tf.zeros(shape, dtype=tf.float32, name=None)
tf.zeros_like(tensor, dtype=None, name=None)
tf.ones(shape, dtype=tf.float32, name=None)
tf.ones_like(tensor, dtype=None, name=None)
tf.fill(dims, value, name=None)
tf.constant(value, dtype=None, shape=None, name='Const')
TensorFlow基础笔记(0) tensorflow的基本数据类型操作的更多相关文章
- TensorFlow基础笔记(0) 参考资源学习文档
1 官方文档 https://www.tensorflow.org/api_docs/ 2 极客学院中文文档 http://www.tensorfly.cn/tfdoc/api_docs/python ...
- TensorFlow基础笔记(8) TensorFlow简单人脸识别
数据材料 这是一个小型的人脸数据库,一共有40个人,每个人有10张照片作为样本数据.这些图片都是黑白照片,意味着这些图片都只有灰度0-255,没有rgb三通道.于是我们需要对这张大图片切分成一个个的小 ...
- TensorFlow基础笔记(3) cifar10 分类学习
TensorFlow基础笔记(3) cifar10 分类学习 CIFAR-10 is a common benchmark in machine learning for image recognit ...
- tensorflow学习笔记——使用TensorFlow操作MNIST数据(1)
续集请点击我:tensorflow学习笔记——使用TensorFlow操作MNIST数据(2) 本节开始学习使用tensorflow教程,当然从最简单的MNIST开始.这怎么说呢,就好比编程入门有He ...
- tensorflow学习笔记——使用TensorFlow操作MNIST数据(2)
tensorflow学习笔记——使用TensorFlow操作MNIST数据(1) 一:神经网络知识点整理 1.1,多层:使用多层权重,例如多层全连接方式 以下定义了三个隐藏层的全连接方式的神经网络样例 ...
- TensorFlow基础笔记(13) Mobilenet训练测试mnist数据
主要是四个文件 mnist_train.py #coding: utf-8 import os import tensorflow as tf from tensorflow.examples.tut ...
- TensorFlow基础笔记(9) Tensorboard可视化显示以及查看pb meta模型文件的方法
参考: http://blog.csdn.net/l18930738887/article/details/55000008 http://www.jianshu.com/p/19bb60b52dad ...
- TensorFlow基础笔记(2) minist分类学习
(1) 最简单的神经网络分类器 # encoding: UTF-8 import tensorflow as tf from tensorflow.examples.tutorials.mnist i ...
- TensorFlow基础笔记(11) conv2D函数
#链接:http://www.jianshu.com/p/a70c1d931395 import tensorflow as tf import tensorflow.contrib.slim as ...
随机推荐
- lua学习笔记13:协程具体解释和举例
一.coroutine.create创建协程 參数是协程的主函数,返回一个thread对象 co = coroutine.create(function() print("coroutine ...
- Hibernate的like用法
直接写String sql = "from ClientInfo as a where a.client_name like '%"+ clientname+"%'&qu ...
- mysql-5.7中的innodb_buffer_pool_prefetching(read-ahead)详解
一.innodb的read-ahead是什么: 所谓的read-ahead就是innodb根据你现在访问的数据,推测出你接下来可能要访问的数据,并把它们(可能要访问的数据)读入 内存. 二.read- ...
- Spring中三种配置Bean的方式
Spring中三种配置Bean的方式分别是: 基于XML的配置方式 基于注解的配置方式 基于Java类的配置方式 一.基于XML的配置 这个很简单,所以如何使用就略掉. 二.基于注解的配置 Sprin ...
- 【Android】10.2 使用Android Support Library增强组件功能
分类:C#.Android.VS2015: 创建日期:2016-02-18 一.简介 Android Support Library提供了一些非常漂亮的附加功能,由于这些库的引用办法都差不多,所以这一 ...
- Debugging and performance,ETW
http://blogs.technet.com/b/serverandtools/ https://channel9.msdn.com/Shows/Defrag-Tools http://blogs ...
- Java experts blog
https://blogs.oracle.com/poonam/ https://blogs.oracle.com/poonam/entry/updates_to_the_java_troublesh ...
- 前端开发中Cookie那些事儿
前段时间做了项目,在前端实现中频繁的操作cookie,记录几点供大家参考! cookie操作在前端开发过程中经常遇到,当然如果只是用来存储一些简单用户数据,还是比较简单的,我们要做的可能只是设置coo ...
- Memory Analyzer tool(MAT)分析内存泄漏---理解Retained Heap、Shallow Heap、GC Root
Shallow Heap Size 指对象自身所占用的内存大小,不包含其引用的对象所占的内存大小. 1.数组类型 数组元素对象所占内存的大小总和. 2.非数组类型 对象与它所有的成员变量大小的总和.当 ...
- 在Ubuntu环境中qemu-kvm网桥的配置
在文件/etc/network/interfaces中添加以下内容 auto lo iface lo inet loopback #auto eth0 #iface eth0 inet manual ...