MJay

Variables and Placeholders 본문

Cloud Computing/Tensorflow

Variables and Placeholders

MJSon 2019. 3. 24. 19:29

     Graphs are sets of connected nodes - vertices

The connections are referred to as edges

each node is an operation with possible inputs that can supply some output

image.png

In [1]:
import tensorflow as tf
In [2]:
n1 = tf.constant(1)
In [3]:
n2 = tf.constant(2)
In [4]:
n3 = n1 + n2
In [5]:
with tf.Session() as sess:
    result = sess.run(n3)
In [6]:
print (result)
3

n3 은 여기서 뭘까 -> Tensor 이다

In [7]:
print (tf.get_default_graph())
<tensorflow.python.framework.ops.Graph object at 0xb30d53b00>
In [8]:
g = tf.Graph()
In [9]:
print(g)
<tensorflow.python.framework.ops.Graph object at 0xb30d89080>
In [10]:
graph_one = tf.get_default_graph()
In [11]:
print(graph_one)
<tensorflow.python.framework.ops.Graph object at 0xb30d53b00>
In [12]:
graph_two = tf.Graph()
In [13]:
print(graph_two)
<tensorflow.python.framework.ops.Graph object at 0xb3109bd30>
In [15]:
with graph_two.as_default():
    print(graph_two is tf.get_default_graph())
True
In [16]:
print (graph_two is tf.get_default_graph())
False
In [ ]:
 


'Cloud Computing > Tensorflow' 카테고리의 다른 글

Variables and Placeholders  (0) 2019.04.29
ckpt 관련 유용한 commands  (0) 2019.04.01