#tensorflow #protobuf #serde #macro #config

macro tensorflow_proto_derive

Procedural macros for tensorflow_proto

1 unstable release

0.1.0 Aug 17, 2020

#65 in #tensorflow

Download history 30/week @ 2023-12-05 137/week @ 2023-12-12 107/week @ 2023-12-19 20/week @ 2024-01-02 59/week @ 2024-01-09 37/week @ 2024-01-16 68/week @ 2024-01-23 210/week @ 2024-01-30 371/week @ 2024-02-06 485/week @ 2024-02-13 237/week @ 2024-02-20 255/week @ 2024-02-27 322/week @ 2024-03-05 171/week @ 2024-03-12 198/week @ 2024-03-19

975 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–325KB