博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
tensorflow-1day入门
阅读量:4704 次
发布时间:2019-06-10

本文共 978 字,大约阅读时间需要 3 分钟。

张量表示数据,计算图描述神经网络的计算过程(不进行计算,只是描述过程),然后会话执行计算图,

张量(tensor) 就是多维数组        阶:就是张量的维度

 

数据类型有float32和int32类型

1 import tensorflow 2 #定义两个常量a与b 3 a=tensorflow.constant([[1.0,2.0]]) #一行两列张量 4 b=tensorflow.constant([[3.0],[4.0]])#两行一列张量 5 #搭建计算图 6 result=tensorflow.matmul(a,b)# 矩阵乘法 7 #打印计算图 8 print(result) 9 #会话计算结果10 with tensorflow.Session() as sess:11     print(sess.run(result))

 

  运行结果:

Tensor("MatMul:0", shape=(1, 1), dtype=float32)

2018-10-31 13:48:12.165633: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2018-10-31 13:48:12.194026: I tensorflow/core/common_runtime/process_util.cc:69] Creating new thread pool with default inter op setting: 6. Tune using inter_op_parallelism_threads for best performance.
[[11.]]

  其中红色部分的警告可以忽略,貌似是因为我有一些支持加速的指令没有使用

  MatMul:节点名 0:第0个输出

  shape:维度  1表示一位数组长度1

  dtype:数据类型 为float32

  [[11.]]计算结果

转载于:https://www.cnblogs.com/yang295513/p/9882355.html

你可能感兴趣的文章
《hello--world团队》第六次作业:团队项目系统设计改进与详细设计
查看>>
JFreeChart生成饼形图(3)11 (转自 JSP开发技术大全)
查看>>
C#中的文件导出大全
查看>>
web 项目中添加ico 图标
查看>>
apache commons jar下载地址
查看>>
linux笔记:无线网络已连接,但无法上网
查看>>
js 操作<input type="hidden" runnat="server" id="month">服务器控件
查看>>
raid10
查看>>
网络通信和TCP详解
查看>>
CPU、内存、硬盘和主板的关系
查看>>
简单后台管理系统框架--HTML练手项目2【Frameset】
查看>>
程序猿 面试经历
查看>>
苹果IOS 12将使您的iPhone更安全,并有更强大的黑客保护
查看>>
项目冲刺,第二天
查看>>
JarvisOJ Misc 炫酷的战队logo
查看>>
虚拟机Linux5下安装MyEclipse2014的步骤
查看>>
函数练习
查看>>
nginx 基本入门
查看>>
解决Non-resolvable parent POM: Could not find artifact 出现的问题
查看>>
MySQL的C语言接口大全
查看>>