-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsecond_app.py
37 lines (27 loc) · 932 Bytes
/
second_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 7 15:18:44 2017
@author: Brilian
"""
import tensorflow as tf
state = tf.Variable(0) #this is used to handle variables
#a = tf.constant([[1,2,3], [2,5,7]])
one = tf.constant(1)
new_val = tf.add(state,one)
update = tf.assign(state,new_val)
init_op = tf.global_variables_initializer()
with tf.Session() as session:
session.run(init_op)
print (session.run(state))
for _ in range(3):
session.run(update)
print (session.run(state))
#==============================================================================
# placeholder is the place to compute the data outside tensorflow model
#==============================================================================
a = tf.placeholder(tf.float32)
b = a*2
dictionary = {a: [[1,2,5], [8,10,20]]}
with tf.Session() as sess:
result = sess.run(b, feed_dict=dictionary)#{a: 4.7})
print (result)