When saving a graph in tensorflow
tf.train.write_graph(
graph_or_graph_def,
logdir,
name,
as_text=True
)
There is this flag:
as_text
: If True
, writes the graph as an ASCII proto.
I found out that if it is False
it saves the graph as a binary proto.
- My question is what is the difference between those two protos?
- And why is there a difference?
- Do they have advantages over another?
Thanks to a comment this question can be answered (text is from here)
Text or Binary?
There are actually two different formats that a ProtoBuf can be saved in.
TextFormat
is a human-readable form, which makes it nice for debugging and editing, but can get large when there's numerical data like weights stored in it. You can see a small example of that in graph_run_run2.pbtxt.
Binary Format
files are a lot smaller than their text equivalents, even though they're not as readable for us. In this script, we ask the user to supply a flag indicating whether the input file is binary or text, so we know the right function to call. You can find an example of a large binary file inside the inception_v3 archive, as inception_v3_2016_08_28_frozen.pb.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With