-
Notifications
You must be signed in to change notification settings - Fork 424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cant generate &[u8] slice for ConfigProto to SessionOptions::set_config() #393
Comments
Within the crate code, for example, you can serialize message as follow: Lines 145 to 149 in 3f3f618
On top of that, it seems to be impossible to use the above code from outside the crate since the proto module is private as you pointed. We need to make the proto module public. |
Are we planning to build an abstraction or wrapper on top of proto? If not I can patch this. |
I can't immediately answer whether the proto module should be public. For example, the above method I tried in a unit test can be generated in Python as follows: from tensorflow.core.protobuf.config_pb2 import ConfigProto, GPUOptions
gpu_options = GPUOptions(
per_process_gpu_memory_fraction=0.5
)
config = ConfigProto(gpu_options=gpu_options)
with open("config.protobuf", "wb") as f:
f.write(config.SerializeToString()) Making proto module public may take time for some reason, so please try the above method. |
I've avoided exposing the generated proto code so far because that would lock in a choice of protobuf libraries, and it wasn't clear which protobuf crate was going to "win". We might have to bite the bullet at some point, though. |
I am not familiar with protobuff enough to generate my own messages. The Documentation mentions this but just references the C++ API and not protobuff examples or Rust ways to generate this. I noticed src/protos/config.rs has some protobuff stuff (ConfigProto) that might have a trait to generate &[u8] or cast a Message type to aligned bytes to generate &[u8] but its private. Got any pointers or references?
The text was updated successfully, but these errors were encountered: