tensorflow: tensor 沿着graph 传递闭包完成flow的过程。

简单运算:

import tensorflow as tf

# Build a graph.
a = tf.constant([1.0, 2.0])
b = tf.constant([3.0, 4.0])
c = a * b

# Launch the graph in a session.
sess = tf.Session()

# Evaluate the tensor 'c'.
print sess.run(c)
sess.close()

  session 中有资源如variable等。不需要时就要释放。 使用session.close(), with tf.Session() 创建上下文来执行自动释放。

Session 类的构造函数: tf.Session.__init__(target='',graph=None,config=None)

 

线性回归:

 

相关文章:

  • 2021-09-04
  • 2022-01-09
  • 2021-05-14
  • 2021-07-17
  • 2021-12-13
  • 2022-01-23
  • 2021-04-05
  • 2021-04-07
猜你喜欢
  • 2021-12-06
  • 2021-11-28
  • 2022-01-27
相关资源
相似解决方案