1、用命令行进入tensorflow的python编程位置
C:\Users\aDreamer>activate tensorflow
(tensorflow) C:\Users\aDreamer>python
Python 3.5.2 |Continuum Analytics, Inc.| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
2、输入代码
>>> import tensorflow as tf #加载tensorflow(导入tensorflow包)
>>> m1=tf.constant([[3,3]]) #定义矩阵常量m1、m2
>>> m2=tf.constant([[2],[3]])
>>> product=tf.matmul(m1,m2) #创建矩阵乘法op,m1、m2相乘
>>> print(product) #打印op
Tensor("MatMul:0", shape=(1, 1), dtype=int32)
>>> sess=tf.Session() #创建会话

这篇博客介绍了如何入门TensorFlow,通过Python代码演示了矩阵乘法操作,并针对出现的'Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2'警告提供了两种解决方案:设置环境变量忽略警告或重新编译TensorFlow源码以兼容AVX。
最低0.47元/天 解锁文章
549

被折叠的 条评论
为什么被折叠?



