import tensorflow as tf

    else:
      graph_def.ParseFromString(f.read())
  with graph.as_default():
    tf.import_graph_def(graph_def, name='')
    tf.io.write_graph(graph_def, '/tmp/', 'optimized_graph.pb',as_text=False)

  return graph

