code: def export_to_pb(sess, x, filename):
      pred_names = ["output"]
      tf.identity(x, name=pred_names[0])
  
      graph = graph_util.convert_variables_to_constants(
          sess, sess.graph.as_graph_def(), pred_names
      )
  
      graph = graph_util.remove_training_nodes(graph)
      path = graph_io.write_graph(graph, ".", filename, as_text=False)
      print(
          "saved the frozen graph (ready for inference) at: ", filename
      )
  
      return path
  
file_path: tf-encrypted/examples/deprecated/mnist_deep_cnn.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import os
  import sys
  import numpy
  import tensorflow
  from tensorflow.examples.tutorials.mnist import input_data
  from tensorflow.python.framework import graph_io
  from tensorflow.python.framework import graph_util
label_desc: Use image node_id 7 for calling a global function with example usage: export_to_pb(sess, x, filename) and returns: path