#protobuf #tensorflow #serde #macro #config

macro tensorflow_proto_derive

Procedural macros for tensorflow_proto

1 unstable release

0.1.0 Aug 17, 2020

#66 in #tensorflow

Download history 144/week @ 2024-07-19 217/week @ 2024-07-26 436/week @ 2024-08-02 98/week @ 2024-08-09 77/week @ 2024-08-16 135/week @ 2024-08-23 75/week @ 2024-08-30 150/week @ 2024-09-06 79/week @ 2024-09-13 147/week @ 2024-09-20 137/week @ 2024-09-27 41/week @ 2024-10-04 65/week @ 2024-10-11 46/week @ 2024-10-18 40/week @ 2024-10-25 99/week @ 2024-11-01

261 downloads per month
Used in tensorflow_proto

Custom license

4KB

tensorflow_proto

Continuous Integration Crates.io docs.rs

tensorflow_proto is a crate that uses prost-build to generate Rust structs 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.

Usage

Default Features

Add

tensorflow_proto = "0.3.0"

to your Cargo.toml.

Serde Support

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.

Easy conversion to bytes

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"] }

Use custom Tensorflow *.proto sources

To use a different version of Tensorflow protocol buffer sources, define TENSORFLOW_PROTO_SOURCE to be the root of a Tensorflow source tree.

Dependencies

~0–375KB