A short update on the current state of my implementation. I heard there is interest to use it to parse tensor flow models.
0.) Load the BaselineOfProtobuf from
https://github.com/zecke/pharo-protobuf1.) Generate code
Use the Google protoc to generate a descriptor set:
$ protoc -o tf.pb --include_imports tensorflow/core/framework/graph.proto
And then use this descriptor to generate code:
| descriptor nameTable generator |
descriptor := GPBFileDescriptorSet
materializeFrom: 'tf.pb' asFileReference binaryReadStream.
nameTable := GPBTypeNamesVisitor new.
nameTable customPrefix: 'TF_'.
generator := GPBGeneratingVisitor new typeNames: nameTable; targetPackage: 'Tensorflow-Definitions'.
descriptor visit: nameTable.
generator visit: descriptor.
2.) Parse a model (e.g. the inception v3 model)
TF_GraphDef materializeFrom: 'inception_v3_2016_08_28_frozen.pb' asFileReference binaryReadStream
3.) ???
I guess load it into tensorflow?
I am not sure if the endianness for the Float is correct (if not the weights are wrong so please be careful and have a look).
There are still plenty of TODOs left. JSON and TextProto parsing needs to be implemented. Working on the official regression suite is needed as well. Strict/Non-strict modes for parsing are needed as well.