TensorFlow学习之会话Sesstion()和交互会话InterativeSesstion()

来源:互联网 发布:simcms二手车源码 编辑:程序博客网 时间:2024/06/05 18:34

今天学习tensorflow时发现除了Session()外,竟然还有个InteractiveSession()。这就让我这个初学者又开始抓耳挠腮的想了,这两者有什么不同呢,还要设置两个会话类型。现在将其两者的差别简单写一下,后期根据自己的学习状态及理解会不断的更新。

在教学网站上看到一段对InteractiveSession()的描述语:
One major change is the use of an InteractiveSession, which allows us to run variables without needing to constantly refer to the session object (less typing!). Code blocks below are broken into different cells. If you see a break in the code, you will need to run the previous cell first. Also, if you aren’t otherwise confident, ensure all of the code in a given block is type into a cell before you run it.

不同点1、

最为主要的一句话当属第一句:使用InteractiveSession一个主要的变化是:运行在没有指定会话对象的情况下运行变量。这是与Session()最大的不同。

不同点2、

Session()使用with..as..后可以不使用close关闭对话,而调用InteractiveSession需要在最后调用close

转载:http://blog.csdn.net/u010417185/article/details/51909462

原创粉丝点击