def save():
    with tf.Graph().as_default() as g:
        x = tf.placeholder(tf.float32, name='input')
        a = tf.Variable(5.0)
        res: tf.Tensor = tf.multiply(a, x, name='mul')
    with tf.Session(graph=g) as sess:
        sess.run(tf.global_variables_initializer())
        g: tf.Graph = tf.get_default_graph()
        gdef = g.as_graph_def()
        gdef = tf.graph_util.convert_variables_to_constants(sess, gdef, ['mul'], variable_names_whitelist=None, variable_names_blacklist=None)
        tf.train.write_graph(gdef, logdir='/tmp/k', name='test')
def save():
    with tf.Graph().as_default() as g:
        x = tf.placeholder(tf.float32, name='input')
        a = tf.Variable(5.0)
        res: tf.Tensor = tf.multiply(a, x, name='mul')
    with tf.Session(graph=g) as sess:
        sess.run(tf.global_variables_initializer())
        g: tf.Graph = tf.get_default_graph()
        gdef = g.as_graph_def()
        gdef = tf.graph_util.convert_variables_to_constants(sess, gdef, ['mul'], variable_names_whitelist=None, variable_names_blacklist=None)
        tf.train.write_graph(gdef, logdir='/tmp/k', name='test')