Skip to content

Instantly share code, notes, and snippets.

@iamsurya
Last active May 7, 2024 21:32
Show Gist options
  • Save iamsurya/b8e04bed2600df63c0674f2bfe22a6bc to your computer and use it in GitHub Desktop.
Save iamsurya/b8e04bed2600df63c0674f2bfe22a6bc to your computer and use it in GitHub Desktop.
from tensorflow.python.platform import gfile
with tf.Session() as sess:
with gfile.FastGFile('slopemodel/slopemodel.pb', 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
sess.graph.as_default()
g_in = tf.import_graph_def(graph_def)
tensor_output = sess.graph.get_tensor_by_name('import/dense_2/Sigmoid:0')
tensor_input = sess.graph.get_tensor_by_name('import/dense_1_input:0')
predictions = sess.run(tensor_output, {tensor_input:sample})
print(predictions)
@Renh-cv23
Copy link

what is sample?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment