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 ...
随机推荐
- Unix环境高级编程(二十)伪终端
1.综述 伪终端对于一个应用程序而言,看上去像一个终端,但事实上伪终端并不是一个真正的终端.从内核角度看,伪终端看起来像一个双向管道,而事实上Solaris的伪终端就是用STREAMS构建的.伪终端总 ...
- EXTJS 5 学习笔记2 - Components
1. The Components Hierachy 组件体系 2. XTypes and Lazy Instantiation xtype与延迟初始化 1) 每个compo ...
- SVN版本控制业务流程详解
http://blog.sina.com.cn/s/blog_56d8ea900100y9cf.html http://jingyan.baidu.com/article/fa4125acbf509e ...
- C# ASCII码排序
将字典变成post参数 public static string GetSignContent(IDictionary<string, string> parameters) { // 第 ...
- laravel建立一个分组控制器和分组路由
路由 Route::group(['domain' => 'laravel.8g.com','namespace' => 'Admin'],function() { Route::get( ...
- Ruby gem 更换国内源
gem sources --add http://gems.ruby-china.org/ --remove https://rubygems.org/
- Angularjs 控制器controller的作用
我们在view中给模型的一个参数name赋值 “hello world” . 这是一种简单的赋值,我们可以在视图中通过 ng 指令(以ng-开头的指令)实现了简单的赋值,如果遇到复杂的逻辑运算操作,那 ...
- MongoDB add sharding -- Just a note
1. Configure Configuration Server. 1.1. Create a directory: e.g. C:\data\dbs\config 1.2. Start confi ...
- 【Android】3.6 地图基本控制方法
分类:C#.Android.VS2015.百度地图应用: 创建日期:2016-02-04 一.简介 文件名:Demo05MapControl.cs 简介:介绍平移和缩放地图,双指操作地图,监听地图点击 ...
- XMLHttpRequest使用详解
1.什么是XMLHttpRequest XMLHttpRequest是一个浏览器接口,使得Javascript可以进行HTTP(S)通信,这就是我们熟悉的AJAX.早期,各个浏览器的实现都不同,HTM ...