-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
22 lines (17 loc) · 703 Bytes
/
test.py
File metadata and controls
22 lines (17 loc) · 703 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import TFFactory.GraphBuilder as tff
import TFFactory.Factory as factory
import tensorflow as tf
import json
if __name__ == '__main__':
placeHolder = tff.placeholder(tf.int32, shape = [3], name = 'input')
n = tff.Variable([-1, -2, -3], name = 'n1')
b = tff.Variable(initial_value = [4, 5, 6], name = 'b')
n = n + b + placeHolder
graph = json.dumps(tff.CURRENT_GRAPH)
print(graph)
graph = json.loads(graph)
compiledGraph = factory.CreateTFGraph(graph)
with tf.Session() as sess:
tf.global_variables_initializer().run(session = sess)
for k,v in compiledGraph.items():
print('{} = {}'.format(k, v.eval(feed_dict = {'input' : [1,2,3]})))