tensorflow-计算图(2)

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 23 11:26:04 2018

@author: myhaspl
"""
import tensorflow as tf
#创建图
c=tf.constant(0.0)
g=tf.Graph()
with g.as_default():
    c1=tf.constant(0.1)
g2=tf.get_default_graph()
print(g2)
tf.reset_default_graph()
g3=tf.get_default_graph()
print(g3)
print(c1.name)    

<tensorflow.python.framework.ops.Graph object at 0xb19ce09b0>
<tensorflow.python.framework.ops.Graph object at 0xb19ce0e48>
Const:0
重置计算图以及获得tensor

猜你喜欢

转载自blog.51cto.com/13959448/2334344