首页 > 其他 > 详细

TensorFlow之编程模式(2)

时间:2018-09-26 22:29:36      阅读:160      评论:0      收藏:0      [点我收藏+]

主要编程模式有:

(1)命令式编程   ——   Torch

(2)符号式编程   ——   TensorFlow

 

命令式编程:

易理解,命令语句基本没优化:C,Java,C++,Python

 

符号式编程:

涉及较多的嵌入和优化,运行速度有同比提升

例如:

1 import tensorflow as tf
2 
3 a = tf.constant(2)
4 b = tf.constant(3)
5 c = tf.multiply(a, b)
6 d = tf.add(c, 1)
7 
8 with tf.Session() as sess:
9     print (sess.run(d))

 

TensorFlow之编程模式(2)

原文:https://www.cnblogs.com/xyqiu90-365/p/9710437.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!