编程模式
命令式编程(例如torch)
容易理解,命令语句基本没有优化,C、Java、C++、python
a = 2 b = 3 c = a * b d = c + 1 print(d)
符号式编程(例如tensorflow)
涉及较多的嵌入和优化,运行速度有同比提升
import tensorflow as tf a = tf.constant(2) b = tf.constant(3) c = tf.multiply(a,b) d = tf.add(c,1) with tf.Session() as sess: print(sess.run(d))