diff --git a/.travis.yml b/.travis.yml index 2ceb482ee8..70690873a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,21 @@ sudo: true language: rust +cache: + - cargo + - directories: + - cached + rust: - stable - beta - nightly -before_install: -- curl -OL https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip -- unzip protoc-3.2.0-linux-x86_64.zip -d protoc3 -- sudo mv protoc3/bin/* /usr/local/bin/ -- sudo mv protoc3/include/* /usr/local/include/ -- pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH +env: +- RUST_BACKTRACE=1 script: -- | - travis-cargo build && - travis-cargo test && - travis-cargo bench && - travis-cargo doc -after_success: -- travis-cargo --only stable doc-upload +- cargo build +- cargo test +- cargo bench +- cargo doc matrix: allow_failures: - rust: nightly -env: - global: - - TRAVIS_CARGO_NIGHTLY_FEATURE="" - - secure: CpygK2eVbhJ0XBb6ABfoaoEdGGzKeUrv8MXHtMPMsVJjdLSfvcpdqehULeq6AXXvdHPy6Z7RWPpX8KU3S/TCHVD9MpeUvsdzduv4bi0uKTXoOqVSmQvkDihy30FOyQvvs+9floHiMeuOuFao8UVCNgpXDbRV76i/P/qYCJiYGVi1XCVV4dy+ELyo2eC5AxdEcq6TlCkiBTYDpjYqxHAoFdPQAfT3ueCNibG/W0yhDSPvp9NpeN0/CS6o/PoQPtq02b9LOJv8ktDyTt5o+hsIXqHW7uksxpNVtJSkX3gLNFZti4Ya2u3jywP3NUDbP9PoK9z429YdCaknigzvvdXggpzg3IV+F9ym/8NeSvHb8CWu8+RNM8mwIlMEfTjffNYJnuGQZ/+T390a2dyYotwKBJQARrGitbsuaTVH7NR2JjBhNwJwQCdxpUCwmMCN0byn3w9FN4OliKM4zWuKM1NJ4ex7x/p9ry3JdF0iaSRc698vTY69S+8/sogGiy2B1ew8G4+qybUiB9mH5rK69qr7o4C55GUHgYInkXmNzMkK25ljElatnac9OVUKOhBGVkScEZIn9ZXkWuXefeGBlXJVwhKdfhOA+OzKx/da3Cmjh48wIRUpSBE+015ywWKUPhnJEHYgOa57afBbhmC9akSUTkQPmeOtLJHRUXT0W2Q0R5g= diff --git a/Cargo.toml b/Cargo.toml index 6a0c2c6d02..e4bb1672da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,6 @@ authors = ["Mathieu Poumeyrol "] description = "Tiny, no-nonsense, self contained, TensorFlow inference" repository = "https://github.com/kali/tensorflow-deploy-rust" keywords = [ "TensorFlow", "NeuralNetworks" ] -build="build.rs" categories = [ "science" ] documentation = "http://www.poumeyrol.fr/tensorflow-deploy-rust/tfdeploy/index.html" @@ -26,7 +25,6 @@ ndarray = { version = "0.11" } num-traits = "0.2" protobuf = "1.4" tensorflow = { version = "0.8", optional = true } -rand = "*" [features] default = [ ] @@ -34,19 +32,15 @@ blas = ["ndarray/blas", "blas-src"] openblas = ["blas", "openblas-src", "blas-src/openblas" ] accelerate = ["blas", "accelerate-src", "blas-src/accelerate" ] -[build-dependencies] -protoc-rust = "1.4" -tempdir = "0.3" - [dev-dependencies] colored = "1" bencher = { git = "https://github.com/snipsco/bencher" } -dinghy-test = { git="https://github.com/snipsco/dinghy.git", branch="0.3"} +dinghy-test = "0.3" flate2 = "1.0" itertools = "0.7" -mio_httpc = { version = "0.6", features = [ "rtls" ] } tar = "0.4" proptest = "0.6" +reqwest = "0.8.5" [[bench]] harness = false diff --git a/README.md b/README.md index a3da18d428..d998d8ea5e 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ easily as practical to small-ish devices (think 30$ boards). # License -Note: files in the `protos` directory are copied from the +Note: files in the `protos/tensorflow` directory are copied from the [TensorFlow](https://github.com/tensorflow/tensorflow) project and are not covered by the following licence statement. diff --git a/benches/inceptionv3.rs b/benches/inceptionv3.rs index 5f56164140..4ac900530d 100644 --- a/benches/inceptionv3.rs +++ b/benches/inceptionv3.rs @@ -5,7 +5,7 @@ extern crate dinghy_test; extern crate flate2; extern crate image; extern crate itertools; -extern crate mio_httpc; +extern crate reqwest; extern crate ndarray; extern crate tar; extern crate tfdeploy; diff --git a/examples/inceptionv3.rs b/examples/inceptionv3.rs index d836ba2f2a..12fe7563ec 100644 --- a/examples/inceptionv3.rs +++ b/examples/inceptionv3.rs @@ -3,13 +3,12 @@ extern crate dinghy_test; extern crate flate2; extern crate image; extern crate itertools; -extern crate mio_httpc; +extern crate reqwest; extern crate ndarray; extern crate tar; extern crate tfdeploy; use std::{fs, io, path}; -use mio_httpc::CallBuilder; use dinghy_test::test_project_path; use tfdeploy::errors::*; @@ -34,17 +33,9 @@ fn do_download() -> Result<()> { fs::remove_dir_all(&dir_partial).unwrap(); } fs::create_dir_all(&dir_partial)?; - let url = "https://storage.googleapis.com/download.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz"; - let (resp, body) = CallBuilder::get() - .timeout_ms(50000) - .url(url) - .map_err(|e| format!("request error: {:?}", e))? - .exec() - .map_err(|e| format!("request error: {:?}", e))?; - if resp.status != 200 { - Err("Could not download inception v3")? - } - let mut archive = ::tar::Archive::new(::flate2::read::GzDecoder::new(&body[..])); + let resp = reqwest::get("https://storage.googleapis.com/download.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz") + .map_err(|e| format!("Http error: {:?}", e))?; + let mut archive = ::tar::Archive::new(::flate2::read::GzDecoder::new(resp)); archive.unpack(&dir_partial)?; fs::rename(dir_partial, dir)?; Ok(()) @@ -70,7 +61,10 @@ pub fn load_image>(p: P) -> ::tfdeploy::Matrix { } fn inception_v3_2016_08_28() -> path::PathBuf { - ::std::env::temp_dir().join("inception-v3-2016_08_28") + match ::std::env::var("TRAVIS_BUILD_DIR") { + Ok(t) => path::Path::new(&t).join("cached").join("inception-v3-2016_08_28"), + _ => ::std::env::temp_dir().join("inception-v3-2016_08_28") + } } pub fn inception_v3_2016_08_28_frozen() -> path::PathBuf { diff --git a/protos/Cargo.toml b/protos/Cargo.toml new file mode 100644 index 0000000000..a9430e7588 --- /dev/null +++ b/protos/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "protos" +version = "0.1.0" +authors = ["Mathieu Poumeyrol "] + +[dependencies] +protoc-rust = "1.5" diff --git a/build.rs b/protos/src/main.rs similarity index 66% rename from build.rs rename to protos/src/main.rs index 7b0d1ee8ea..aa3842a29b 100644 --- a/build.rs +++ b/protos/src/main.rs @@ -5,28 +5,27 @@ use std::{fs, io, path}; use std::io::{BufRead, Write}; fn main() { - let inputs: Vec = fs::read_dir("protos/tensorflow/core/framework") + let inputs: Vec = fs::read_dir("tensorflow/core/framework") .unwrap() .map(|entry| entry.unwrap().path()) .collect(); + let _ = fs::create_dir_all("target/generated"); + protoc_rust::run(protoc_rust::Args { - out_dir: &*std::env::var("OUT_DIR").unwrap(), + out_dir: "target/generated", input: &*inputs .iter() .map(|a| a.to_str().unwrap()) .collect::>(), - includes: &["protos"], + includes: &["."], }).expect("protoc"); for input in inputs { - let mut broken = - path::PathBuf::from(std::env::var("OUT_DIR").unwrap()).join(input.file_name().unwrap()); - println!("cargo:rerun-if-changed={}", input.to_str().unwrap()); + let mut broken = path::PathBuf::from("target/generated").join(input.file_name().unwrap()); let mut fixed = broken.clone(); fixed.set_extension("rs"); broken.set_extension("rs.orig"); - println!("rename {:?} {:?}", fixed, broken); fs::rename(&fixed, &broken).unwrap(); let mut f = fs::File::create(fixed).unwrap(); for line in io::BufReader::new(fs::File::open(broken).unwrap()).lines() { diff --git a/src/tfpb/attr_value.rs b/src/tfpb/attr_value.rs new file mode 100644 index 0000000000..ed49cb53db --- /dev/null +++ b/src/tfpb/attr_value.rs @@ -0,0 +1,1593 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 + + + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct AttrValue { + // message oneof groups + value: ::std::option::Option, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for AttrValue {} + +#[derive(Clone,PartialEq)] +pub enum AttrValue_oneof_value { + s(::std::vec::Vec), + i(i64), + f(f32), + b(bool), + field_type(super::types::DataType), + shape(super::tensor_shape::TensorShapeProto), + tensor(super::tensor::TensorProto), + list(AttrValue_ListValue), + func(NameAttrList), + placeholder(::std::string::String), +} + +impl AttrValue { + pub fn new() -> AttrValue { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static AttrValue { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const AttrValue, + }; + unsafe { + instance.get(AttrValue::new) + } + } + + // bytes s = 2; + + pub fn clear_s(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_s(&self) -> bool { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::s(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_s(&mut self, v: ::std::vec::Vec) { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::s(v)) + } + + // Mutable pointer to the field. + pub fn mut_s(&mut self) -> &mut ::std::vec::Vec { + if let ::std::option::Option::Some(AttrValue_oneof_value::s(_)) = self.value { + } else { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::s(::std::vec::Vec::new())); + } + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::s(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_s(&mut self) -> ::std::vec::Vec { + if self.has_s() { + match self.value.take() { + ::std::option::Option::Some(AttrValue_oneof_value::s(v)) => v, + _ => panic!(), + } + } else { + ::std::vec::Vec::new() + } + } + + pub fn get_s(&self) -> &[u8] { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::s(ref v)) => v, + _ => &[], + } + } + + // int64 i = 3; + + pub fn clear_i(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_i(&self) -> bool { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::i(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_i(&mut self, v: i64) { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::i(v)) + } + + pub fn get_i(&self) -> i64 { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::i(v)) => v, + _ => 0, + } + } + + // float f = 4; + + pub fn clear_f(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_f(&self) -> bool { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::f(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_f(&mut self, v: f32) { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::f(v)) + } + + pub fn get_f(&self) -> f32 { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::f(v)) => v, + _ => 0., + } + } + + // bool b = 5; + + pub fn clear_b(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_b(&self) -> bool { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::b(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_b(&mut self, v: bool) { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::b(v)) + } + + pub fn get_b(&self) -> bool { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::b(v)) => v, + _ => false, + } + } + + // .tensorflow.DataType type = 6; + + pub fn clear_field_type(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_field_type(&self) -> bool { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::field_type(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: super::types::DataType) { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::field_type(v)) + } + + pub fn get_field_type(&self) -> super::types::DataType { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::field_type(v)) => v, + _ => super::types::DataType::DT_INVALID, + } + } + + // .tensorflow.TensorShapeProto shape = 7; + + pub fn clear_shape(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_shape(&self) -> bool { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::shape(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_shape(&mut self, v: super::tensor_shape::TensorShapeProto) { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::shape(v)) + } + + // Mutable pointer to the field. + pub fn mut_shape(&mut self) -> &mut super::tensor_shape::TensorShapeProto { + if let ::std::option::Option::Some(AttrValue_oneof_value::shape(_)) = self.value { + } else { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::shape(super::tensor_shape::TensorShapeProto::new())); + } + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::shape(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_shape(&mut self) -> super::tensor_shape::TensorShapeProto { + if self.has_shape() { + match self.value.take() { + ::std::option::Option::Some(AttrValue_oneof_value::shape(v)) => v, + _ => panic!(), + } + } else { + super::tensor_shape::TensorShapeProto::new() + } + } + + pub fn get_shape(&self) -> &super::tensor_shape::TensorShapeProto { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::shape(ref v)) => v, + _ => super::tensor_shape::TensorShapeProto::default_instance(), + } + } + + // .tensorflow.TensorProto tensor = 8; + + pub fn clear_tensor(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_tensor(&self) -> bool { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::tensor(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_tensor(&mut self, v: super::tensor::TensorProto) { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::tensor(v)) + } + + // Mutable pointer to the field. + pub fn mut_tensor(&mut self) -> &mut super::tensor::TensorProto { + if let ::std::option::Option::Some(AttrValue_oneof_value::tensor(_)) = self.value { + } else { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::tensor(super::tensor::TensorProto::new())); + } + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::tensor(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_tensor(&mut self) -> super::tensor::TensorProto { + if self.has_tensor() { + match self.value.take() { + ::std::option::Option::Some(AttrValue_oneof_value::tensor(v)) => v, + _ => panic!(), + } + } else { + super::tensor::TensorProto::new() + } + } + + pub fn get_tensor(&self) -> &super::tensor::TensorProto { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::tensor(ref v)) => v, + _ => super::tensor::TensorProto::default_instance(), + } + } + + // .tensorflow.AttrValue.ListValue list = 1; + + pub fn clear_list(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_list(&self) -> bool { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::list(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_list(&mut self, v: AttrValue_ListValue) { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::list(v)) + } + + // Mutable pointer to the field. + pub fn mut_list(&mut self) -> &mut AttrValue_ListValue { + if let ::std::option::Option::Some(AttrValue_oneof_value::list(_)) = self.value { + } else { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::list(AttrValue_ListValue::new())); + } + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::list(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_list(&mut self) -> AttrValue_ListValue { + if self.has_list() { + match self.value.take() { + ::std::option::Option::Some(AttrValue_oneof_value::list(v)) => v, + _ => panic!(), + } + } else { + AttrValue_ListValue::new() + } + } + + pub fn get_list(&self) -> &AttrValue_ListValue { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::list(ref v)) => v, + _ => AttrValue_ListValue::default_instance(), + } + } + + // .tensorflow.NameAttrList func = 10; + + pub fn clear_func(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_func(&self) -> bool { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::func(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_func(&mut self, v: NameAttrList) { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::func(v)) + } + + // Mutable pointer to the field. + pub fn mut_func(&mut self) -> &mut NameAttrList { + if let ::std::option::Option::Some(AttrValue_oneof_value::func(_)) = self.value { + } else { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::func(NameAttrList::new())); + } + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::func(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_func(&mut self) -> NameAttrList { + if self.has_func() { + match self.value.take() { + ::std::option::Option::Some(AttrValue_oneof_value::func(v)) => v, + _ => panic!(), + } + } else { + NameAttrList::new() + } + } + + pub fn get_func(&self) -> &NameAttrList { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::func(ref v)) => v, + _ => NameAttrList::default_instance(), + } + } + + // string placeholder = 9; + + pub fn clear_placeholder(&mut self) { + self.value = ::std::option::Option::None; + } + + pub fn has_placeholder(&self) -> bool { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::placeholder(..)) => true, + _ => false, + } + } + + // Param is passed by value, moved + pub fn set_placeholder(&mut self, v: ::std::string::String) { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::placeholder(v)) + } + + // Mutable pointer to the field. + pub fn mut_placeholder(&mut self) -> &mut ::std::string::String { + if let ::std::option::Option::Some(AttrValue_oneof_value::placeholder(_)) = self.value { + } else { + self.value = ::std::option::Option::Some(AttrValue_oneof_value::placeholder(::std::string::String::new())); + } + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::placeholder(ref mut v)) => v, + _ => panic!(), + } + } + + // Take field + pub fn take_placeholder(&mut self) -> ::std::string::String { + if self.has_placeholder() { + match self.value.take() { + ::std::option::Option::Some(AttrValue_oneof_value::placeholder(v)) => v, + _ => panic!(), + } + } else { + ::std::string::String::new() + } + } + + pub fn get_placeholder(&self) -> &str { + match self.value { + ::std::option::Option::Some(AttrValue_oneof_value::placeholder(ref v)) => v, + _ => "", + } + } +} + +impl ::protobuf::Message for AttrValue { + fn is_initialized(&self) -> bool { + if let Some(AttrValue_oneof_value::shape(ref v)) = self.value { + if !v.is_initialized() { + return false; + } + } + if let Some(AttrValue_oneof_value::tensor(ref v)) = self.value { + if !v.is_initialized() { + return false; + } + } + if let Some(AttrValue_oneof_value::list(ref v)) = self.value { + if !v.is_initialized() { + return false; + } + } + if let Some(AttrValue_oneof_value::func(ref v)) = self.value { + if !v.is_initialized() { + return false; + } + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.value = ::std::option::Option::Some(AttrValue_oneof_value::s(is.read_bytes()?)); + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.value = ::std::option::Option::Some(AttrValue_oneof_value::i(is.read_int64()?)); + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeFixed32 { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.value = ::std::option::Option::Some(AttrValue_oneof_value::f(is.read_float()?)); + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.value = ::std::option::Option::Some(AttrValue_oneof_value::b(is.read_bool()?)); + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.value = ::std::option::Option::Some(AttrValue_oneof_value::field_type(is.read_enum()?)); + }, + 7 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.value = ::std::option::Option::Some(AttrValue_oneof_value::shape(is.read_message()?)); + }, + 8 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.value = ::std::option::Option::Some(AttrValue_oneof_value::tensor(is.read_message()?)); + }, + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.value = ::std::option::Option::Some(AttrValue_oneof_value::list(is.read_message()?)); + }, + 10 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.value = ::std::option::Option::Some(AttrValue_oneof_value::func(is.read_message()?)); + }, + 9 => { + if wire_type != ::protobuf::wire_format::WireTypeLengthDelimited { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + self.value = ::std::option::Option::Some(AttrValue_oneof_value::placeholder(is.read_string()?)); + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let ::std::option::Option::Some(ref v) = self.value { + match v { + &AttrValue_oneof_value::s(ref v) => { + my_size += ::protobuf::rt::bytes_size(2, &v); + }, + &AttrValue_oneof_value::i(v) => { + my_size += ::protobuf::rt::value_size(3, v, ::protobuf::wire_format::WireTypeVarint); + }, + &AttrValue_oneof_value::f(v) => { + my_size += 5; + }, + &AttrValue_oneof_value::b(v) => { + my_size += 2; + }, + &AttrValue_oneof_value::field_type(v) => { + my_size += ::protobuf::rt::enum_size(6, v); + }, + &AttrValue_oneof_value::shape(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }, + &AttrValue_oneof_value::tensor(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }, + &AttrValue_oneof_value::list(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }, + &AttrValue_oneof_value::func(ref v) => { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }, + &AttrValue_oneof_value::placeholder(ref v) => { + my_size += ::protobuf::rt::string_size(9, &v); + }, + }; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let ::std::option::Option::Some(ref v) = self.value { + match v { + &AttrValue_oneof_value::s(ref v) => { + os.write_bytes(2, v)?; + }, + &AttrValue_oneof_value::i(v) => { + os.write_int64(3, v)?; + }, + &AttrValue_oneof_value::f(v) => { + os.write_float(4, v)?; + }, + &AttrValue_oneof_value::b(v) => { + os.write_bool(5, v)?; + }, + &AttrValue_oneof_value::field_type(v) => { + os.write_enum(6, v.value())?; + }, + &AttrValue_oneof_value::shape(ref v) => { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }, + &AttrValue_oneof_value::tensor(ref v) => { + os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }, + &AttrValue_oneof_value::list(ref v) => { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }, + &AttrValue_oneof_value::func(ref v) => { + os.write_tag(10, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }, + &AttrValue_oneof_value::placeholder(ref v) => { + os.write_string(9, v)?; + }, + }; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for AttrValue { + fn new() -> AttrValue { + AttrValue::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_bytes_accessor::<_>( + "s", + AttrValue::has_s, + AttrValue::get_s, + )); + fields.push(::protobuf::reflect::accessor::make_singular_i64_accessor::<_>( + "i", + AttrValue::has_i, + AttrValue::get_i, + )); + fields.push(::protobuf::reflect::accessor::make_singular_f32_accessor::<_>( + "f", + AttrValue::has_f, + AttrValue::get_f, + )); + fields.push(::protobuf::reflect::accessor::make_singular_bool_accessor::<_>( + "b", + AttrValue::has_b, + AttrValue::get_b, + )); + fields.push(::protobuf::reflect::accessor::make_singular_enum_accessor::<_, super::types::DataType>( + "type", + AttrValue::has_field_type, + AttrValue::get_field_type, + )); + fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, super::tensor_shape::TensorShapeProto>( + "shape", + AttrValue::has_shape, + AttrValue::get_shape, + )); + fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, super::tensor::TensorProto>( + "tensor", + AttrValue::has_tensor, + AttrValue::get_tensor, + )); + fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, AttrValue_ListValue>( + "list", + AttrValue::has_list, + AttrValue::get_list, + )); + fields.push(::protobuf::reflect::accessor::make_singular_message_accessor::<_, NameAttrList>( + "func", + AttrValue::has_func, + AttrValue::get_func, + )); + fields.push(::protobuf::reflect::accessor::make_singular_string_accessor::<_>( + "placeholder", + AttrValue::has_placeholder, + AttrValue::get_placeholder, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "AttrValue", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for AttrValue { + fn clear(&mut self) { + self.clear_s(); + self.clear_i(); + self.clear_f(); + self.clear_b(); + self.clear_field_type(); + self.clear_shape(); + self.clear_tensor(); + self.clear_list(); + self.clear_func(); + self.clear_placeholder(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for AttrValue { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for AttrValue { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct AttrValue_ListValue { + // message fields + pub s: ::protobuf::RepeatedField<::std::vec::Vec>, + pub i: ::std::vec::Vec, + pub f: ::std::vec::Vec, + pub b: ::std::vec::Vec, + pub field_type: ::std::vec::Vec, + pub shape: ::protobuf::RepeatedField, + pub tensor: ::protobuf::RepeatedField, + pub func: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for AttrValue_ListValue {} + +impl AttrValue_ListValue { + pub fn new() -> AttrValue_ListValue { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static AttrValue_ListValue { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const AttrValue_ListValue, + }; + unsafe { + instance.get(AttrValue_ListValue::new) + } + } + + // repeated bytes s = 2; + + pub fn clear_s(&mut self) { + self.s.clear(); + } + + // Param is passed by value, moved + pub fn set_s(&mut self, v: ::protobuf::RepeatedField<::std::vec::Vec>) { + self.s = v; + } + + // Mutable pointer to the field. + pub fn mut_s(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { + &mut self.s + } + + // Take field + pub fn take_s(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec> { + ::std::mem::replace(&mut self.s, ::protobuf::RepeatedField::new()) + } + + pub fn get_s(&self) -> &[::std::vec::Vec] { + &self.s + } + + fn get_s_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { + &self.s + } + + fn mut_s_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { + &mut self.s + } + + // repeated int64 i = 3; + + pub fn clear_i(&mut self) { + self.i.clear(); + } + + // Param is passed by value, moved + pub fn set_i(&mut self, v: ::std::vec::Vec) { + self.i = v; + } + + // Mutable pointer to the field. + pub fn mut_i(&mut self) -> &mut ::std::vec::Vec { + &mut self.i + } + + // Take field + pub fn take_i(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.i, ::std::vec::Vec::new()) + } + + pub fn get_i(&self) -> &[i64] { + &self.i + } + + fn get_i_for_reflect(&self) -> &::std::vec::Vec { + &self.i + } + + fn mut_i_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.i + } + + // repeated float f = 4; + + pub fn clear_f(&mut self) { + self.f.clear(); + } + + // Param is passed by value, moved + pub fn set_f(&mut self, v: ::std::vec::Vec) { + self.f = v; + } + + // Mutable pointer to the field. + pub fn mut_f(&mut self) -> &mut ::std::vec::Vec { + &mut self.f + } + + // Take field + pub fn take_f(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.f, ::std::vec::Vec::new()) + } + + pub fn get_f(&self) -> &[f32] { + &self.f + } + + fn get_f_for_reflect(&self) -> &::std::vec::Vec { + &self.f + } + + fn mut_f_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.f + } + + // repeated bool b = 5; + + pub fn clear_b(&mut self) { + self.b.clear(); + } + + // Param is passed by value, moved + pub fn set_b(&mut self, v: ::std::vec::Vec) { + self.b = v; + } + + // Mutable pointer to the field. + pub fn mut_b(&mut self) -> &mut ::std::vec::Vec { + &mut self.b + } + + // Take field + pub fn take_b(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.b, ::std::vec::Vec::new()) + } + + pub fn get_b(&self) -> &[bool] { + &self.b + } + + fn get_b_for_reflect(&self) -> &::std::vec::Vec { + &self.b + } + + fn mut_b_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.b + } + + // repeated .tensorflow.DataType type = 6; + + pub fn clear_field_type(&mut self) { + self.field_type.clear(); + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: ::std::vec::Vec) { + self.field_type = v; + } + + // Mutable pointer to the field. + pub fn mut_field_type(&mut self) -> &mut ::std::vec::Vec { + &mut self.field_type + } + + // Take field + pub fn take_field_type(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.field_type, ::std::vec::Vec::new()) + } + + pub fn get_field_type(&self) -> &[super::types::DataType] { + &self.field_type + } + + fn get_field_type_for_reflect(&self) -> &::std::vec::Vec { + &self.field_type + } + + fn mut_field_type_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.field_type + } + + // repeated .tensorflow.TensorShapeProto shape = 7; + + pub fn clear_shape(&mut self) { + self.shape.clear(); + } + + // Param is passed by value, moved + pub fn set_shape(&mut self, v: ::protobuf::RepeatedField) { + self.shape = v; + } + + // Mutable pointer to the field. + pub fn mut_shape(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.shape + } + + // Take field + pub fn take_shape(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.shape, ::protobuf::RepeatedField::new()) + } + + pub fn get_shape(&self) -> &[super::tensor_shape::TensorShapeProto] { + &self.shape + } + + fn get_shape_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.shape + } + + fn mut_shape_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.shape + } + + // repeated .tensorflow.TensorProto tensor = 8; + + pub fn clear_tensor(&mut self) { + self.tensor.clear(); + } + + // Param is passed by value, moved + pub fn set_tensor(&mut self, v: ::protobuf::RepeatedField) { + self.tensor = v; + } + + // Mutable pointer to the field. + pub fn mut_tensor(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.tensor + } + + // Take field + pub fn take_tensor(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.tensor, ::protobuf::RepeatedField::new()) + } + + pub fn get_tensor(&self) -> &[super::tensor::TensorProto] { + &self.tensor + } + + fn get_tensor_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.tensor + } + + fn mut_tensor_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.tensor + } + + // repeated .tensorflow.NameAttrList func = 9; + + pub fn clear_func(&mut self) { + self.func.clear(); + } + + // Param is passed by value, moved + pub fn set_func(&mut self, v: ::protobuf::RepeatedField) { + self.func = v; + } + + // Mutable pointer to the field. + pub fn mut_func(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.func + } + + // Take field + pub fn take_func(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.func, ::protobuf::RepeatedField::new()) + } + + pub fn get_func(&self) -> &[NameAttrList] { + &self.func + } + + fn get_func_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.func + } + + fn mut_func_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.func + } +} + +impl ::protobuf::Message for AttrValue_ListValue { + fn is_initialized(&self) -> bool { + for v in &self.shape { + if !v.is_initialized() { + return false; + } + }; + for v in &self.tensor { + if !v.is_initialized() { + return false; + } + }; + for v in &self.func { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 2 => { + ::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.s)?; + }, + 3 => { + ::protobuf::rt::read_repeated_int64_into(wire_type, is, &mut self.i)?; + }, + 4 => { + ::protobuf::rt::read_repeated_float_into(wire_type, is, &mut self.f)?; + }, + 5 => { + ::protobuf::rt::read_repeated_bool_into(wire_type, is, &mut self.b)?; + }, + 6 => { + ::protobuf::rt::read_repeated_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 6, &mut self.unknown_fields)? + }, + 7 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.shape)?; + }, + 8 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.tensor)?; + }, + 9 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.func)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.s { + my_size += ::protobuf::rt::bytes_size(2, &value); + }; + if !self.i.is_empty() { + my_size += ::protobuf::rt::vec_packed_varint_size(3, &self.i); + } + if !self.f.is_empty() { + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size((self.f.len() * 4) as u32) + (self.f.len() * 4) as u32; + } + if !self.b.is_empty() { + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size((self.b.len() * 1) as u32) + (self.b.len() * 1) as u32; + } + if !self.field_type.is_empty() { + my_size += ::protobuf::rt::vec_packed_enum_size(6, &self.field_type); + } + for value in &self.shape { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.tensor { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.func { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.s { + os.write_bytes(2, &v)?; + }; + if !self.i.is_empty() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + // TODO: Data size is computed again, it should be cached + os.write_raw_varint32(::protobuf::rt::vec_packed_varint_data_size(&self.i))?; + for v in &self.i { + os.write_int64_no_tag(*v)?; + }; + } + if !self.f.is_empty() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + // TODO: Data size is computed again, it should be cached + os.write_raw_varint32((self.f.len() * 4) as u32)?; + for v in &self.f { + os.write_float_no_tag(*v)?; + }; + } + if !self.b.is_empty() { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + // TODO: Data size is computed again, it should be cached + os.write_raw_varint32((self.b.len() * 1) as u32)?; + for v in &self.b { + os.write_bool_no_tag(*v)?; + }; + } + if !self.field_type.is_empty() { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + // TODO: Data size is computed again, it should be cached + os.write_raw_varint32(::protobuf::rt::vec_packed_enum_data_size(&self.field_type))?; + for v in &self.field_type { + os.write_enum_no_tag(v.value())?; + }; + } + for v in &self.shape { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.tensor { + os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.func { + os.write_tag(9, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for AttrValue_ListValue { + fn new() -> AttrValue_ListValue { + AttrValue_ListValue::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "s", + AttrValue_ListValue::get_s_for_reflect, + AttrValue_ListValue::mut_s_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "i", + AttrValue_ListValue::get_i_for_reflect, + AttrValue_ListValue::mut_i_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeFloat>( + "f", + AttrValue_ListValue::get_f_for_reflect, + AttrValue_ListValue::mut_f_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "b", + AttrValue_ListValue::get_b_for_reflect, + AttrValue_ListValue::mut_b_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "type", + AttrValue_ListValue::get_field_type_for_reflect, + AttrValue_ListValue::mut_field_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "shape", + AttrValue_ListValue::get_shape_for_reflect, + AttrValue_ListValue::mut_shape_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "tensor", + AttrValue_ListValue::get_tensor_for_reflect, + AttrValue_ListValue::mut_tensor_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "func", + AttrValue_ListValue::get_func_for_reflect, + AttrValue_ListValue::mut_func_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "AttrValue_ListValue", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for AttrValue_ListValue { + fn clear(&mut self) { + self.clear_s(); + self.clear_i(); + self.clear_f(); + self.clear_b(); + self.clear_field_type(); + self.clear_shape(); + self.clear_tensor(); + self.clear_func(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for AttrValue_ListValue { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for AttrValue_ListValue { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct NameAttrList { + // message fields + pub name: ::std::string::String, + pub attr: ::std::collections::HashMap<::std::string::String, AttrValue>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for NameAttrList {} + +impl NameAttrList { + pub fn new() -> NameAttrList { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static NameAttrList { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const NameAttrList, + }; + unsafe { + instance.get(NameAttrList::new) + } + } + + // string name = 1; + + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + pub fn get_name(&self) -> &str { + &self.name + } + + fn get_name_for_reflect(&self) -> &::std::string::String { + &self.name + } + + fn mut_name_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // repeated .tensorflow.NameAttrList.AttrEntry attr = 2; + + pub fn clear_attr(&mut self) { + self.attr.clear(); + } + + // Param is passed by value, moved + pub fn set_attr(&mut self, v: ::std::collections::HashMap<::std::string::String, AttrValue>) { + self.attr = v; + } + + // Mutable pointer to the field. + pub fn mut_attr(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, AttrValue> { + &mut self.attr + } + + // Take field + pub fn take_attr(&mut self) -> ::std::collections::HashMap<::std::string::String, AttrValue> { + ::std::mem::replace(&mut self.attr, ::std::collections::HashMap::new()) + } + + pub fn get_attr(&self) -> &::std::collections::HashMap<::std::string::String, AttrValue> { + &self.attr + } + + fn get_attr_for_reflect(&self) -> &::std::collections::HashMap<::std::string::String, AttrValue> { + &self.attr + } + + fn mut_attr_for_reflect(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, AttrValue> { + &mut self.attr + } +} + +impl ::protobuf::Message for NameAttrList { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 2 => { + ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(wire_type, is, &mut self.attr)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.name); + } + my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(2, &self.attr); + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.name.is_empty() { + os.write_string(1, &self.name)?; + } + ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(2, &self.attr, os)?; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for NameAttrList { + fn new() -> NameAttrList { + NameAttrList::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + NameAttrList::get_name_for_reflect, + NameAttrList::mut_name_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>( + "attr", + NameAttrList::get_attr_for_reflect, + NameAttrList::mut_attr_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "NameAttrList", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for NameAttrList { + fn clear(&mut self) { + self.clear_name(); + self.clear_attr(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for NameAttrList { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NameAttrList { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n*tensorflow/core/framework/attr_value.proto\x12\ntensorflow\x1a&tensor\ + flow/core/framework/tensor.proto\x1a,tensorflow/core/framework/tensor_sh\ + ape.proto\x1a%tensorflow/core/framework/types.proto\"\x87\x05\n\tAttrVal\ + ue\x12\x0e\n\x01s\x18\x02\x20\x01(\x0cH\0R\x01s\x12\x0e\n\x01i\x18\x03\ + \x20\x01(\x03H\0R\x01i\x12\x0e\n\x01f\x18\x04\x20\x01(\x02H\0R\x01f\x12\ + \x0e\n\x01b\x18\x05\x20\x01(\x08H\0R\x01b\x12*\n\x04type\x18\x06\x20\x01\ + (\x0e2\x14.tensorflow.DataTypeH\0R\x04type\x124\n\x05shape\x18\x07\x20\ + \x01(\x0b2\x1c.tensorflow.TensorShapeProtoH\0R\x05shape\x121\n\x06tensor\ + \x18\x08\x20\x01(\x0b2\x17.tensorflow.TensorProtoH\0R\x06tensor\x125\n\ + \x04list\x18\x01\x20\x01(\x0b2\x1f.tensorflow.AttrValue.ListValueH\0R\ + \x04list\x12.\n\x04func\x18\n\x20\x01(\x0b2\x18.tensorflow.NameAttrListH\ + \0R\x04func\x12\"\n\x0bplaceholder\x18\t\x20\x01(\tH\0R\x0bplaceholder\ + \x1a\x90\x02\n\tListValue\x12\x0c\n\x01s\x18\x02\x20\x03(\x0cR\x01s\x12\ + \x10\n\x01i\x18\x03\x20\x03(\x03R\x01iB\x02\x10\x01\x12\x10\n\x01f\x18\ + \x04\x20\x03(\x02R\x01fB\x02\x10\x01\x12\x10\n\x01b\x18\x05\x20\x03(\x08\ + R\x01bB\x02\x10\x01\x12,\n\x04type\x18\x06\x20\x03(\x0e2\x14.tensorflow.\ + DataTypeR\x04typeB\x02\x10\x01\x122\n\x05shape\x18\x07\x20\x03(\x0b2\x1c\ + .tensorflow.TensorShapeProtoR\x05shape\x12/\n\x06tensor\x18\x08\x20\x03(\ + \x0b2\x17.tensorflow.TensorProtoR\x06tensor\x12,\n\x04func\x18\t\x20\x03\ + (\x0b2\x18.tensorflow.NameAttrListR\x04funcB\x07\n\x05value\"\xaa\x01\n\ + \x0cNameAttrList\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x126\n\ + \x04attr\x18\x02\x20\x03(\x0b2\".tensorflow.NameAttrList.AttrEntryR\x04a\ + ttr\x1aN\n\tAttrEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12+\n\ + \x05value\x18\x02\x20\x01(\x0b2\x15.tensorflow.AttrValueR\x05value:\x028\ + \x01B0\n\x18org.tensorflow.frameworkB\x0fAttrValueProtosP\x01\xf8\x01\ + \x01b\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/tfpb/function.rs b/src/tfpb/function.rs new file mode 100644 index 0000000000..76e8ebead9 --- /dev/null +++ b/src/tfpb/function.rs @@ -0,0 +1,850 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 + + + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct FunctionDefLibrary { + // message fields + pub function: ::protobuf::RepeatedField, + pub gradient: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for FunctionDefLibrary {} + +impl FunctionDefLibrary { + pub fn new() -> FunctionDefLibrary { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static FunctionDefLibrary { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const FunctionDefLibrary, + }; + unsafe { + instance.get(FunctionDefLibrary::new) + } + } + + // repeated .tensorflow.FunctionDef function = 1; + + pub fn clear_function(&mut self) { + self.function.clear(); + } + + // Param is passed by value, moved + pub fn set_function(&mut self, v: ::protobuf::RepeatedField) { + self.function = v; + } + + // Mutable pointer to the field. + pub fn mut_function(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.function + } + + // Take field + pub fn take_function(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.function, ::protobuf::RepeatedField::new()) + } + + pub fn get_function(&self) -> &[FunctionDef] { + &self.function + } + + fn get_function_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.function + } + + fn mut_function_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.function + } + + // repeated .tensorflow.GradientDef gradient = 2; + + pub fn clear_gradient(&mut self) { + self.gradient.clear(); + } + + // Param is passed by value, moved + pub fn set_gradient(&mut self, v: ::protobuf::RepeatedField) { + self.gradient = v; + } + + // Mutable pointer to the field. + pub fn mut_gradient(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.gradient + } + + // Take field + pub fn take_gradient(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.gradient, ::protobuf::RepeatedField::new()) + } + + pub fn get_gradient(&self) -> &[GradientDef] { + &self.gradient + } + + fn get_gradient_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.gradient + } + + fn mut_gradient_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.gradient + } +} + +impl ::protobuf::Message for FunctionDefLibrary { + fn is_initialized(&self) -> bool { + for v in &self.function { + if !v.is_initialized() { + return false; + } + }; + for v in &self.gradient { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.function)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.gradient)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.function { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.gradient { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.function { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.gradient { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for FunctionDefLibrary { + fn new() -> FunctionDefLibrary { + FunctionDefLibrary::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "function", + FunctionDefLibrary::get_function_for_reflect, + FunctionDefLibrary::mut_function_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "gradient", + FunctionDefLibrary::get_gradient_for_reflect, + FunctionDefLibrary::mut_gradient_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "FunctionDefLibrary", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for FunctionDefLibrary { + fn clear(&mut self) { + self.clear_function(); + self.clear_gradient(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for FunctionDefLibrary { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for FunctionDefLibrary { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct FunctionDef { + // message fields + pub signature: ::protobuf::SingularPtrField, + pub attr: ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue>, + pub node_def: ::protobuf::RepeatedField, + pub ret: ::std::collections::HashMap<::std::string::String, ::std::string::String>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for FunctionDef {} + +impl FunctionDef { + pub fn new() -> FunctionDef { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static FunctionDef { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const FunctionDef, + }; + unsafe { + instance.get(FunctionDef::new) + } + } + + // .tensorflow.OpDef signature = 1; + + pub fn clear_signature(&mut self) { + self.signature.clear(); + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: super::op_def::OpDef) { + self.signature = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut super::op_def::OpDef { + if self.signature.is_none() { + self.signature.set_default(); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> super::op_def::OpDef { + self.signature.take().unwrap_or_else(|| super::op_def::OpDef::new()) + } + + pub fn get_signature(&self) -> &super::op_def::OpDef { + self.signature.as_ref().unwrap_or_else(|| super::op_def::OpDef::default_instance()) + } + + fn get_signature_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.signature + } + + fn mut_signature_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.signature + } + + // repeated .tensorflow.FunctionDef.AttrEntry attr = 5; + + pub fn clear_attr(&mut self) { + self.attr.clear(); + } + + // Param is passed by value, moved + pub fn set_attr(&mut self, v: ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue>) { + self.attr = v; + } + + // Mutable pointer to the field. + pub fn mut_attr(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue> { + &mut self.attr + } + + // Take field + pub fn take_attr(&mut self) -> ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue> { + ::std::mem::replace(&mut self.attr, ::std::collections::HashMap::new()) + } + + pub fn get_attr(&self) -> &::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue> { + &self.attr + } + + fn get_attr_for_reflect(&self) -> &::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue> { + &self.attr + } + + fn mut_attr_for_reflect(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue> { + &mut self.attr + } + + // repeated .tensorflow.NodeDef node_def = 3; + + pub fn clear_node_def(&mut self) { + self.node_def.clear(); + } + + // Param is passed by value, moved + pub fn set_node_def(&mut self, v: ::protobuf::RepeatedField) { + self.node_def = v; + } + + // Mutable pointer to the field. + pub fn mut_node_def(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.node_def + } + + // Take field + pub fn take_node_def(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.node_def, ::protobuf::RepeatedField::new()) + } + + pub fn get_node_def(&self) -> &[super::node_def::NodeDef] { + &self.node_def + } + + fn get_node_def_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.node_def + } + + fn mut_node_def_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.node_def + } + + // repeated .tensorflow.FunctionDef.RetEntry ret = 4; + + pub fn clear_ret(&mut self) { + self.ret.clear(); + } + + // Param is passed by value, moved + pub fn set_ret(&mut self, v: ::std::collections::HashMap<::std::string::String, ::std::string::String>) { + self.ret = v; + } + + // Mutable pointer to the field. + pub fn mut_ret(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, ::std::string::String> { + &mut self.ret + } + + // Take field + pub fn take_ret(&mut self) -> ::std::collections::HashMap<::std::string::String, ::std::string::String> { + ::std::mem::replace(&mut self.ret, ::std::collections::HashMap::new()) + } + + pub fn get_ret(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> { + &self.ret + } + + fn get_ret_for_reflect(&self) -> &::std::collections::HashMap<::std::string::String, ::std::string::String> { + &self.ret + } + + fn mut_ret_for_reflect(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, ::std::string::String> { + &mut self.ret + } +} + +impl ::protobuf::Message for FunctionDef { + fn is_initialized(&self) -> bool { + for v in &self.signature { + if !v.is_initialized() { + return false; + } + }; + for v in &self.node_def { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.signature)?; + }, + 5 => { + ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(wire_type, is, &mut self.attr)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.node_def)?; + }, + 4 => { + ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(wire_type, is, &mut self.ret)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if let Some(ref v) = self.signature.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(5, &self.attr); + for value in &self.node_def { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(4, &self.ret); + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if let Some(ref v) = self.signature.as_ref() { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(5, &self.attr, os)?; + for v in &self.node_def { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>(4, &self.ret, os)?; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for FunctionDef { + fn new() -> FunctionDef { + FunctionDef::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "signature", + FunctionDef::get_signature_for_reflect, + FunctionDef::mut_signature_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>( + "attr", + FunctionDef::get_attr_for_reflect, + FunctionDef::mut_attr_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "node_def", + FunctionDef::get_node_def_for_reflect, + FunctionDef::mut_node_def_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeString>( + "ret", + FunctionDef::get_ret_for_reflect, + FunctionDef::mut_ret_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "FunctionDef", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for FunctionDef { + fn clear(&mut self) { + self.clear_signature(); + self.clear_attr(); + self.clear_node_def(); + self.clear_ret(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for FunctionDef { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for FunctionDef { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct GradientDef { + // message fields + pub function_name: ::std::string::String, + pub gradient_func: ::std::string::String, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GradientDef {} + +impl GradientDef { + pub fn new() -> GradientDef { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GradientDef { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GradientDef, + }; + unsafe { + instance.get(GradientDef::new) + } + } + + // string function_name = 1; + + pub fn clear_function_name(&mut self) { + self.function_name.clear(); + } + + // Param is passed by value, moved + pub fn set_function_name(&mut self, v: ::std::string::String) { + self.function_name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_function_name(&mut self) -> &mut ::std::string::String { + &mut self.function_name + } + + // Take field + pub fn take_function_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.function_name, ::std::string::String::new()) + } + + pub fn get_function_name(&self) -> &str { + &self.function_name + } + + fn get_function_name_for_reflect(&self) -> &::std::string::String { + &self.function_name + } + + fn mut_function_name_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.function_name + } + + // string gradient_func = 2; + + pub fn clear_gradient_func(&mut self) { + self.gradient_func.clear(); + } + + // Param is passed by value, moved + pub fn set_gradient_func(&mut self, v: ::std::string::String) { + self.gradient_func = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_gradient_func(&mut self) -> &mut ::std::string::String { + &mut self.gradient_func + } + + // Take field + pub fn take_gradient_func(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.gradient_func, ::std::string::String::new()) + } + + pub fn get_gradient_func(&self) -> &str { + &self.gradient_func + } + + fn get_gradient_func_for_reflect(&self) -> &::std::string::String { + &self.gradient_func + } + + fn mut_gradient_func_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.gradient_func + } +} + +impl ::protobuf::Message for GradientDef { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.function_name)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.gradient_func)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.function_name.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.function_name); + } + if !self.gradient_func.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.gradient_func); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.function_name.is_empty() { + os.write_string(1, &self.function_name)?; + } + if !self.gradient_func.is_empty() { + os.write_string(2, &self.gradient_func)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GradientDef { + fn new() -> GradientDef { + GradientDef::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "function_name", + GradientDef::get_function_name_for_reflect, + GradientDef::mut_function_name_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "gradient_func", + GradientDef::get_gradient_func_for_reflect, + GradientDef::mut_gradient_func_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GradientDef", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GradientDef { + fn clear(&mut self) { + self.clear_function_name(); + self.clear_gradient_func(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GradientDef { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GradientDef { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n(tensorflow/core/framework/function.proto\x12\ntensorflow\x1a*tensorfl\ + ow/core/framework/attr_value.proto\x1a(tensorflow/core/framework/node_de\ + f.proto\x1a&tensorflow/core/framework/op_def.proto\"~\n\x12FunctionDefLi\ + brary\x123\n\x08function\x18\x01\x20\x03(\x0b2\x17.tensorflow.FunctionDe\ + fR\x08function\x123\n\x08gradient\x18\x02\x20\x03(\x0b2\x17.tensorflow.G\ + radientDefR\x08gradient\"\xe1\x02\n\x0bFunctionDef\x12/\n\tsignature\x18\ + \x01\x20\x01(\x0b2\x11.tensorflow.OpDefR\tsignature\x125\n\x04attr\x18\ + \x05\x20\x03(\x0b2!.tensorflow.FunctionDef.AttrEntryR\x04attr\x12.\n\x08\ + node_def\x18\x03\x20\x03(\x0b2\x13.tensorflow.NodeDefR\x07nodeDef\x122\n\ + \x03ret\x18\x04\x20\x03(\x0b2\x20.tensorflow.FunctionDef.RetEntryR\x03re\ + t\x1aN\n\tAttrEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12+\n\ + \x05value\x18\x02\x20\x01(\x0b2\x15.tensorflow.AttrValueR\x05value:\x028\ + \x01\x1a6\n\x08RetEntry\x12\x10\n\x03key\x18\x01\x20\x01(\tR\x03key\x12\ + \x14\n\x05value\x18\x02\x20\x01(\tR\x05value:\x028\x01\"W\n\x0bGradientD\ + ef\x12#\n\rfunction_name\x18\x01\x20\x01(\tR\x0cfunctionName\x12#\n\rgra\ + dient_func\x18\x02\x20\x01(\tR\x0cgradientFuncB/\n\x18org.tensorflow.fra\ + meworkB\x0eFunctionProtosP\x01\xf8\x01\x01b\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/tfpb/graph.rs b/src/tfpb/graph.rs new file mode 100644 index 0000000000..3f2c14553b --- /dev/null +++ b/src/tfpb/graph.rs @@ -0,0 +1,394 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 + + + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct GraphDef { + // message fields + pub node: ::protobuf::RepeatedField, + pub versions: ::protobuf::SingularPtrField, + pub version: i32, + pub library: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for GraphDef {} + +impl GraphDef { + pub fn new() -> GraphDef { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static GraphDef { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const GraphDef, + }; + unsafe { + instance.get(GraphDef::new) + } + } + + // repeated .tensorflow.NodeDef node = 1; + + pub fn clear_node(&mut self) { + self.node.clear(); + } + + // Param is passed by value, moved + pub fn set_node(&mut self, v: ::protobuf::RepeatedField) { + self.node = v; + } + + // Mutable pointer to the field. + pub fn mut_node(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.node + } + + // Take field + pub fn take_node(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.node, ::protobuf::RepeatedField::new()) + } + + pub fn get_node(&self) -> &[super::node_def::NodeDef] { + &self.node + } + + fn get_node_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.node + } + + fn mut_node_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.node + } + + // .tensorflow.VersionDef versions = 4; + + pub fn clear_versions(&mut self) { + self.versions.clear(); + } + + pub fn has_versions(&self) -> bool { + self.versions.is_some() + } + + // Param is passed by value, moved + pub fn set_versions(&mut self, v: super::versions::VersionDef) { + self.versions = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_versions(&mut self) -> &mut super::versions::VersionDef { + if self.versions.is_none() { + self.versions.set_default(); + } + self.versions.as_mut().unwrap() + } + + // Take field + pub fn take_versions(&mut self) -> super::versions::VersionDef { + self.versions.take().unwrap_or_else(|| super::versions::VersionDef::new()) + } + + pub fn get_versions(&self) -> &super::versions::VersionDef { + self.versions.as_ref().unwrap_or_else(|| super::versions::VersionDef::default_instance()) + } + + fn get_versions_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.versions + } + + fn mut_versions_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.versions + } + + // int32 version = 3; + + pub fn clear_version(&mut self) { + self.version = 0; + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: i32) { + self.version = v; + } + + pub fn get_version(&self) -> i32 { + self.version + } + + fn get_version_for_reflect(&self) -> &i32 { + &self.version + } + + fn mut_version_for_reflect(&mut self) -> &mut i32 { + &mut self.version + } + + // .tensorflow.FunctionDefLibrary library = 2; + + pub fn clear_library(&mut self) { + self.library.clear(); + } + + pub fn has_library(&self) -> bool { + self.library.is_some() + } + + // Param is passed by value, moved + pub fn set_library(&mut self, v: super::function::FunctionDefLibrary) { + self.library = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_library(&mut self) -> &mut super::function::FunctionDefLibrary { + if self.library.is_none() { + self.library.set_default(); + } + self.library.as_mut().unwrap() + } + + // Take field + pub fn take_library(&mut self) -> super::function::FunctionDefLibrary { + self.library.take().unwrap_or_else(|| super::function::FunctionDefLibrary::new()) + } + + pub fn get_library(&self) -> &super::function::FunctionDefLibrary { + self.library.as_ref().unwrap_or_else(|| super::function::FunctionDefLibrary::default_instance()) + } + + fn get_library_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.library + } + + fn mut_library_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.library + } +} + +impl ::protobuf::Message for GraphDef { + fn is_initialized(&self) -> bool { + for v in &self.node { + if !v.is_initialized() { + return false; + } + }; + for v in &self.versions { + if !v.is_initialized() { + return false; + } + }; + for v in &self.library { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.node)?; + }, + 4 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.versions)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.version = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.library)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.node { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.versions.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.version != 0 { + my_size += ::protobuf::rt::value_size(3, self.version, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.library.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.node { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.versions.as_ref() { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.version != 0 { + os.write_int32(3, self.version)?; + } + if let Some(ref v) = self.library.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for GraphDef { + fn new() -> GraphDef { + GraphDef::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "node", + GraphDef::get_node_for_reflect, + GraphDef::mut_node_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "versions", + GraphDef::get_versions_for_reflect, + GraphDef::mut_versions_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "version", + GraphDef::get_version_for_reflect, + GraphDef::mut_version_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "library", + GraphDef::get_library_for_reflect, + GraphDef::mut_library_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "GraphDef", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for GraphDef { + fn clear(&mut self) { + self.clear_node(); + self.clear_versions(); + self.clear_version(); + self.clear_library(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for GraphDef { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for GraphDef { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n%tensorflow/core/framework/graph.proto\x12\ntensorflow\x1a(tensorflow/\ + core/framework/node_def.proto\x1a(tensorflow/core/framework/function.pro\ + to\x1a(tensorflow/core/framework/versions.proto\"\xbf\x01\n\x08GraphDef\ + \x12'\n\x04node\x18\x01\x20\x03(\x0b2\x13.tensorflow.NodeDefR\x04node\ + \x122\n\x08versions\x18\x04\x20\x01(\x0b2\x16.tensorflow.VersionDefR\x08\ + versions\x12\x1c\n\x07version\x18\x03\x20\x01(\x05R\x07versionB\x02\x18\ + \x01\x128\n\x07library\x18\x02\x20\x01(\x0b2\x1e.tensorflow.FunctionDefL\ + ibraryR\x07libraryB,\n\x18org.tensorflow.frameworkB\x0bGraphProtosP\x01\ + \xf8\x01\x01b\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/tfpb.rs b/src/tfpb/mod.rs similarity index 89% rename from src/tfpb.rs rename to src/tfpb/mod.rs index 983195943a..8c39db4213 100644 --- a/src/tfpb.rs +++ b/src/tfpb/mod.rs @@ -17,36 +17,16 @@ #![allow(unused_imports)] #![allow(unused_results)] -pub mod attr_value { - include!(concat!(env!("OUT_DIR"), "/attr_value.rs")); -} -pub mod function { - include!(concat!(env!("OUT_DIR"), "/function.rs")); -} -pub mod graph { - include!(concat!(env!("OUT_DIR"), "/graph.rs")); -} -pub mod node_def { - include!(concat!(env!("OUT_DIR"), "/node_def.rs")); -} -pub mod op_def { - include!(concat!(env!("OUT_DIR"), "/op_def.rs")); -} -pub mod resource_handle { - include!(concat!(env!("OUT_DIR"), "/resource_handle.rs")); -} -pub mod tensor { - include!(concat!(env!("OUT_DIR"), "/tensor.rs")); -} -pub mod tensor_shape { - include!(concat!(env!("OUT_DIR"), "/tensor_shape.rs")); -} -pub mod types { - include!(concat!(env!("OUT_DIR"), "/types.rs")); -} -pub mod versions { - include!(concat!(env!("OUT_DIR"), "/versions.rs")); -} +pub mod attr_value; +pub mod function; +pub mod graph; +pub mod node_def; +pub mod op_def; +pub mod resource_handle; +pub mod tensor; +pub mod tensor_shape; +pub mod types; +pub mod versions; use self::node_def::NodeDef; use self::attr_value::AttrValue; diff --git a/src/tfpb/node_def.rs b/src/tfpb/node_def.rs new file mode 100644 index 0000000000..afebe95bf1 --- /dev/null +++ b/src/tfpb/node_def.rs @@ -0,0 +1,408 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 + + + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct NodeDef { + // message fields + pub name: ::std::string::String, + pub op: ::std::string::String, + pub input: ::protobuf::RepeatedField<::std::string::String>, + pub device: ::std::string::String, + pub attr: ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue>, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for NodeDef {} + +impl NodeDef { + pub fn new() -> NodeDef { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static NodeDef { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const NodeDef, + }; + unsafe { + instance.get(NodeDef::new) + } + } + + // string name = 1; + + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + pub fn get_name(&self) -> &str { + &self.name + } + + fn get_name_for_reflect(&self) -> &::std::string::String { + &self.name + } + + fn mut_name_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // string op = 2; + + pub fn clear_op(&mut self) { + self.op.clear(); + } + + // Param is passed by value, moved + pub fn set_op(&mut self, v: ::std::string::String) { + self.op = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_op(&mut self) -> &mut ::std::string::String { + &mut self.op + } + + // Take field + pub fn take_op(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.op, ::std::string::String::new()) + } + + pub fn get_op(&self) -> &str { + &self.op + } + + fn get_op_for_reflect(&self) -> &::std::string::String { + &self.op + } + + fn mut_op_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.op + } + + // repeated string input = 3; + + pub fn clear_input(&mut self) { + self.input.clear(); + } + + // Param is passed by value, moved + pub fn set_input(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { + self.input = v; + } + + // Mutable pointer to the field. + pub fn mut_input(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.input + } + + // Take field + pub fn take_input(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { + ::std::mem::replace(&mut self.input, ::protobuf::RepeatedField::new()) + } + + pub fn get_input(&self) -> &[::std::string::String] { + &self.input + } + + fn get_input_for_reflect(&self) -> &::protobuf::RepeatedField<::std::string::String> { + &self.input + } + + fn mut_input_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { + &mut self.input + } + + // string device = 4; + + pub fn clear_device(&mut self) { + self.device.clear(); + } + + // Param is passed by value, moved + pub fn set_device(&mut self, v: ::std::string::String) { + self.device = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_device(&mut self) -> &mut ::std::string::String { + &mut self.device + } + + // Take field + pub fn take_device(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.device, ::std::string::String::new()) + } + + pub fn get_device(&self) -> &str { + &self.device + } + + fn get_device_for_reflect(&self) -> &::std::string::String { + &self.device + } + + fn mut_device_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.device + } + + // repeated .tensorflow.NodeDef.AttrEntry attr = 5; + + pub fn clear_attr(&mut self) { + self.attr.clear(); + } + + // Param is passed by value, moved + pub fn set_attr(&mut self, v: ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue>) { + self.attr = v; + } + + // Mutable pointer to the field. + pub fn mut_attr(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue> { + &mut self.attr + } + + // Take field + pub fn take_attr(&mut self) -> ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue> { + ::std::mem::replace(&mut self.attr, ::std::collections::HashMap::new()) + } + + pub fn get_attr(&self) -> &::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue> { + &self.attr + } + + fn get_attr_for_reflect(&self) -> &::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue> { + &self.attr + } + + fn mut_attr_for_reflect(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue> { + &mut self.attr + } +} + +impl ::protobuf::Message for NodeDef { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.op)?; + }, + 3 => { + ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.input)?; + }, + 4 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.device)?; + }, + 5 => { + ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(wire_type, is, &mut self.attr)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.name); + } + if !self.op.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.op); + } + for value in &self.input { + my_size += ::protobuf::rt::string_size(3, &value); + }; + if !self.device.is_empty() { + my_size += ::protobuf::rt::string_size(4, &self.device); + } + my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(5, &self.attr); + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.name.is_empty() { + os.write_string(1, &self.name)?; + } + if !self.op.is_empty() { + os.write_string(2, &self.op)?; + } + for v in &self.input { + os.write_string(3, &v)?; + }; + if !self.device.is_empty() { + os.write_string(4, &self.device)?; + } + ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(5, &self.attr, os)?; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for NodeDef { + fn new() -> NodeDef { + NodeDef::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + NodeDef::get_name_for_reflect, + NodeDef::mut_name_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "op", + NodeDef::get_op_for_reflect, + NodeDef::mut_op_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "input", + NodeDef::get_input_for_reflect, + NodeDef::mut_input_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "device", + NodeDef::get_device_for_reflect, + NodeDef::mut_device_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>( + "attr", + NodeDef::get_attr_for_reflect, + NodeDef::mut_attr_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "NodeDef", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for NodeDef { + fn clear(&mut self) { + self.clear_name(); + self.clear_op(); + self.clear_input(); + self.clear_device(); + self.clear_attr(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for NodeDef { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NodeDef { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n(tensorflow/core/framework/node_def.proto\x12\ntensorflow\x1a*tensorfl\ + ow/core/framework/attr_value.proto\"\xde\x01\n\x07NodeDef\x12\x12\n\x04n\ + ame\x18\x01\x20\x01(\tR\x04name\x12\x0e\n\x02op\x18\x02\x20\x01(\tR\x02o\ + p\x12\x14\n\x05input\x18\x03\x20\x03(\tR\x05input\x12\x16\n\x06device\ + \x18\x04\x20\x01(\tR\x06device\x121\n\x04attr\x18\x05\x20\x03(\x0b2\x1d.\ + tensorflow.NodeDef.AttrEntryR\x04attr\x1aN\n\tAttrEntry\x12\x10\n\x03key\ + \x18\x01\x20\x01(\tR\x03key\x12+\n\x05value\x18\x02\x20\x01(\x0b2\x15.te\ + nsorflow.AttrValueR\x05value:\x028\x01B*\n\x18org.tensorflow.frameworkB\ + \tNodeProtoP\x01\xf8\x01\x01b\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/tfpb/op_def.rs b/src/tfpb/op_def.rs new file mode 100644 index 0000000000..48be1ca703 --- /dev/null +++ b/src/tfpb/op_def.rs @@ -0,0 +1,2095 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 + + + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct OpDef { + // message fields + pub name: ::std::string::String, + pub input_arg: ::protobuf::RepeatedField, + pub output_arg: ::protobuf::RepeatedField, + pub attr: ::protobuf::RepeatedField, + pub deprecation: ::protobuf::SingularPtrField, + pub summary: ::std::string::String, + pub description: ::std::string::String, + pub is_commutative: bool, + pub is_aggregate: bool, + pub is_stateful: bool, + pub allows_uninitialized_input: bool, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for OpDef {} + +impl OpDef { + pub fn new() -> OpDef { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static OpDef { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const OpDef, + }; + unsafe { + instance.get(OpDef::new) + } + } + + // string name = 1; + + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + pub fn get_name(&self) -> &str { + &self.name + } + + fn get_name_for_reflect(&self) -> &::std::string::String { + &self.name + } + + fn mut_name_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // repeated .tensorflow.OpDef.ArgDef input_arg = 2; + + pub fn clear_input_arg(&mut self) { + self.input_arg.clear(); + } + + // Param is passed by value, moved + pub fn set_input_arg(&mut self, v: ::protobuf::RepeatedField) { + self.input_arg = v; + } + + // Mutable pointer to the field. + pub fn mut_input_arg(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.input_arg + } + + // Take field + pub fn take_input_arg(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.input_arg, ::protobuf::RepeatedField::new()) + } + + pub fn get_input_arg(&self) -> &[OpDef_ArgDef] { + &self.input_arg + } + + fn get_input_arg_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.input_arg + } + + fn mut_input_arg_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.input_arg + } + + // repeated .tensorflow.OpDef.ArgDef output_arg = 3; + + pub fn clear_output_arg(&mut self) { + self.output_arg.clear(); + } + + // Param is passed by value, moved + pub fn set_output_arg(&mut self, v: ::protobuf::RepeatedField) { + self.output_arg = v; + } + + // Mutable pointer to the field. + pub fn mut_output_arg(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.output_arg + } + + // Take field + pub fn take_output_arg(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.output_arg, ::protobuf::RepeatedField::new()) + } + + pub fn get_output_arg(&self) -> &[OpDef_ArgDef] { + &self.output_arg + } + + fn get_output_arg_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.output_arg + } + + fn mut_output_arg_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.output_arg + } + + // repeated .tensorflow.OpDef.AttrDef attr = 4; + + pub fn clear_attr(&mut self) { + self.attr.clear(); + } + + // Param is passed by value, moved + pub fn set_attr(&mut self, v: ::protobuf::RepeatedField) { + self.attr = v; + } + + // Mutable pointer to the field. + pub fn mut_attr(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.attr + } + + // Take field + pub fn take_attr(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.attr, ::protobuf::RepeatedField::new()) + } + + pub fn get_attr(&self) -> &[OpDef_AttrDef] { + &self.attr + } + + fn get_attr_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.attr + } + + fn mut_attr_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.attr + } + + // .tensorflow.OpDeprecation deprecation = 8; + + pub fn clear_deprecation(&mut self) { + self.deprecation.clear(); + } + + pub fn has_deprecation(&self) -> bool { + self.deprecation.is_some() + } + + // Param is passed by value, moved + pub fn set_deprecation(&mut self, v: OpDeprecation) { + self.deprecation = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_deprecation(&mut self) -> &mut OpDeprecation { + if self.deprecation.is_none() { + self.deprecation.set_default(); + } + self.deprecation.as_mut().unwrap() + } + + // Take field + pub fn take_deprecation(&mut self) -> OpDeprecation { + self.deprecation.take().unwrap_or_else(|| OpDeprecation::new()) + } + + pub fn get_deprecation(&self) -> &OpDeprecation { + self.deprecation.as_ref().unwrap_or_else(|| OpDeprecation::default_instance()) + } + + fn get_deprecation_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.deprecation + } + + fn mut_deprecation_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.deprecation + } + + // string summary = 5; + + pub fn clear_summary(&mut self) { + self.summary.clear(); + } + + // Param is passed by value, moved + pub fn set_summary(&mut self, v: ::std::string::String) { + self.summary = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_summary(&mut self) -> &mut ::std::string::String { + &mut self.summary + } + + // Take field + pub fn take_summary(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.summary, ::std::string::String::new()) + } + + pub fn get_summary(&self) -> &str { + &self.summary + } + + fn get_summary_for_reflect(&self) -> &::std::string::String { + &self.summary + } + + fn mut_summary_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.summary + } + + // string description = 6; + + pub fn clear_description(&mut self) { + self.description.clear(); + } + + // Param is passed by value, moved + pub fn set_description(&mut self, v: ::std::string::String) { + self.description = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_description(&mut self) -> &mut ::std::string::String { + &mut self.description + } + + // Take field + pub fn take_description(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.description, ::std::string::String::new()) + } + + pub fn get_description(&self) -> &str { + &self.description + } + + fn get_description_for_reflect(&self) -> &::std::string::String { + &self.description + } + + fn mut_description_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.description + } + + // bool is_commutative = 18; + + pub fn clear_is_commutative(&mut self) { + self.is_commutative = false; + } + + // Param is passed by value, moved + pub fn set_is_commutative(&mut self, v: bool) { + self.is_commutative = v; + } + + pub fn get_is_commutative(&self) -> bool { + self.is_commutative + } + + fn get_is_commutative_for_reflect(&self) -> &bool { + &self.is_commutative + } + + fn mut_is_commutative_for_reflect(&mut self) -> &mut bool { + &mut self.is_commutative + } + + // bool is_aggregate = 16; + + pub fn clear_is_aggregate(&mut self) { + self.is_aggregate = false; + } + + // Param is passed by value, moved + pub fn set_is_aggregate(&mut self, v: bool) { + self.is_aggregate = v; + } + + pub fn get_is_aggregate(&self) -> bool { + self.is_aggregate + } + + fn get_is_aggregate_for_reflect(&self) -> &bool { + &self.is_aggregate + } + + fn mut_is_aggregate_for_reflect(&mut self) -> &mut bool { + &mut self.is_aggregate + } + + // bool is_stateful = 17; + + pub fn clear_is_stateful(&mut self) { + self.is_stateful = false; + } + + // Param is passed by value, moved + pub fn set_is_stateful(&mut self, v: bool) { + self.is_stateful = v; + } + + pub fn get_is_stateful(&self) -> bool { + self.is_stateful + } + + fn get_is_stateful_for_reflect(&self) -> &bool { + &self.is_stateful + } + + fn mut_is_stateful_for_reflect(&mut self) -> &mut bool { + &mut self.is_stateful + } + + // bool allows_uninitialized_input = 19; + + pub fn clear_allows_uninitialized_input(&mut self) { + self.allows_uninitialized_input = false; + } + + // Param is passed by value, moved + pub fn set_allows_uninitialized_input(&mut self, v: bool) { + self.allows_uninitialized_input = v; + } + + pub fn get_allows_uninitialized_input(&self) -> bool { + self.allows_uninitialized_input + } + + fn get_allows_uninitialized_input_for_reflect(&self) -> &bool { + &self.allows_uninitialized_input + } + + fn mut_allows_uninitialized_input_for_reflect(&mut self) -> &mut bool { + &mut self.allows_uninitialized_input + } +} + +impl ::protobuf::Message for OpDef { + fn is_initialized(&self) -> bool { + for v in &self.input_arg { + if !v.is_initialized() { + return false; + } + }; + for v in &self.output_arg { + if !v.is_initialized() { + return false; + } + }; + for v in &self.attr { + if !v.is_initialized() { + return false; + } + }; + for v in &self.deprecation { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.input_arg)?; + }, + 3 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.output_arg)?; + }, + 4 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.attr)?; + }, + 8 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.deprecation)?; + }, + 5 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.summary)?; + }, + 6 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.description)?; + }, + 18 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.is_commutative = tmp; + }, + 16 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.is_aggregate = tmp; + }, + 17 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.is_stateful = tmp; + }, + 19 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.allows_uninitialized_input = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.name); + } + for value in &self.input_arg { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.output_arg { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + for value in &self.attr { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if let Some(ref v) = self.deprecation.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.summary.is_empty() { + my_size += ::protobuf::rt::string_size(5, &self.summary); + } + if !self.description.is_empty() { + my_size += ::protobuf::rt::string_size(6, &self.description); + } + if self.is_commutative != false { + my_size += 3; + } + if self.is_aggregate != false { + my_size += 3; + } + if self.is_stateful != false { + my_size += 3; + } + if self.allows_uninitialized_input != false { + my_size += 3; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.name.is_empty() { + os.write_string(1, &self.name)?; + } + for v in &self.input_arg { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.output_arg { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + for v in &self.attr { + os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if let Some(ref v) = self.deprecation.as_ref() { + os.write_tag(8, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.summary.is_empty() { + os.write_string(5, &self.summary)?; + } + if !self.description.is_empty() { + os.write_string(6, &self.description)?; + } + if self.is_commutative != false { + os.write_bool(18, self.is_commutative)?; + } + if self.is_aggregate != false { + os.write_bool(16, self.is_aggregate)?; + } + if self.is_stateful != false { + os.write_bool(17, self.is_stateful)?; + } + if self.allows_uninitialized_input != false { + os.write_bool(19, self.allows_uninitialized_input)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for OpDef { + fn new() -> OpDef { + OpDef::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + OpDef::get_name_for_reflect, + OpDef::mut_name_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "input_arg", + OpDef::get_input_arg_for_reflect, + OpDef::mut_input_arg_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "output_arg", + OpDef::get_output_arg_for_reflect, + OpDef::mut_output_arg_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "attr", + OpDef::get_attr_for_reflect, + OpDef::mut_attr_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "deprecation", + OpDef::get_deprecation_for_reflect, + OpDef::mut_deprecation_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "summary", + OpDef::get_summary_for_reflect, + OpDef::mut_summary_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "description", + OpDef::get_description_for_reflect, + OpDef::mut_description_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "is_commutative", + OpDef::get_is_commutative_for_reflect, + OpDef::mut_is_commutative_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "is_aggregate", + OpDef::get_is_aggregate_for_reflect, + OpDef::mut_is_aggregate_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "is_stateful", + OpDef::get_is_stateful_for_reflect, + OpDef::mut_is_stateful_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "allows_uninitialized_input", + OpDef::get_allows_uninitialized_input_for_reflect, + OpDef::mut_allows_uninitialized_input_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "OpDef", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for OpDef { + fn clear(&mut self) { + self.clear_name(); + self.clear_input_arg(); + self.clear_output_arg(); + self.clear_attr(); + self.clear_deprecation(); + self.clear_summary(); + self.clear_description(); + self.clear_is_commutative(); + self.clear_is_aggregate(); + self.clear_is_stateful(); + self.clear_allows_uninitialized_input(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for OpDef { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for OpDef { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct OpDef_ArgDef { + // message fields + pub name: ::std::string::String, + pub description: ::std::string::String, + pub field_type: super::types::DataType, + pub type_attr: ::std::string::String, + pub number_attr: ::std::string::String, + pub type_list_attr: ::std::string::String, + pub is_ref: bool, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for OpDef_ArgDef {} + +impl OpDef_ArgDef { + pub fn new() -> OpDef_ArgDef { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static OpDef_ArgDef { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const OpDef_ArgDef, + }; + unsafe { + instance.get(OpDef_ArgDef::new) + } + } + + // string name = 1; + + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + pub fn get_name(&self) -> &str { + &self.name + } + + fn get_name_for_reflect(&self) -> &::std::string::String { + &self.name + } + + fn mut_name_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // string description = 2; + + pub fn clear_description(&mut self) { + self.description.clear(); + } + + // Param is passed by value, moved + pub fn set_description(&mut self, v: ::std::string::String) { + self.description = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_description(&mut self) -> &mut ::std::string::String { + &mut self.description + } + + // Take field + pub fn take_description(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.description, ::std::string::String::new()) + } + + pub fn get_description(&self) -> &str { + &self.description + } + + fn get_description_for_reflect(&self) -> &::std::string::String { + &self.description + } + + fn mut_description_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.description + } + + // .tensorflow.DataType type = 3; + + pub fn clear_field_type(&mut self) { + self.field_type = super::types::DataType::DT_INVALID; + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: super::types::DataType) { + self.field_type = v; + } + + pub fn get_field_type(&self) -> super::types::DataType { + self.field_type + } + + fn get_field_type_for_reflect(&self) -> &super::types::DataType { + &self.field_type + } + + fn mut_field_type_for_reflect(&mut self) -> &mut super::types::DataType { + &mut self.field_type + } + + // string type_attr = 4; + + pub fn clear_type_attr(&mut self) { + self.type_attr.clear(); + } + + // Param is passed by value, moved + pub fn set_type_attr(&mut self, v: ::std::string::String) { + self.type_attr = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_type_attr(&mut self) -> &mut ::std::string::String { + &mut self.type_attr + } + + // Take field + pub fn take_type_attr(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.type_attr, ::std::string::String::new()) + } + + pub fn get_type_attr(&self) -> &str { + &self.type_attr + } + + fn get_type_attr_for_reflect(&self) -> &::std::string::String { + &self.type_attr + } + + fn mut_type_attr_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.type_attr + } + + // string number_attr = 5; + + pub fn clear_number_attr(&mut self) { + self.number_attr.clear(); + } + + // Param is passed by value, moved + pub fn set_number_attr(&mut self, v: ::std::string::String) { + self.number_attr = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_number_attr(&mut self) -> &mut ::std::string::String { + &mut self.number_attr + } + + // Take field + pub fn take_number_attr(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.number_attr, ::std::string::String::new()) + } + + pub fn get_number_attr(&self) -> &str { + &self.number_attr + } + + fn get_number_attr_for_reflect(&self) -> &::std::string::String { + &self.number_attr + } + + fn mut_number_attr_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.number_attr + } + + // string type_list_attr = 6; + + pub fn clear_type_list_attr(&mut self) { + self.type_list_attr.clear(); + } + + // Param is passed by value, moved + pub fn set_type_list_attr(&mut self, v: ::std::string::String) { + self.type_list_attr = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_type_list_attr(&mut self) -> &mut ::std::string::String { + &mut self.type_list_attr + } + + // Take field + pub fn take_type_list_attr(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.type_list_attr, ::std::string::String::new()) + } + + pub fn get_type_list_attr(&self) -> &str { + &self.type_list_attr + } + + fn get_type_list_attr_for_reflect(&self) -> &::std::string::String { + &self.type_list_attr + } + + fn mut_type_list_attr_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.type_list_attr + } + + // bool is_ref = 16; + + pub fn clear_is_ref(&mut self) { + self.is_ref = false; + } + + // Param is passed by value, moved + pub fn set_is_ref(&mut self, v: bool) { + self.is_ref = v; + } + + pub fn get_is_ref(&self) -> bool { + self.is_ref + } + + fn get_is_ref_for_reflect(&self) -> &bool { + &self.is_ref + } + + fn mut_is_ref_for_reflect(&mut self) -> &mut bool { + &mut self.is_ref + } +} + +impl ::protobuf::Message for OpDef_ArgDef { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.description)?; + }, + 3 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.field_type, 3, &mut self.unknown_fields)? + }, + 4 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.type_attr)?; + }, + 5 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.number_attr)?; + }, + 6 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.type_list_attr)?; + }, + 16 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.is_ref = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.name); + } + if !self.description.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.description); + } + if self.field_type != super::types::DataType::DT_INVALID { + my_size += ::protobuf::rt::enum_size(3, self.field_type); + } + if !self.type_attr.is_empty() { + my_size += ::protobuf::rt::string_size(4, &self.type_attr); + } + if !self.number_attr.is_empty() { + my_size += ::protobuf::rt::string_size(5, &self.number_attr); + } + if !self.type_list_attr.is_empty() { + my_size += ::protobuf::rt::string_size(6, &self.type_list_attr); + } + if self.is_ref != false { + my_size += 3; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.name.is_empty() { + os.write_string(1, &self.name)?; + } + if !self.description.is_empty() { + os.write_string(2, &self.description)?; + } + if self.field_type != super::types::DataType::DT_INVALID { + os.write_enum(3, self.field_type.value())?; + } + if !self.type_attr.is_empty() { + os.write_string(4, &self.type_attr)?; + } + if !self.number_attr.is_empty() { + os.write_string(5, &self.number_attr)?; + } + if !self.type_list_attr.is_empty() { + os.write_string(6, &self.type_list_attr)?; + } + if self.is_ref != false { + os.write_bool(16, self.is_ref)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for OpDef_ArgDef { + fn new() -> OpDef_ArgDef { + OpDef_ArgDef::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + OpDef_ArgDef::get_name_for_reflect, + OpDef_ArgDef::mut_name_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "description", + OpDef_ArgDef::get_description_for_reflect, + OpDef_ArgDef::mut_description_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "type", + OpDef_ArgDef::get_field_type_for_reflect, + OpDef_ArgDef::mut_field_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "type_attr", + OpDef_ArgDef::get_type_attr_for_reflect, + OpDef_ArgDef::mut_type_attr_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "number_attr", + OpDef_ArgDef::get_number_attr_for_reflect, + OpDef_ArgDef::mut_number_attr_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "type_list_attr", + OpDef_ArgDef::get_type_list_attr_for_reflect, + OpDef_ArgDef::mut_type_list_attr_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "is_ref", + OpDef_ArgDef::get_is_ref_for_reflect, + OpDef_ArgDef::mut_is_ref_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "OpDef_ArgDef", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for OpDef_ArgDef { + fn clear(&mut self) { + self.clear_name(); + self.clear_description(); + self.clear_field_type(); + self.clear_type_attr(); + self.clear_number_attr(); + self.clear_type_list_attr(); + self.clear_is_ref(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for OpDef_ArgDef { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for OpDef_ArgDef { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct OpDef_AttrDef { + // message fields + pub name: ::std::string::String, + pub field_type: ::std::string::String, + pub default_value: ::protobuf::SingularPtrField, + pub description: ::std::string::String, + pub has_minimum: bool, + pub minimum: i64, + pub allowed_values: ::protobuf::SingularPtrField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for OpDef_AttrDef {} + +impl OpDef_AttrDef { + pub fn new() -> OpDef_AttrDef { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static OpDef_AttrDef { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const OpDef_AttrDef, + }; + unsafe { + instance.get(OpDef_AttrDef::new) + } + } + + // string name = 1; + + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + pub fn get_name(&self) -> &str { + &self.name + } + + fn get_name_for_reflect(&self) -> &::std::string::String { + &self.name + } + + fn mut_name_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // string type = 2; + + pub fn clear_field_type(&mut self) { + self.field_type.clear(); + } + + // Param is passed by value, moved + pub fn set_field_type(&mut self, v: ::std::string::String) { + self.field_type = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_field_type(&mut self) -> &mut ::std::string::String { + &mut self.field_type + } + + // Take field + pub fn take_field_type(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.field_type, ::std::string::String::new()) + } + + pub fn get_field_type(&self) -> &str { + &self.field_type + } + + fn get_field_type_for_reflect(&self) -> &::std::string::String { + &self.field_type + } + + fn mut_field_type_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.field_type + } + + // .tensorflow.AttrValue default_value = 3; + + pub fn clear_default_value(&mut self) { + self.default_value.clear(); + } + + pub fn has_default_value(&self) -> bool { + self.default_value.is_some() + } + + // Param is passed by value, moved + pub fn set_default_value(&mut self, v: super::attr_value::AttrValue) { + self.default_value = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_default_value(&mut self) -> &mut super::attr_value::AttrValue { + if self.default_value.is_none() { + self.default_value.set_default(); + } + self.default_value.as_mut().unwrap() + } + + // Take field + pub fn take_default_value(&mut self) -> super::attr_value::AttrValue { + self.default_value.take().unwrap_or_else(|| super::attr_value::AttrValue::new()) + } + + pub fn get_default_value(&self) -> &super::attr_value::AttrValue { + self.default_value.as_ref().unwrap_or_else(|| super::attr_value::AttrValue::default_instance()) + } + + fn get_default_value_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.default_value + } + + fn mut_default_value_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.default_value + } + + // string description = 4; + + pub fn clear_description(&mut self) { + self.description.clear(); + } + + // Param is passed by value, moved + pub fn set_description(&mut self, v: ::std::string::String) { + self.description = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_description(&mut self) -> &mut ::std::string::String { + &mut self.description + } + + // Take field + pub fn take_description(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.description, ::std::string::String::new()) + } + + pub fn get_description(&self) -> &str { + &self.description + } + + fn get_description_for_reflect(&self) -> &::std::string::String { + &self.description + } + + fn mut_description_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.description + } + + // bool has_minimum = 5; + + pub fn clear_has_minimum(&mut self) { + self.has_minimum = false; + } + + // Param is passed by value, moved + pub fn set_has_minimum(&mut self, v: bool) { + self.has_minimum = v; + } + + pub fn get_has_minimum(&self) -> bool { + self.has_minimum + } + + fn get_has_minimum_for_reflect(&self) -> &bool { + &self.has_minimum + } + + fn mut_has_minimum_for_reflect(&mut self) -> &mut bool { + &mut self.has_minimum + } + + // int64 minimum = 6; + + pub fn clear_minimum(&mut self) { + self.minimum = 0; + } + + // Param is passed by value, moved + pub fn set_minimum(&mut self, v: i64) { + self.minimum = v; + } + + pub fn get_minimum(&self) -> i64 { + self.minimum + } + + fn get_minimum_for_reflect(&self) -> &i64 { + &self.minimum + } + + fn mut_minimum_for_reflect(&mut self) -> &mut i64 { + &mut self.minimum + } + + // .tensorflow.AttrValue allowed_values = 7; + + pub fn clear_allowed_values(&mut self) { + self.allowed_values.clear(); + } + + pub fn has_allowed_values(&self) -> bool { + self.allowed_values.is_some() + } + + // Param is passed by value, moved + pub fn set_allowed_values(&mut self, v: super::attr_value::AttrValue) { + self.allowed_values = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_allowed_values(&mut self) -> &mut super::attr_value::AttrValue { + if self.allowed_values.is_none() { + self.allowed_values.set_default(); + } + self.allowed_values.as_mut().unwrap() + } + + // Take field + pub fn take_allowed_values(&mut self) -> super::attr_value::AttrValue { + self.allowed_values.take().unwrap_or_else(|| super::attr_value::AttrValue::new()) + } + + pub fn get_allowed_values(&self) -> &super::attr_value::AttrValue { + self.allowed_values.as_ref().unwrap_or_else(|| super::attr_value::AttrValue::default_instance()) + } + + fn get_allowed_values_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.allowed_values + } + + fn mut_allowed_values_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.allowed_values + } +} + +impl ::protobuf::Message for OpDef_AttrDef { + fn is_initialized(&self) -> bool { + for v in &self.default_value { + if !v.is_initialized() { + return false; + } + }; + for v in &self.allowed_values { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.field_type)?; + }, + 3 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.default_value)?; + }, + 4 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.description)?; + }, + 5 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.has_minimum = tmp; + }, + 6 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.minimum = tmp; + }, + 7 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.allowed_values)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.name); + } + if !self.field_type.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.field_type); + } + if let Some(ref v) = self.default_value.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if !self.description.is_empty() { + my_size += ::protobuf::rt::string_size(4, &self.description); + } + if self.has_minimum != false { + my_size += 2; + } + if self.minimum != 0 { + my_size += ::protobuf::rt::value_size(6, self.minimum, ::protobuf::wire_format::WireTypeVarint); + } + if let Some(ref v) = self.allowed_values.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.name.is_empty() { + os.write_string(1, &self.name)?; + } + if !self.field_type.is_empty() { + os.write_string(2, &self.field_type)?; + } + if let Some(ref v) = self.default_value.as_ref() { + os.write_tag(3, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if !self.description.is_empty() { + os.write_string(4, &self.description)?; + } + if self.has_minimum != false { + os.write_bool(5, self.has_minimum)?; + } + if self.minimum != 0 { + os.write_int64(6, self.minimum)?; + } + if let Some(ref v) = self.allowed_values.as_ref() { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for OpDef_AttrDef { + fn new() -> OpDef_AttrDef { + OpDef_AttrDef::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + OpDef_AttrDef::get_name_for_reflect, + OpDef_AttrDef::mut_name_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "type", + OpDef_AttrDef::get_field_type_for_reflect, + OpDef_AttrDef::mut_field_type_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "default_value", + OpDef_AttrDef::get_default_value_for_reflect, + OpDef_AttrDef::mut_default_value_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "description", + OpDef_AttrDef::get_description_for_reflect, + OpDef_AttrDef::mut_description_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "has_minimum", + OpDef_AttrDef::get_has_minimum_for_reflect, + OpDef_AttrDef::mut_has_minimum_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "minimum", + OpDef_AttrDef::get_minimum_for_reflect, + OpDef_AttrDef::mut_minimum_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "allowed_values", + OpDef_AttrDef::get_allowed_values_for_reflect, + OpDef_AttrDef::mut_allowed_values_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "OpDef_AttrDef", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for OpDef_AttrDef { + fn clear(&mut self) { + self.clear_name(); + self.clear_field_type(); + self.clear_default_value(); + self.clear_description(); + self.clear_has_minimum(); + self.clear_minimum(); + self.clear_allowed_values(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for OpDef_AttrDef { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for OpDef_AttrDef { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct OpDeprecation { + // message fields + pub version: i32, + pub explanation: ::std::string::String, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for OpDeprecation {} + +impl OpDeprecation { + pub fn new() -> OpDeprecation { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static OpDeprecation { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const OpDeprecation, + }; + unsafe { + instance.get(OpDeprecation::new) + } + } + + // int32 version = 1; + + pub fn clear_version(&mut self) { + self.version = 0; + } + + // Param is passed by value, moved + pub fn set_version(&mut self, v: i32) { + self.version = v; + } + + pub fn get_version(&self) -> i32 { + self.version + } + + fn get_version_for_reflect(&self) -> &i32 { + &self.version + } + + fn mut_version_for_reflect(&mut self) -> &mut i32 { + &mut self.version + } + + // string explanation = 2; + + pub fn clear_explanation(&mut self) { + self.explanation.clear(); + } + + // Param is passed by value, moved + pub fn set_explanation(&mut self, v: ::std::string::String) { + self.explanation = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_explanation(&mut self) -> &mut ::std::string::String { + &mut self.explanation + } + + // Take field + pub fn take_explanation(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.explanation, ::std::string::String::new()) + } + + pub fn get_explanation(&self) -> &str { + &self.explanation + } + + fn get_explanation_for_reflect(&self) -> &::std::string::String { + &self.explanation + } + + fn mut_explanation_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.explanation + } +} + +impl ::protobuf::Message for OpDeprecation { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.version = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.explanation)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.version != 0 { + my_size += ::protobuf::rt::value_size(1, self.version, ::protobuf::wire_format::WireTypeVarint); + } + if !self.explanation.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.explanation); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.version != 0 { + os.write_int32(1, self.version)?; + } + if !self.explanation.is_empty() { + os.write_string(2, &self.explanation)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for OpDeprecation { + fn new() -> OpDeprecation { + OpDeprecation::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "version", + OpDeprecation::get_version_for_reflect, + OpDeprecation::mut_version_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "explanation", + OpDeprecation::get_explanation_for_reflect, + OpDeprecation::mut_explanation_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "OpDeprecation", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for OpDeprecation { + fn clear(&mut self) { + self.clear_version(); + self.clear_explanation(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for OpDeprecation { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for OpDeprecation { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct OpList { + // message fields + pub op: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for OpList {} + +impl OpList { + pub fn new() -> OpList { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static OpList { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const OpList, + }; + unsafe { + instance.get(OpList::new) + } + } + + // repeated .tensorflow.OpDef op = 1; + + pub fn clear_op(&mut self) { + self.op.clear(); + } + + // Param is passed by value, moved + pub fn set_op(&mut self, v: ::protobuf::RepeatedField) { + self.op = v; + } + + // Mutable pointer to the field. + pub fn mut_op(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.op + } + + // Take field + pub fn take_op(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.op, ::protobuf::RepeatedField::new()) + } + + pub fn get_op(&self) -> &[OpDef] { + &self.op + } + + fn get_op_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.op + } + + fn mut_op_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.op + } +} + +impl ::protobuf::Message for OpList { + fn is_initialized(&self) -> bool { + for v in &self.op { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.op)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.op { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.op { + os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for OpList { + fn new() -> OpList { + OpList::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "op", + OpList::get_op_for_reflect, + OpList::mut_op_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "OpList", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for OpList { + fn clear(&mut self) { + self.clear_op(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for OpList { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for OpList { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n&tensorflow/core/framework/op_def.proto\x12\ntensorflow\x1a*tensorflow\ + /core/framework/attr_value.proto\x1a%tensorflow/core/framework/types.pro\ + to\"\xcd\x07\n\x05OpDef\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\ + \x125\n\tinput_arg\x18\x02\x20\x03(\x0b2\x18.tensorflow.OpDef.ArgDefR\ + \x08inputArg\x127\n\noutput_arg\x18\x03\x20\x03(\x0b2\x18.tensorflow.OpD\ + ef.ArgDefR\toutputArg\x12-\n\x04attr\x18\x04\x20\x03(\x0b2\x19.tensorflo\ + w.OpDef.AttrDefR\x04attr\x12;\n\x0bdeprecation\x18\x08\x20\x01(\x0b2\x19\ + .tensorflow.OpDeprecationR\x0bdeprecation\x12\x18\n\x07summary\x18\x05\ + \x20\x01(\tR\x07summary\x12\x20\n\x0bdescription\x18\x06\x20\x01(\tR\x0b\ + description\x12%\n\x0eis_commutative\x18\x12\x20\x01(\x08R\risCommutativ\ + e\x12!\n\x0cis_aggregate\x18\x10\x20\x01(\x08R\x0bisAggregate\x12\x1f\n\ + \x0bis_stateful\x18\x11\x20\x01(\x08R\nisStateful\x12<\n\x1aallows_unini\ + tialized_input\x18\x13\x20\x01(\x08R\x18allowsUninitializedInput\x1a\xe3\ + \x01\n\x06ArgDef\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12\x20\n\ + \x0bdescription\x18\x02\x20\x01(\tR\x0bdescription\x12(\n\x04type\x18\ + \x03\x20\x01(\x0e2\x14.tensorflow.DataTypeR\x04type\x12\x1b\n\ttype_attr\ + \x18\x04\x20\x01(\tR\x08typeAttr\x12\x1f\n\x0bnumber_attr\x18\x05\x20\ + \x01(\tR\nnumberAttr\x12$\n\x0etype_list_attr\x18\x06\x20\x01(\tR\x0ctyp\ + eListAttr\x12\x15\n\x06is_ref\x18\x10\x20\x01(\x08R\x05isRef\x1a\x88\x02\ + \n\x07AttrDef\x12\x12\n\x04name\x18\x01\x20\x01(\tR\x04name\x12\x12\n\ + \x04type\x18\x02\x20\x01(\tR\x04type\x12:\n\rdefault_value\x18\x03\x20\ + \x01(\x0b2\x15.tensorflow.AttrValueR\x0cdefaultValue\x12\x20\n\x0bdescri\ + ption\x18\x04\x20\x01(\tR\x0bdescription\x12\x1f\n\x0bhas_minimum\x18\ + \x05\x20\x01(\x08R\nhasMinimum\x12\x18\n\x07minimum\x18\x06\x20\x01(\x03\ + R\x07minimum\x12<\n\x0eallowed_values\x18\x07\x20\x01(\x0b2\x15.tensorfl\ + ow.AttrValueR\rallowedValues\"K\n\rOpDeprecation\x12\x18\n\x07version\ + \x18\x01\x20\x01(\x05R\x07version\x12\x20\n\x0bexplanation\x18\x02\x20\ + \x01(\tR\x0bexplanation\"+\n\x06OpList\x12!\n\x02op\x18\x01\x20\x03(\x0b\ + 2\x11.tensorflow.OpDefR\x02opB,\n\x18org.tensorflow.frameworkB\x0bOpDefP\ + rotosP\x01\xf8\x01\x01b\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/tfpb/resource_handle.rs b/src/tfpb/resource_handle.rs new file mode 100644 index 0000000000..ec082f009f --- /dev/null +++ b/src/tfpb/resource_handle.rs @@ -0,0 +1,405 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 + + + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct ResourceHandle { + // message fields + pub device: ::std::string::String, + pub container: ::std::string::String, + pub name: ::std::string::String, + pub hash_code: u64, + pub maybe_type_name: ::std::string::String, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for ResourceHandle {} + +impl ResourceHandle { + pub fn new() -> ResourceHandle { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static ResourceHandle { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ResourceHandle, + }; + unsafe { + instance.get(ResourceHandle::new) + } + } + + // string device = 1; + + pub fn clear_device(&mut self) { + self.device.clear(); + } + + // Param is passed by value, moved + pub fn set_device(&mut self, v: ::std::string::String) { + self.device = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_device(&mut self) -> &mut ::std::string::String { + &mut self.device + } + + // Take field + pub fn take_device(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.device, ::std::string::String::new()) + } + + pub fn get_device(&self) -> &str { + &self.device + } + + fn get_device_for_reflect(&self) -> &::std::string::String { + &self.device + } + + fn mut_device_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.device + } + + // string container = 2; + + pub fn clear_container(&mut self) { + self.container.clear(); + } + + // Param is passed by value, moved + pub fn set_container(&mut self, v: ::std::string::String) { + self.container = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_container(&mut self) -> &mut ::std::string::String { + &mut self.container + } + + // Take field + pub fn take_container(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.container, ::std::string::String::new()) + } + + pub fn get_container(&self) -> &str { + &self.container + } + + fn get_container_for_reflect(&self) -> &::std::string::String { + &self.container + } + + fn mut_container_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.container + } + + // string name = 3; + + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + pub fn get_name(&self) -> &str { + &self.name + } + + fn get_name_for_reflect(&self) -> &::std::string::String { + &self.name + } + + fn mut_name_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // uint64 hash_code = 4; + + pub fn clear_hash_code(&mut self) { + self.hash_code = 0; + } + + // Param is passed by value, moved + pub fn set_hash_code(&mut self, v: u64) { + self.hash_code = v; + } + + pub fn get_hash_code(&self) -> u64 { + self.hash_code + } + + fn get_hash_code_for_reflect(&self) -> &u64 { + &self.hash_code + } + + fn mut_hash_code_for_reflect(&mut self) -> &mut u64 { + &mut self.hash_code + } + + // string maybe_type_name = 5; + + pub fn clear_maybe_type_name(&mut self) { + self.maybe_type_name.clear(); + } + + // Param is passed by value, moved + pub fn set_maybe_type_name(&mut self, v: ::std::string::String) { + self.maybe_type_name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_maybe_type_name(&mut self) -> &mut ::std::string::String { + &mut self.maybe_type_name + } + + // Take field + pub fn take_maybe_type_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.maybe_type_name, ::std::string::String::new()) + } + + pub fn get_maybe_type_name(&self) -> &str { + &self.maybe_type_name + } + + fn get_maybe_type_name_for_reflect(&self) -> &::std::string::String { + &self.maybe_type_name + } + + fn mut_maybe_type_name_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.maybe_type_name + } +} + +impl ::protobuf::Message for ResourceHandle { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.device)?; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container)?; + }, + 3 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + 4 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_uint64()?; + self.hash_code = tmp; + }, + 5 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.maybe_type_name)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if !self.device.is_empty() { + my_size += ::protobuf::rt::string_size(1, &self.device); + } + if !self.container.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.container); + } + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(3, &self.name); + } + if self.hash_code != 0 { + my_size += ::protobuf::rt::value_size(4, self.hash_code, ::protobuf::wire_format::WireTypeVarint); + } + if !self.maybe_type_name.is_empty() { + my_size += ::protobuf::rt::string_size(5, &self.maybe_type_name); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if !self.device.is_empty() { + os.write_string(1, &self.device)?; + } + if !self.container.is_empty() { + os.write_string(2, &self.container)?; + } + if !self.name.is_empty() { + os.write_string(3, &self.name)?; + } + if self.hash_code != 0 { + os.write_uint64(4, self.hash_code)?; + } + if !self.maybe_type_name.is_empty() { + os.write_string(5, &self.maybe_type_name)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for ResourceHandle { + fn new() -> ResourceHandle { + ResourceHandle::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "device", + ResourceHandle::get_device_for_reflect, + ResourceHandle::mut_device_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "container", + ResourceHandle::get_container_for_reflect, + ResourceHandle::mut_container_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + ResourceHandle::get_name_for_reflect, + ResourceHandle::mut_name_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( + "hash_code", + ResourceHandle::get_hash_code_for_reflect, + ResourceHandle::mut_hash_code_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "maybe_type_name", + ResourceHandle::get_maybe_type_name_for_reflect, + ResourceHandle::mut_maybe_type_name_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "ResourceHandle", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for ResourceHandle { + fn clear(&mut self) { + self.clear_device(); + self.clear_container(); + self.clear_name(); + self.clear_hash_code(); + self.clear_maybe_type_name(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for ResourceHandle { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for ResourceHandle { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n/tensorflow/core/framework/resource_handle.proto\x12\ntensorflow\"\x9f\ + \x01\n\x0eResourceHandle\x12\x16\n\x06device\x18\x01\x20\x01(\tR\x06devi\ + ce\x12\x1c\n\tcontainer\x18\x02\x20\x01(\tR\tcontainer\x12\x12\n\x04name\ + \x18\x03\x20\x01(\tR\x04name\x12\x1b\n\thash_code\x18\x04\x20\x01(\x04R\ + \x08hashCode\x12&\n\x0fmaybe_type_name\x18\x05\x20\x01(\tR\rmaybeTypeNam\ + eB4\n\x18org.tensorflow.frameworkB\x13ResourceHandleProtoP\x01\xf8\x01\ + \x01b\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/tfpb/tensor.rs b/src/tfpb/tensor.rs new file mode 100644 index 0000000000..af793e1ced --- /dev/null +++ b/src/tfpb/tensor.rs @@ -0,0 +1,909 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 + + + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct TensorProto { + // message fields + pub dtype: super::types::DataType, + pub tensor_shape: ::protobuf::SingularPtrField, + pub version_number: i32, + pub tensor_content: ::std::vec::Vec, + pub half_val: ::std::vec::Vec, + pub float_val: ::std::vec::Vec, + pub double_val: ::std::vec::Vec, + pub int_val: ::std::vec::Vec, + pub string_val: ::protobuf::RepeatedField<::std::vec::Vec>, + pub scomplex_val: ::std::vec::Vec, + pub int64_val: ::std::vec::Vec, + pub bool_val: ::std::vec::Vec, + pub dcomplex_val: ::std::vec::Vec, + pub resource_handle_val: ::protobuf::RepeatedField, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for TensorProto {} + +impl TensorProto { + pub fn new() -> TensorProto { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static TensorProto { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TensorProto, + }; + unsafe { + instance.get(TensorProto::new) + } + } + + // .tensorflow.DataType dtype = 1; + + pub fn clear_dtype(&mut self) { + self.dtype = super::types::DataType::DT_INVALID; + } + + // Param is passed by value, moved + pub fn set_dtype(&mut self, v: super::types::DataType) { + self.dtype = v; + } + + pub fn get_dtype(&self) -> super::types::DataType { + self.dtype + } + + fn get_dtype_for_reflect(&self) -> &super::types::DataType { + &self.dtype + } + + fn mut_dtype_for_reflect(&mut self) -> &mut super::types::DataType { + &mut self.dtype + } + + // .tensorflow.TensorShapeProto tensor_shape = 2; + + pub fn clear_tensor_shape(&mut self) { + self.tensor_shape.clear(); + } + + pub fn has_tensor_shape(&self) -> bool { + self.tensor_shape.is_some() + } + + // Param is passed by value, moved + pub fn set_tensor_shape(&mut self, v: super::tensor_shape::TensorShapeProto) { + self.tensor_shape = ::protobuf::SingularPtrField::some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tensor_shape(&mut self) -> &mut super::tensor_shape::TensorShapeProto { + if self.tensor_shape.is_none() { + self.tensor_shape.set_default(); + } + self.tensor_shape.as_mut().unwrap() + } + + // Take field + pub fn take_tensor_shape(&mut self) -> super::tensor_shape::TensorShapeProto { + self.tensor_shape.take().unwrap_or_else(|| super::tensor_shape::TensorShapeProto::new()) + } + + pub fn get_tensor_shape(&self) -> &super::tensor_shape::TensorShapeProto { + self.tensor_shape.as_ref().unwrap_or_else(|| super::tensor_shape::TensorShapeProto::default_instance()) + } + + fn get_tensor_shape_for_reflect(&self) -> &::protobuf::SingularPtrField { + &self.tensor_shape + } + + fn mut_tensor_shape_for_reflect(&mut self) -> &mut ::protobuf::SingularPtrField { + &mut self.tensor_shape + } + + // int32 version_number = 3; + + pub fn clear_version_number(&mut self) { + self.version_number = 0; + } + + // Param is passed by value, moved + pub fn set_version_number(&mut self, v: i32) { + self.version_number = v; + } + + pub fn get_version_number(&self) -> i32 { + self.version_number + } + + fn get_version_number_for_reflect(&self) -> &i32 { + &self.version_number + } + + fn mut_version_number_for_reflect(&mut self) -> &mut i32 { + &mut self.version_number + } + + // bytes tensor_content = 4; + + pub fn clear_tensor_content(&mut self) { + self.tensor_content.clear(); + } + + // Param is passed by value, moved + pub fn set_tensor_content(&mut self, v: ::std::vec::Vec) { + self.tensor_content = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_tensor_content(&mut self) -> &mut ::std::vec::Vec { + &mut self.tensor_content + } + + // Take field + pub fn take_tensor_content(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.tensor_content, ::std::vec::Vec::new()) + } + + pub fn get_tensor_content(&self) -> &[u8] { + &self.tensor_content + } + + fn get_tensor_content_for_reflect(&self) -> &::std::vec::Vec { + &self.tensor_content + } + + fn mut_tensor_content_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.tensor_content + } + + // repeated int32 half_val = 13; + + pub fn clear_half_val(&mut self) { + self.half_val.clear(); + } + + // Param is passed by value, moved + pub fn set_half_val(&mut self, v: ::std::vec::Vec) { + self.half_val = v; + } + + // Mutable pointer to the field. + pub fn mut_half_val(&mut self) -> &mut ::std::vec::Vec { + &mut self.half_val + } + + // Take field + pub fn take_half_val(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.half_val, ::std::vec::Vec::new()) + } + + pub fn get_half_val(&self) -> &[i32] { + &self.half_val + } + + fn get_half_val_for_reflect(&self) -> &::std::vec::Vec { + &self.half_val + } + + fn mut_half_val_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.half_val + } + + // repeated float float_val = 5; + + pub fn clear_float_val(&mut self) { + self.float_val.clear(); + } + + // Param is passed by value, moved + pub fn set_float_val(&mut self, v: ::std::vec::Vec) { + self.float_val = v; + } + + // Mutable pointer to the field. + pub fn mut_float_val(&mut self) -> &mut ::std::vec::Vec { + &mut self.float_val + } + + // Take field + pub fn take_float_val(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.float_val, ::std::vec::Vec::new()) + } + + pub fn get_float_val(&self) -> &[f32] { + &self.float_val + } + + fn get_float_val_for_reflect(&self) -> &::std::vec::Vec { + &self.float_val + } + + fn mut_float_val_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.float_val + } + + // repeated double double_val = 6; + + pub fn clear_double_val(&mut self) { + self.double_val.clear(); + } + + // Param is passed by value, moved + pub fn set_double_val(&mut self, v: ::std::vec::Vec) { + self.double_val = v; + } + + // Mutable pointer to the field. + pub fn mut_double_val(&mut self) -> &mut ::std::vec::Vec { + &mut self.double_val + } + + // Take field + pub fn take_double_val(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.double_val, ::std::vec::Vec::new()) + } + + pub fn get_double_val(&self) -> &[f64] { + &self.double_val + } + + fn get_double_val_for_reflect(&self) -> &::std::vec::Vec { + &self.double_val + } + + fn mut_double_val_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.double_val + } + + // repeated int32 int_val = 7; + + pub fn clear_int_val(&mut self) { + self.int_val.clear(); + } + + // Param is passed by value, moved + pub fn set_int_val(&mut self, v: ::std::vec::Vec) { + self.int_val = v; + } + + // Mutable pointer to the field. + pub fn mut_int_val(&mut self) -> &mut ::std::vec::Vec { + &mut self.int_val + } + + // Take field + pub fn take_int_val(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.int_val, ::std::vec::Vec::new()) + } + + pub fn get_int_val(&self) -> &[i32] { + &self.int_val + } + + fn get_int_val_for_reflect(&self) -> &::std::vec::Vec { + &self.int_val + } + + fn mut_int_val_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.int_val + } + + // repeated bytes string_val = 8; + + pub fn clear_string_val(&mut self) { + self.string_val.clear(); + } + + // Param is passed by value, moved + pub fn set_string_val(&mut self, v: ::protobuf::RepeatedField<::std::vec::Vec>) { + self.string_val = v; + } + + // Mutable pointer to the field. + pub fn mut_string_val(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { + &mut self.string_val + } + + // Take field + pub fn take_string_val(&mut self) -> ::protobuf::RepeatedField<::std::vec::Vec> { + ::std::mem::replace(&mut self.string_val, ::protobuf::RepeatedField::new()) + } + + pub fn get_string_val(&self) -> &[::std::vec::Vec] { + &self.string_val + } + + fn get_string_val_for_reflect(&self) -> &::protobuf::RepeatedField<::std::vec::Vec> { + &self.string_val + } + + fn mut_string_val_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField<::std::vec::Vec> { + &mut self.string_val + } + + // repeated float scomplex_val = 9; + + pub fn clear_scomplex_val(&mut self) { + self.scomplex_val.clear(); + } + + // Param is passed by value, moved + pub fn set_scomplex_val(&mut self, v: ::std::vec::Vec) { + self.scomplex_val = v; + } + + // Mutable pointer to the field. + pub fn mut_scomplex_val(&mut self) -> &mut ::std::vec::Vec { + &mut self.scomplex_val + } + + // Take field + pub fn take_scomplex_val(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.scomplex_val, ::std::vec::Vec::new()) + } + + pub fn get_scomplex_val(&self) -> &[f32] { + &self.scomplex_val + } + + fn get_scomplex_val_for_reflect(&self) -> &::std::vec::Vec { + &self.scomplex_val + } + + fn mut_scomplex_val_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.scomplex_val + } + + // repeated int64 int64_val = 10; + + pub fn clear_int64_val(&mut self) { + self.int64_val.clear(); + } + + // Param is passed by value, moved + pub fn set_int64_val(&mut self, v: ::std::vec::Vec) { + self.int64_val = v; + } + + // Mutable pointer to the field. + pub fn mut_int64_val(&mut self) -> &mut ::std::vec::Vec { + &mut self.int64_val + } + + // Take field + pub fn take_int64_val(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.int64_val, ::std::vec::Vec::new()) + } + + pub fn get_int64_val(&self) -> &[i64] { + &self.int64_val + } + + fn get_int64_val_for_reflect(&self) -> &::std::vec::Vec { + &self.int64_val + } + + fn mut_int64_val_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.int64_val + } + + // repeated bool bool_val = 11; + + pub fn clear_bool_val(&mut self) { + self.bool_val.clear(); + } + + // Param is passed by value, moved + pub fn set_bool_val(&mut self, v: ::std::vec::Vec) { + self.bool_val = v; + } + + // Mutable pointer to the field. + pub fn mut_bool_val(&mut self) -> &mut ::std::vec::Vec { + &mut self.bool_val + } + + // Take field + pub fn take_bool_val(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.bool_val, ::std::vec::Vec::new()) + } + + pub fn get_bool_val(&self) -> &[bool] { + &self.bool_val + } + + fn get_bool_val_for_reflect(&self) -> &::std::vec::Vec { + &self.bool_val + } + + fn mut_bool_val_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.bool_val + } + + // repeated double dcomplex_val = 12; + + pub fn clear_dcomplex_val(&mut self) { + self.dcomplex_val.clear(); + } + + // Param is passed by value, moved + pub fn set_dcomplex_val(&mut self, v: ::std::vec::Vec) { + self.dcomplex_val = v; + } + + // Mutable pointer to the field. + pub fn mut_dcomplex_val(&mut self) -> &mut ::std::vec::Vec { + &mut self.dcomplex_val + } + + // Take field + pub fn take_dcomplex_val(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.dcomplex_val, ::std::vec::Vec::new()) + } + + pub fn get_dcomplex_val(&self) -> &[f64] { + &self.dcomplex_val + } + + fn get_dcomplex_val_for_reflect(&self) -> &::std::vec::Vec { + &self.dcomplex_val + } + + fn mut_dcomplex_val_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.dcomplex_val + } + + // repeated .tensorflow.ResourceHandle resource_handle_val = 14; + + pub fn clear_resource_handle_val(&mut self) { + self.resource_handle_val.clear(); + } + + // Param is passed by value, moved + pub fn set_resource_handle_val(&mut self, v: ::protobuf::RepeatedField) { + self.resource_handle_val = v; + } + + // Mutable pointer to the field. + pub fn mut_resource_handle_val(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.resource_handle_val + } + + // Take field + pub fn take_resource_handle_val(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.resource_handle_val, ::protobuf::RepeatedField::new()) + } + + pub fn get_resource_handle_val(&self) -> &[super::resource_handle::ResourceHandle] { + &self.resource_handle_val + } + + fn get_resource_handle_val_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.resource_handle_val + } + + fn mut_resource_handle_val_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.resource_handle_val + } +} + +impl ::protobuf::Message for TensorProto { + fn is_initialized(&self) -> bool { + for v in &self.tensor_shape { + if !v.is_initialized() { + return false; + } + }; + for v in &self.resource_handle_val { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.dtype, 1, &mut self.unknown_fields)? + }, + 2 => { + ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.tensor_shape)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.version_number = tmp; + }, + 4 => { + ::protobuf::rt::read_singular_proto3_bytes_into(wire_type, is, &mut self.tensor_content)?; + }, + 13 => { + ::protobuf::rt::read_repeated_int32_into(wire_type, is, &mut self.half_val)?; + }, + 5 => { + ::protobuf::rt::read_repeated_float_into(wire_type, is, &mut self.float_val)?; + }, + 6 => { + ::protobuf::rt::read_repeated_double_into(wire_type, is, &mut self.double_val)?; + }, + 7 => { + ::protobuf::rt::read_repeated_int32_into(wire_type, is, &mut self.int_val)?; + }, + 8 => { + ::protobuf::rt::read_repeated_bytes_into(wire_type, is, &mut self.string_val)?; + }, + 9 => { + ::protobuf::rt::read_repeated_float_into(wire_type, is, &mut self.scomplex_val)?; + }, + 10 => { + ::protobuf::rt::read_repeated_int64_into(wire_type, is, &mut self.int64_val)?; + }, + 11 => { + ::protobuf::rt::read_repeated_bool_into(wire_type, is, &mut self.bool_val)?; + }, + 12 => { + ::protobuf::rt::read_repeated_double_into(wire_type, is, &mut self.dcomplex_val)?; + }, + 14 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.resource_handle_val)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.dtype != super::types::DataType::DT_INVALID { + my_size += ::protobuf::rt::enum_size(1, self.dtype); + } + if let Some(ref v) = self.tensor_shape.as_ref() { + let len = v.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + } + if self.version_number != 0 { + my_size += ::protobuf::rt::value_size(3, self.version_number, ::protobuf::wire_format::WireTypeVarint); + } + if !self.tensor_content.is_empty() { + my_size += ::protobuf::rt::bytes_size(4, &self.tensor_content); + } + if !self.half_val.is_empty() { + my_size += ::protobuf::rt::vec_packed_varint_size(13, &self.half_val); + } + if !self.float_val.is_empty() { + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size((self.float_val.len() * 4) as u32) + (self.float_val.len() * 4) as u32; + } + if !self.double_val.is_empty() { + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size((self.double_val.len() * 8) as u32) + (self.double_val.len() * 8) as u32; + } + if !self.int_val.is_empty() { + my_size += ::protobuf::rt::vec_packed_varint_size(7, &self.int_val); + } + for value in &self.string_val { + my_size += ::protobuf::rt::bytes_size(8, &value); + }; + if !self.scomplex_val.is_empty() { + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size((self.scomplex_val.len() * 4) as u32) + (self.scomplex_val.len() * 4) as u32; + } + if !self.int64_val.is_empty() { + my_size += ::protobuf::rt::vec_packed_varint_size(10, &self.int64_val); + } + if !self.bool_val.is_empty() { + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size((self.bool_val.len() * 1) as u32) + (self.bool_val.len() * 1) as u32; + } + if !self.dcomplex_val.is_empty() { + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size((self.dcomplex_val.len() * 8) as u32) + (self.dcomplex_val.len() * 8) as u32; + } + for value in &self.resource_handle_val { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.dtype != super::types::DataType::DT_INVALID { + os.write_enum(1, self.dtype.value())?; + } + if let Some(ref v) = self.tensor_shape.as_ref() { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + } + if self.version_number != 0 { + os.write_int32(3, self.version_number)?; + } + if !self.tensor_content.is_empty() { + os.write_bytes(4, &self.tensor_content)?; + } + if !self.half_val.is_empty() { + os.write_tag(13, ::protobuf::wire_format::WireTypeLengthDelimited)?; + // TODO: Data size is computed again, it should be cached + os.write_raw_varint32(::protobuf::rt::vec_packed_varint_data_size(&self.half_val))?; + for v in &self.half_val { + os.write_int32_no_tag(*v)?; + }; + } + if !self.float_val.is_empty() { + os.write_tag(5, ::protobuf::wire_format::WireTypeLengthDelimited)?; + // TODO: Data size is computed again, it should be cached + os.write_raw_varint32((self.float_val.len() * 4) as u32)?; + for v in &self.float_val { + os.write_float_no_tag(*v)?; + }; + } + if !self.double_val.is_empty() { + os.write_tag(6, ::protobuf::wire_format::WireTypeLengthDelimited)?; + // TODO: Data size is computed again, it should be cached + os.write_raw_varint32((self.double_val.len() * 8) as u32)?; + for v in &self.double_val { + os.write_double_no_tag(*v)?; + }; + } + if !self.int_val.is_empty() { + os.write_tag(7, ::protobuf::wire_format::WireTypeLengthDelimited)?; + // TODO: Data size is computed again, it should be cached + os.write_raw_varint32(::protobuf::rt::vec_packed_varint_data_size(&self.int_val))?; + for v in &self.int_val { + os.write_int32_no_tag(*v)?; + }; + } + for v in &self.string_val { + os.write_bytes(8, &v)?; + }; + if !self.scomplex_val.is_empty() { + os.write_tag(9, ::protobuf::wire_format::WireTypeLengthDelimited)?; + // TODO: Data size is computed again, it should be cached + os.write_raw_varint32((self.scomplex_val.len() * 4) as u32)?; + for v in &self.scomplex_val { + os.write_float_no_tag(*v)?; + }; + } + if !self.int64_val.is_empty() { + os.write_tag(10, ::protobuf::wire_format::WireTypeLengthDelimited)?; + // TODO: Data size is computed again, it should be cached + os.write_raw_varint32(::protobuf::rt::vec_packed_varint_data_size(&self.int64_val))?; + for v in &self.int64_val { + os.write_int64_no_tag(*v)?; + }; + } + if !self.bool_val.is_empty() { + os.write_tag(11, ::protobuf::wire_format::WireTypeLengthDelimited)?; + // TODO: Data size is computed again, it should be cached + os.write_raw_varint32((self.bool_val.len() * 1) as u32)?; + for v in &self.bool_val { + os.write_bool_no_tag(*v)?; + }; + } + if !self.dcomplex_val.is_empty() { + os.write_tag(12, ::protobuf::wire_format::WireTypeLengthDelimited)?; + // TODO: Data size is computed again, it should be cached + os.write_raw_varint32((self.dcomplex_val.len() * 8) as u32)?; + for v in &self.dcomplex_val { + os.write_double_no_tag(*v)?; + }; + } + for v in &self.resource_handle_val { + os.write_tag(14, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for TensorProto { + fn new() -> TensorProto { + TensorProto::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( + "dtype", + TensorProto::get_dtype_for_reflect, + TensorProto::mut_dtype_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "tensor_shape", + TensorProto::get_tensor_shape_for_reflect, + TensorProto::mut_tensor_shape_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "version_number", + TensorProto::get_version_number_for_reflect, + TensorProto::mut_version_number_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "tensor_content", + TensorProto::get_tensor_content_for_reflect, + TensorProto::mut_tensor_content_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "half_val", + TensorProto::get_half_val_for_reflect, + TensorProto::mut_half_val_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeFloat>( + "float_val", + TensorProto::get_float_val_for_reflect, + TensorProto::mut_float_val_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( + "double_val", + TensorProto::get_double_val_for_reflect, + TensorProto::mut_double_val_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "int_val", + TensorProto::get_int_val_for_reflect, + TensorProto::mut_int_val_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeBytes>( + "string_val", + TensorProto::get_string_val_for_reflect, + TensorProto::mut_string_val_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeFloat>( + "scomplex_val", + TensorProto::get_scomplex_val_for_reflect, + TensorProto::mut_scomplex_val_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "int64_val", + TensorProto::get_int64_val_for_reflect, + TensorProto::mut_int64_val_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "bool_val", + TensorProto::get_bool_val_for_reflect, + TensorProto::mut_bool_val_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeDouble>( + "dcomplex_val", + TensorProto::get_dcomplex_val_for_reflect, + TensorProto::mut_dcomplex_val_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "resource_handle_val", + TensorProto::get_resource_handle_val_for_reflect, + TensorProto::mut_resource_handle_val_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "TensorProto", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for TensorProto { + fn clear(&mut self) { + self.clear_dtype(); + self.clear_tensor_shape(); + self.clear_version_number(); + self.clear_tensor_content(); + self.clear_half_val(); + self.clear_float_val(); + self.clear_double_val(); + self.clear_int_val(); + self.clear_string_val(); + self.clear_scomplex_val(); + self.clear_int64_val(); + self.clear_bool_val(); + self.clear_dcomplex_val(); + self.clear_resource_handle_val(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for TensorProto { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TensorProto { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n&tensorflow/core/framework/tensor.proto\x12\ntensorflow\x1a/tensorflow\ + /core/framework/resource_handle.proto\x1a,tensorflow/core/framework/tens\ + or_shape.proto\x1a%tensorflow/core/framework/types.proto\"\xc1\x04\n\x0b\ + TensorProto\x12*\n\x05dtype\x18\x01\x20\x01(\x0e2\x14.tensorflow.DataTyp\ + eR\x05dtype\x12?\n\x0ctensor_shape\x18\x02\x20\x01(\x0b2\x1c.tensorflow.\ + TensorShapeProtoR\x0btensorShape\x12%\n\x0eversion_number\x18\x03\x20\ + \x01(\x05R\rversionNumber\x12%\n\x0etensor_content\x18\x04\x20\x01(\x0cR\ + \rtensorContent\x12\x1d\n\x08half_val\x18\r\x20\x03(\x05R\x07halfValB\ + \x02\x10\x01\x12\x1f\n\tfloat_val\x18\x05\x20\x03(\x02R\x08floatValB\x02\ + \x10\x01\x12!\n\ndouble_val\x18\x06\x20\x03(\x01R\tdoubleValB\x02\x10\ + \x01\x12\x1b\n\x07int_val\x18\x07\x20\x03(\x05R\x06intValB\x02\x10\x01\ + \x12\x1d\n\nstring_val\x18\x08\x20\x03(\x0cR\tstringVal\x12%\n\x0cscompl\ + ex_val\x18\t\x20\x03(\x02R\x0bscomplexValB\x02\x10\x01\x12\x1f\n\tint64_\ + val\x18\n\x20\x03(\x03R\x08int64ValB\x02\x10\x01\x12\x1d\n\x08bool_val\ + \x18\x0b\x20\x03(\x08R\x07boolValB\x02\x10\x01\x12%\n\x0cdcomplex_val\ + \x18\x0c\x20\x03(\x01R\x0bdcomplexValB\x02\x10\x01\x12J\n\x13resource_ha\ + ndle_val\x18\x0e\x20\x03(\x0b2\x1a.tensorflow.ResourceHandleR\x11resourc\ + eHandleValB-\n\x18org.tensorflow.frameworkB\x0cTensorProtosP\x01\xf8\x01\ + \x01b\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/tfpb/tensor_shape.rs b/src/tfpb/tensor_shape.rs new file mode 100644 index 0000000000..13fc5a6ca1 --- /dev/null +++ b/src/tfpb/tensor_shape.rs @@ -0,0 +1,481 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 + + + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct TensorShapeProto { + // message fields + pub dim: ::protobuf::RepeatedField, + pub unknown_rank: bool, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for TensorShapeProto {} + +impl TensorShapeProto { + pub fn new() -> TensorShapeProto { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static TensorShapeProto { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TensorShapeProto, + }; + unsafe { + instance.get(TensorShapeProto::new) + } + } + + // repeated .tensorflow.TensorShapeProto.Dim dim = 2; + + pub fn clear_dim(&mut self) { + self.dim.clear(); + } + + // Param is passed by value, moved + pub fn set_dim(&mut self, v: ::protobuf::RepeatedField) { + self.dim = v; + } + + // Mutable pointer to the field. + pub fn mut_dim(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.dim + } + + // Take field + pub fn take_dim(&mut self) -> ::protobuf::RepeatedField { + ::std::mem::replace(&mut self.dim, ::protobuf::RepeatedField::new()) + } + + pub fn get_dim(&self) -> &[TensorShapeProto_Dim] { + &self.dim + } + + fn get_dim_for_reflect(&self) -> &::protobuf::RepeatedField { + &self.dim + } + + fn mut_dim_for_reflect(&mut self) -> &mut ::protobuf::RepeatedField { + &mut self.dim + } + + // bool unknown_rank = 3; + + pub fn clear_unknown_rank(&mut self) { + self.unknown_rank = false; + } + + // Param is passed by value, moved + pub fn set_unknown_rank(&mut self, v: bool) { + self.unknown_rank = v; + } + + pub fn get_unknown_rank(&self) -> bool { + self.unknown_rank + } + + fn get_unknown_rank_for_reflect(&self) -> &bool { + &self.unknown_rank + } + + fn mut_unknown_rank_for_reflect(&mut self) -> &mut bool { + &mut self.unknown_rank + } +} + +impl ::protobuf::Message for TensorShapeProto { + fn is_initialized(&self) -> bool { + for v in &self.dim { + if !v.is_initialized() { + return false; + } + }; + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 2 => { + ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.dim)?; + }, + 3 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_bool()?; + self.unknown_rank = tmp; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + for value in &self.dim { + let len = value.compute_size(); + my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; + }; + if self.unknown_rank != false { + my_size += 2; + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + for v in &self.dim { + os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; + os.write_raw_varint32(v.get_cached_size())?; + v.write_to_with_cached_sizes(os)?; + }; + if self.unknown_rank != false { + os.write_bool(3, self.unknown_rank)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for TensorShapeProto { + fn new() -> TensorShapeProto { + TensorShapeProto::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( + "dim", + TensorShapeProto::get_dim_for_reflect, + TensorShapeProto::mut_dim_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( + "unknown_rank", + TensorShapeProto::get_unknown_rank_for_reflect, + TensorShapeProto::mut_unknown_rank_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "TensorShapeProto", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for TensorShapeProto { + fn clear(&mut self) { + self.clear_dim(); + self.clear_unknown_rank(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for TensorShapeProto { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TensorShapeProto { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +#[derive(PartialEq,Clone,Default)] +pub struct TensorShapeProto_Dim { + // message fields + pub size: i64, + pub name: ::std::string::String, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for TensorShapeProto_Dim {} + +impl TensorShapeProto_Dim { + pub fn new() -> TensorShapeProto_Dim { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static TensorShapeProto_Dim { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const TensorShapeProto_Dim, + }; + unsafe { + instance.get(TensorShapeProto_Dim::new) + } + } + + // int64 size = 1; + + pub fn clear_size(&mut self) { + self.size = 0; + } + + // Param is passed by value, moved + pub fn set_size(&mut self, v: i64) { + self.size = v; + } + + pub fn get_size(&self) -> i64 { + self.size + } + + fn get_size_for_reflect(&self) -> &i64 { + &self.size + } + + fn mut_size_for_reflect(&mut self) -> &mut i64 { + &mut self.size + } + + // string name = 2; + + pub fn clear_name(&mut self) { + self.name.clear(); + } + + // Param is passed by value, moved + pub fn set_name(&mut self, v: ::std::string::String) { + self.name = v; + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_name(&mut self) -> &mut ::std::string::String { + &mut self.name + } + + // Take field + pub fn take_name(&mut self) -> ::std::string::String { + ::std::mem::replace(&mut self.name, ::std::string::String::new()) + } + + pub fn get_name(&self) -> &str { + &self.name + } + + fn get_name_for_reflect(&self) -> &::std::string::String { + &self.name + } + + fn mut_name_for_reflect(&mut self) -> &mut ::std::string::String { + &mut self.name + } +} + +impl ::protobuf::Message for TensorShapeProto_Dim { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int64()?; + self.size = tmp; + }, + 2 => { + ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.size != 0 { + my_size += ::protobuf::rt::value_size(1, self.size, ::protobuf::wire_format::WireTypeVarint); + } + if !self.name.is_empty() { + my_size += ::protobuf::rt::string_size(2, &self.name); + } + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.size != 0 { + os.write_int64(1, self.size)?; + } + if !self.name.is_empty() { + os.write_string(2, &self.name)?; + } + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for TensorShapeProto_Dim { + fn new() -> TensorShapeProto_Dim { + TensorShapeProto_Dim::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( + "size", + TensorShapeProto_Dim::get_size_for_reflect, + TensorShapeProto_Dim::mut_size_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( + "name", + TensorShapeProto_Dim::get_name_for_reflect, + TensorShapeProto_Dim::mut_name_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "TensorShapeProto_Dim", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for TensorShapeProto_Dim { + fn clear(&mut self) { + self.clear_size(); + self.clear_name(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for TensorShapeProto_Dim { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for TensorShapeProto_Dim { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"\x98\ + \x01\n\x10TensorShapeProto\x122\n\x03dim\x18\x02\x20\x03(\x0b2\x20.tenso\ + rflow.TensorShapeProto.DimR\x03dim\x12!\n\x0cunknown_rank\x18\x03\x20\ + \x01(\x08R\x0bunknownRank\x1a-\n\x03Dim\x12\x12\n\x04size\x18\x01\x20\ + \x01(\x03R\x04size\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04nameB2\n\x18\ + org.tensorflow.frameworkB\x11TensorShapeProtosP\x01\xf8\x01\x01b\x06prot\ + o3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/tfpb/types.rs b/src/tfpb/types.rs new file mode 100644 index 0000000000..50180435e5 --- /dev/null +++ b/src/tfpb/types.rs @@ -0,0 +1,221 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 + + + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(Clone,PartialEq,Eq,Debug,Hash)] +pub enum DataType { + DT_INVALID = 0, + DT_FLOAT = 1, + DT_DOUBLE = 2, + DT_INT32 = 3, + DT_UINT8 = 4, + DT_INT16 = 5, + DT_INT8 = 6, + DT_STRING = 7, + DT_COMPLEX64 = 8, + DT_INT64 = 9, + DT_BOOL = 10, + DT_QINT8 = 11, + DT_QUINT8 = 12, + DT_QINT32 = 13, + DT_BFLOAT16 = 14, + DT_QINT16 = 15, + DT_QUINT16 = 16, + DT_UINT16 = 17, + DT_COMPLEX128 = 18, + DT_HALF = 19, + DT_RESOURCE = 20, + DT_FLOAT_REF = 101, + DT_DOUBLE_REF = 102, + DT_INT32_REF = 103, + DT_UINT8_REF = 104, + DT_INT16_REF = 105, + DT_INT8_REF = 106, + DT_STRING_REF = 107, + DT_COMPLEX64_REF = 108, + DT_INT64_REF = 109, + DT_BOOL_REF = 110, + DT_QINT8_REF = 111, + DT_QUINT8_REF = 112, + DT_QINT32_REF = 113, + DT_BFLOAT16_REF = 114, + DT_QINT16_REF = 115, + DT_QUINT16_REF = 116, + DT_UINT16_REF = 117, + DT_COMPLEX128_REF = 118, + DT_HALF_REF = 119, + DT_RESOURCE_REF = 120, +} + +impl ::protobuf::ProtobufEnum for DataType { + fn value(&self) -> i32 { + *self as i32 + } + + fn from_i32(value: i32) -> ::std::option::Option { + match value { + 0 => ::std::option::Option::Some(DataType::DT_INVALID), + 1 => ::std::option::Option::Some(DataType::DT_FLOAT), + 2 => ::std::option::Option::Some(DataType::DT_DOUBLE), + 3 => ::std::option::Option::Some(DataType::DT_INT32), + 4 => ::std::option::Option::Some(DataType::DT_UINT8), + 5 => ::std::option::Option::Some(DataType::DT_INT16), + 6 => ::std::option::Option::Some(DataType::DT_INT8), + 7 => ::std::option::Option::Some(DataType::DT_STRING), + 8 => ::std::option::Option::Some(DataType::DT_COMPLEX64), + 9 => ::std::option::Option::Some(DataType::DT_INT64), + 10 => ::std::option::Option::Some(DataType::DT_BOOL), + 11 => ::std::option::Option::Some(DataType::DT_QINT8), + 12 => ::std::option::Option::Some(DataType::DT_QUINT8), + 13 => ::std::option::Option::Some(DataType::DT_QINT32), + 14 => ::std::option::Option::Some(DataType::DT_BFLOAT16), + 15 => ::std::option::Option::Some(DataType::DT_QINT16), + 16 => ::std::option::Option::Some(DataType::DT_QUINT16), + 17 => ::std::option::Option::Some(DataType::DT_UINT16), + 18 => ::std::option::Option::Some(DataType::DT_COMPLEX128), + 19 => ::std::option::Option::Some(DataType::DT_HALF), + 20 => ::std::option::Option::Some(DataType::DT_RESOURCE), + 101 => ::std::option::Option::Some(DataType::DT_FLOAT_REF), + 102 => ::std::option::Option::Some(DataType::DT_DOUBLE_REF), + 103 => ::std::option::Option::Some(DataType::DT_INT32_REF), + 104 => ::std::option::Option::Some(DataType::DT_UINT8_REF), + 105 => ::std::option::Option::Some(DataType::DT_INT16_REF), + 106 => ::std::option::Option::Some(DataType::DT_INT8_REF), + 107 => ::std::option::Option::Some(DataType::DT_STRING_REF), + 108 => ::std::option::Option::Some(DataType::DT_COMPLEX64_REF), + 109 => ::std::option::Option::Some(DataType::DT_INT64_REF), + 110 => ::std::option::Option::Some(DataType::DT_BOOL_REF), + 111 => ::std::option::Option::Some(DataType::DT_QINT8_REF), + 112 => ::std::option::Option::Some(DataType::DT_QUINT8_REF), + 113 => ::std::option::Option::Some(DataType::DT_QINT32_REF), + 114 => ::std::option::Option::Some(DataType::DT_BFLOAT16_REF), + 115 => ::std::option::Option::Some(DataType::DT_QINT16_REF), + 116 => ::std::option::Option::Some(DataType::DT_QUINT16_REF), + 117 => ::std::option::Option::Some(DataType::DT_UINT16_REF), + 118 => ::std::option::Option::Some(DataType::DT_COMPLEX128_REF), + 119 => ::std::option::Option::Some(DataType::DT_HALF_REF), + 120 => ::std::option::Option::Some(DataType::DT_RESOURCE_REF), + _ => ::std::option::Option::None + } + } + + fn values() -> &'static [Self] { + static values: &'static [DataType] = &[ + DataType::DT_INVALID, + DataType::DT_FLOAT, + DataType::DT_DOUBLE, + DataType::DT_INT32, + DataType::DT_UINT8, + DataType::DT_INT16, + DataType::DT_INT8, + DataType::DT_STRING, + DataType::DT_COMPLEX64, + DataType::DT_INT64, + DataType::DT_BOOL, + DataType::DT_QINT8, + DataType::DT_QUINT8, + DataType::DT_QINT32, + DataType::DT_BFLOAT16, + DataType::DT_QINT16, + DataType::DT_QUINT16, + DataType::DT_UINT16, + DataType::DT_COMPLEX128, + DataType::DT_HALF, + DataType::DT_RESOURCE, + DataType::DT_FLOAT_REF, + DataType::DT_DOUBLE_REF, + DataType::DT_INT32_REF, + DataType::DT_UINT8_REF, + DataType::DT_INT16_REF, + DataType::DT_INT8_REF, + DataType::DT_STRING_REF, + DataType::DT_COMPLEX64_REF, + DataType::DT_INT64_REF, + DataType::DT_BOOL_REF, + DataType::DT_QINT8_REF, + DataType::DT_QUINT8_REF, + DataType::DT_QINT32_REF, + DataType::DT_BFLOAT16_REF, + DataType::DT_QINT16_REF, + DataType::DT_QUINT16_REF, + DataType::DT_UINT16_REF, + DataType::DT_COMPLEX128_REF, + DataType::DT_HALF_REF, + DataType::DT_RESOURCE_REF, + ]; + values + } + + fn enum_descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::EnumDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::EnumDescriptor, + }; + unsafe { + descriptor.get(|| { + ::protobuf::reflect::EnumDescriptor::new("DataType", file_descriptor_proto()) + }) + } + } +} + +impl ::std::marker::Copy for DataType { +} + +impl ::std::default::Default for DataType { + fn default() -> Self { + DataType::DT_INVALID + } +} + +impl ::protobuf::reflect::ProtobufValue for DataType { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Enum(self.descriptor()) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n%tensorflow/core/framework/types.proto\x12\ntensorflow*\xc2\x05\n\x08D\ + ataType\x12\x0e\n\nDT_INVALID\x10\0\x12\x0c\n\x08DT_FLOAT\x10\x01\x12\r\ + \n\tDT_DOUBLE\x10\x02\x12\x0c\n\x08DT_INT32\x10\x03\x12\x0c\n\x08DT_UINT\ + 8\x10\x04\x12\x0c\n\x08DT_INT16\x10\x05\x12\x0b\n\x07DT_INT8\x10\x06\x12\ + \r\n\tDT_STRING\x10\x07\x12\x10\n\x0cDT_COMPLEX64\x10\x08\x12\x0c\n\x08D\ + T_INT64\x10\t\x12\x0b\n\x07DT_BOOL\x10\n\x12\x0c\n\x08DT_QINT8\x10\x0b\ + \x12\r\n\tDT_QUINT8\x10\x0c\x12\r\n\tDT_QINT32\x10\r\x12\x0f\n\x0bDT_BFL\ + OAT16\x10\x0e\x12\r\n\tDT_QINT16\x10\x0f\x12\x0e\n\nDT_QUINT16\x10\x10\ + \x12\r\n\tDT_UINT16\x10\x11\x12\x11\n\rDT_COMPLEX128\x10\x12\x12\x0b\n\ + \x07DT_HALF\x10\x13\x12\x0f\n\x0bDT_RESOURCE\x10\x14\x12\x10\n\x0cDT_FLO\ + AT_REF\x10e\x12\x11\n\rDT_DOUBLE_REF\x10f\x12\x10\n\x0cDT_INT32_REF\x10g\ + \x12\x10\n\x0cDT_UINT8_REF\x10h\x12\x10\n\x0cDT_INT16_REF\x10i\x12\x0f\n\ + \x0bDT_INT8_REF\x10j\x12\x11\n\rDT_STRING_REF\x10k\x12\x14\n\x10DT_COMPL\ + EX64_REF\x10l\x12\x10\n\x0cDT_INT64_REF\x10m\x12\x0f\n\x0bDT_BOOL_REF\ + \x10n\x12\x10\n\x0cDT_QINT8_REF\x10o\x12\x11\n\rDT_QUINT8_REF\x10p\x12\ + \x11\n\rDT_QINT32_REF\x10q\x12\x13\n\x0fDT_BFLOAT16_REF\x10r\x12\x11\n\r\ + DT_QINT16_REF\x10s\x12\x12\n\x0eDT_QUINT16_REF\x10t\x12\x11\n\rDT_UINT16\ + _REF\x10u\x12\x15\n\x11DT_COMPLEX128_REF\x10v\x12\x0f\n\x0bDT_HALF_REF\ + \x10w\x12\x13\n\x0fDT_RESOURCE_REF\x10xB,\n\x18org.tensorflow.frameworkB\ + \x0bTypesProtosP\x01\xf8\x01\x01b\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/src/tfpb/versions.rs b/src/tfpb/versions.rs new file mode 100644 index 0000000000..99bb8be9cb --- /dev/null +++ b/src/tfpb/versions.rs @@ -0,0 +1,295 @@ +// This file is generated. Do not edit +// @generated + +// https://github.com/Manishearth/rust-clippy/issues/702 + + + +use protobuf::Message as Message_imported_for_functions; +use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; + +#[derive(PartialEq,Clone,Default)] +pub struct VersionDef { + // message fields + pub producer: i32, + pub min_consumer: i32, + pub bad_consumers: ::std::vec::Vec, + // special fields + unknown_fields: ::protobuf::UnknownFields, + cached_size: ::protobuf::CachedSize, +} + +// see codegen.rs for the explanation why impl Sync explicitly +unsafe impl ::std::marker::Sync for VersionDef {} + +impl VersionDef { + pub fn new() -> VersionDef { + ::std::default::Default::default() + } + + pub fn default_instance() -> &'static VersionDef { + static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const VersionDef, + }; + unsafe { + instance.get(VersionDef::new) + } + } + + // int32 producer = 1; + + pub fn clear_producer(&mut self) { + self.producer = 0; + } + + // Param is passed by value, moved + pub fn set_producer(&mut self, v: i32) { + self.producer = v; + } + + pub fn get_producer(&self) -> i32 { + self.producer + } + + fn get_producer_for_reflect(&self) -> &i32 { + &self.producer + } + + fn mut_producer_for_reflect(&mut self) -> &mut i32 { + &mut self.producer + } + + // int32 min_consumer = 2; + + pub fn clear_min_consumer(&mut self) { + self.min_consumer = 0; + } + + // Param is passed by value, moved + pub fn set_min_consumer(&mut self, v: i32) { + self.min_consumer = v; + } + + pub fn get_min_consumer(&self) -> i32 { + self.min_consumer + } + + fn get_min_consumer_for_reflect(&self) -> &i32 { + &self.min_consumer + } + + fn mut_min_consumer_for_reflect(&mut self) -> &mut i32 { + &mut self.min_consumer + } + + // repeated int32 bad_consumers = 3; + + pub fn clear_bad_consumers(&mut self) { + self.bad_consumers.clear(); + } + + // Param is passed by value, moved + pub fn set_bad_consumers(&mut self, v: ::std::vec::Vec) { + self.bad_consumers = v; + } + + // Mutable pointer to the field. + pub fn mut_bad_consumers(&mut self) -> &mut ::std::vec::Vec { + &mut self.bad_consumers + } + + // Take field + pub fn take_bad_consumers(&mut self) -> ::std::vec::Vec { + ::std::mem::replace(&mut self.bad_consumers, ::std::vec::Vec::new()) + } + + pub fn get_bad_consumers(&self) -> &[i32] { + &self.bad_consumers + } + + fn get_bad_consumers_for_reflect(&self) -> &::std::vec::Vec { + &self.bad_consumers + } + + fn mut_bad_consumers_for_reflect(&mut self) -> &mut ::std::vec::Vec { + &mut self.bad_consumers + } +} + +impl ::protobuf::Message for VersionDef { + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream) -> ::protobuf::ProtobufResult<()> { + while !is.eof()? { + let (field_number, wire_type) = is.read_tag_unpack()?; + match field_number { + 1 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.producer = tmp; + }, + 2 => { + if wire_type != ::protobuf::wire_format::WireTypeVarint { + return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); + } + let tmp = is.read_int32()?; + self.min_consumer = tmp; + }, + 3 => { + ::protobuf::rt::read_repeated_int32_into(wire_type, is, &mut self.bad_consumers)?; + }, + _ => { + ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u32 { + let mut my_size = 0; + if self.producer != 0 { + my_size += ::protobuf::rt::value_size(1, self.producer, ::protobuf::wire_format::WireTypeVarint); + } + if self.min_consumer != 0 { + my_size += ::protobuf::rt::value_size(2, self.min_consumer, ::protobuf::wire_format::WireTypeVarint); + } + for value in &self.bad_consumers { + my_size += ::protobuf::rt::value_size(3, *value, ::protobuf::wire_format::WireTypeVarint); + }; + my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); + self.cached_size.set(my_size); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream) -> ::protobuf::ProtobufResult<()> { + if self.producer != 0 { + os.write_int32(1, self.producer)?; + } + if self.min_consumer != 0 { + os.write_int32(2, self.min_consumer)?; + } + for v in &self.bad_consumers { + os.write_int32(3, *v)?; + }; + os.write_unknown_fields(self.get_unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn get_cached_size(&self) -> u32 { + self.cached_size.get() + } + + fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { + &self.unknown_fields + } + + fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { + &mut self.unknown_fields + } + + fn as_any(&self) -> &::std::any::Any { + self as &::std::any::Any + } + fn as_any_mut(&mut self) -> &mut ::std::any::Any { + self as &mut ::std::any::Any + } + fn into_any(self: Box) -> ::std::boxed::Box<::std::any::Any> { + self + } + + fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { + ::protobuf::MessageStatic::descriptor_static(None::) + } +} + +impl ::protobuf::MessageStatic for VersionDef { + fn new() -> VersionDef { + VersionDef::new() + } + + fn descriptor_static(_: ::std::option::Option) -> &'static ::protobuf::reflect::MessageDescriptor { + static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::reflect::MessageDescriptor, + }; + unsafe { + descriptor.get(|| { + let mut fields = ::std::vec::Vec::new(); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "producer", + VersionDef::get_producer_for_reflect, + VersionDef::mut_producer_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "min_consumer", + VersionDef::get_min_consumer_for_reflect, + VersionDef::mut_min_consumer_for_reflect, + )); + fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( + "bad_consumers", + VersionDef::get_bad_consumers_for_reflect, + VersionDef::mut_bad_consumers_for_reflect, + )); + ::protobuf::reflect::MessageDescriptor::new::( + "VersionDef", + fields, + file_descriptor_proto() + ) + }) + } + } +} + +impl ::protobuf::Clear for VersionDef { + fn clear(&mut self) { + self.clear_producer(); + self.clear_min_consumer(); + self.clear_bad_consumers(); + self.unknown_fields.clear(); + } +} + +impl ::std::fmt::Debug for VersionDef { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for VersionDef { + fn as_ref(&self) -> ::protobuf::reflect::ProtobufValueRef { + ::protobuf::reflect::ProtobufValueRef::Message(self) + } +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n(tensorflow/core/framework/versions.proto\x12\ntensorflow\"p\n\nVersio\ + nDef\x12\x1a\n\x08producer\x18\x01\x20\x01(\x05R\x08producer\x12!\n\x0cm\ + in_consumer\x18\x02\x20\x01(\x05R\x0bminConsumer\x12#\n\rbad_consumers\ + \x18\x03\x20\x03(\x05R\x0cbadConsumersB/\n\x18org.tensorflow.frameworkB\ + \x0eVersionsProtosP\x01\xf8\x01\x01b\x06proto3\ +"; + +static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy { + lock: ::protobuf::lazy::ONCE_INIT, + ptr: 0 as *const ::protobuf::descriptor::FileDescriptorProto, +}; + +fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { + ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() +} + +pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + unsafe { + file_descriptor_proto_lazy.get(|| { + parse_descriptor_proto() + }) + } +} diff --git a/tests/inceptionv3.rs b/tests/inceptionv3.rs index def0e6b799..0b1040c60d 100644 --- a/tests/inceptionv3.rs +++ b/tests/inceptionv3.rs @@ -4,8 +4,8 @@ extern crate dinghy_test; extern crate flate2; extern crate image; extern crate itertools; -extern crate mio_httpc; extern crate ndarray; +extern crate reqwest; extern crate tar; extern crate tfdeploy;