File indexing completed on 2023-03-17 11:16:48
0001
0002
0003 """
0004 Test script that reads the constant graph created by "createconstantgraph.py".
0005 """
0006
0007 import os
0008 import sys
0009
0010 import cmsml
0011
0012
0013
0014 tf, tf1, tf_version = cmsml.tensorflow.import_tf()
0015 tf = tf1
0016 tf.disable_eager_execution()
0017
0018
0019 if len(sys.argv) >= 2:
0020 datadir = sys.argv[1]
0021 else:
0022 thisdir = os.path.dirname(os.path.abspath(__file__))
0023 datadir = os.path.join(os.path.dirname(thisdir), "bin", "data")
0024
0025
0026 graph_path = os.path.join(datadir, "constantgraph.pb")
0027 graph, sess = cmsml.tensorflow.load_graph(graph_path, create_session=True)
0028 print(sess.run("output:0", feed_dict={"scale:0": 1.0, "input:0": [range(10)]})[0][0])