graph1 = TF.Graph()
with graph1.as_default():
# 在这个代码块里使用的是新创建的graph1
d = TF.constant([[10,11],[12,13]],dtype=TF.int32)
# 此时默认的graph 就是graph1,结果是False
print(TF.get_default_graph() is default_graph)
graph2 = TF.Graph()
with graph2.as_default():
e = TF.constant([[1,2],[3,4]],dtype=TF.int32)
# 不能使用两个图中的变量进行操作
print(TF.matmul(d, e))
ValueError: Tensor(“Const:0”, shape=(2, 2), dtype=int32) must be from the same graph as Tensor(“Const:0”, shape=(2, 2), dtype=int32).