turtlebot3-burger_150.png
turtlebot3-waffle-pi_150.png
turtlebot3-arm_150.png
walking-y2_150.png
turbot3-multi_150.png
turbot3-dl-ros1_150.png
turbot3-ai.png
turbot3-dl-ros2_150.png
turbot3-slam_150.png
turbot3-arm_150.png
turtlebot4-lite_150.png
turtlebot4-pro_150.png
turbot4-dl_150.png
turbot4-ai_150.png
aidriving-racebot_150.png
aidriving-autodrive_150.png
turtlebot-arm_150.png
openmanipulator-x_150.png
Home » Turbot-DL入门教程 » Turbot-DL入门教程篇-TensorFlow应用-实现两个矩阵的乘法

Turbot-DL入门教程篇-TensorFlow应用-实现两个矩阵的乘法

纠错,疑问,交流: 请进入讨论区请点击进入页面,扫码加入微信群或Q群进行交流

获取最新文章: 扫一扫加入“创客智造”公众号

Turbot-DL入门教程篇-TensorFlow应用例子-实现两个矩阵的乘法

说明:

  • 介绍如何使用TensorFlow实现两个矩阵的乘法

环境:

  • Python 3.5.2

步骤:

  • 新建文件:
vim first_tensorflow_code.py
  • 内容如下:
#!/usr/bin/env python

import tensorflow as tf

matrix1 = tf.constant([[1., 2.],[3., 4.]])
matrix2 = tf.constant([[4., 3.],[2., 1.]])

message = tf.constant('Results of matrix operations')
product = tf.matmul(matrix1, matrix2)
sess = tf.Session()
result = sess.run(product)
print(sess.run(message))
print(result)
sess.close()
  • 运行:
python3 first_tensorflow_code.py
  • 结果:
Results of matrix operations
[[ 8.    5.]
 [20.   13.]]

纠错,疑问,交流: 请进入讨论区请点击进入页面,扫码加入微信群或Q群进行交流

获取最新文章: 扫一扫加入“创客智造”公众号


标签: turbot-dl入门教程篇