Crates.io | tensorflow_proto |
lib.rs | tensorflow_proto |
version | 0.3.0 |
source | src |
created_at | 2020-08-08 00:36:07.769695 |
updated_at | 2021-01-11 20:06:23.111579 |
description | Rust structs for Tensorflow Protocol buffers. |
homepage | https://github.com/cpcloud/tensorflow_proto |
repository | https://github.com/cpcloud/tensorflow_proto |
max_upload_size | |
id | 274151 |
size | 481,821 |
tensorflow_proto
tensorflow_proto
is a crate that uses prost-build
to generate Rust
struct
s to be used in serialization/deserialization of protocol buffers
wherever Tensorflow uses them.
In particular, this is useful in the
tensorflow/rust
library when calling
SessionOptions::set_config
to configure Tensorflow.
Note: This crate is tested against tensorflow 1.15.2 and 2.0.0.
Add
tensorflow_proto = "0.3.0"
to your Cargo.toml
.
Serde support can be enabled using the "serde-derive"
feature:
tensorflow_proto = { version = "0.3.0", features = ["serde-derive"] }
This will add a #[derive(serde::Serialize, serde::Deserialize)]
to every generated
struct
.
You must also depend on serde
as well.
Finally, you can enable code generation for an implementation of std::convert::TryFrom
that encodes a message into a Vec<u8>
for every struct
generated by prost:
tensorflow_proto = { version = "0.3.0", features = ["convert"] }
*.proto
sourcesTo use a different version of Tensorflow protocol buffer sources, define
TENSORFLOW_PROTO_SOURCE
to be the root of a Tensorflow source tree.