├── .gitignore ├── COPYRIGHT ├── Cargo.toml ├── LICENSE-MIT ├── README.md ├── examples ├── draw_graph.rs ├── draw_histo.rs ├── draw_image.rs ├── draw_scalar.rs └── stop.jpg └── src ├── event_file_writer.rs ├── lib.rs ├── masked_crc32c.rs ├── proto.rs ├── proto ├── api.proto ├── api.rs ├── attr_value.proto ├── attr_value.rs ├── event.proto ├── event.rs ├── graph.proto ├── graph.rs ├── layout.proto ├── layout.rs ├── node_def.proto ├── node_def.rs ├── plugin_hparams.proto ├── plugin_hparams.rs ├── plugin_mesh.proto ├── plugin_mesh.rs ├── plugin_pr_curve.proto ├── plugin_pr_curve.rs ├── plugin_text.proto ├── plugin_text.rs ├── resource_handle.proto ├── resource_handle.rs ├── step_stats.proto ├── step_stats.rs ├── summary.proto ├── summary.rs ├── tensor.proto ├── tensor.rs ├── tensor_shape.proto ├── tensor_shape.rs ├── types.proto ├── types.rs ├── update.sh ├── versions.proto └── versions.rs ├── record_writer.rs ├── summary.rs └── summary_writer.rs /.gitignore: -------------------------------------------------------------------------------- 1 | Cargo.lock 2 | target/ 3 | *~ 4 | examples/data/*.data 5 | logdir 6 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyrights in the auto-diff project are retained by their contributors. No 2 | copyright assignment is required to contribute to the auto-diff project. 3 | 4 | For full authorship information, see the version control history. 5 | 6 | Except as otherwise noted (below and/or in individual files), auto-diff is 7 | licensed under the MIT license 8 | or , at your option. 9 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tensorboard-rs" 3 | version = "0.2.4" 4 | authors = ["yguan "] 5 | edition = "2018" 6 | description = """ 7 | Write data for Tensorboard from Rust. 8 | 9 | 10 | """ 11 | documentation = "https://docs.rs/tensorboard-rs" 12 | homepage = "https://github.com/pipehappy1/tensorboard-rs" 13 | repository = "https://github.com/pipehappy1/tensorboard-rs" 14 | readme = "README.md" 15 | license = "MIT" 16 | keywords = ["machine-learning", "neural-network", "deep-learning"] 17 | exclude = ["/dev/**"] 18 | 19 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 20 | 21 | [dependencies] 22 | protobuf = "2.14" 23 | 24 | gethostname = "0.2.1" 25 | 26 | image = "0.23.4" 27 | 28 | auto-diff = "0.3.4" 29 | 30 | [dev-dependencies] 31 | protobuf-codegen = "2.14" 32 | 33 | 34 | [features] 35 | 36 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright 2018 Developers of the auto-diff project 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Not active, checkout https://github.com/pipehappy1/auto-diff 2 | 3 | # Write to tensorboard in Rust # 4 | 5 | Write TensorBoard events in Rust. 6 | 7 | * Can write `scalar`, `image`, `histogram`. 8 | 9 | ## Example 10 | 11 | * Write multiple scalar in one plot. 12 | 13 | ```rust,no_run 14 | let mut writer = SummaryWriter::new(&("./logdir".to_string())); 15 | 16 | for n_iter in 0..100 { 17 | let mut map = HashMap::new(); 18 | map.insert("x1".to_string(), (n_iter as f32)); 19 | map.insert("x^2".to_string(), (n_iter as f32) * (n_iter as f32)); 20 | writer.add_scalars("data/scalar_group", &map, n_iter); 21 | } 22 | writer.flush(); 23 | ``` 24 | -------------------------------------------------------------------------------- /examples/draw_graph.rs: -------------------------------------------------------------------------------- 1 | use tensorboard_rs::summary_writer::SummaryWriter; 2 | use tensorboard_rs::proto::event::{Event, TaggedRunMetadata}; 3 | use tensorboard_rs::proto::summary::{Summary}; 4 | use tensorboard_rs::proto::graph::{GraphDef, }; 5 | use tensorboard_rs::proto::node_def::{NodeDef, }; 6 | use tensorboard_rs::proto::versions::{VersionDef, }; 7 | use tensorboard_rs::proto::attr_value::{AttrValue, }; 8 | use tensorboard_rs::proto::tensor_shape::{TensorShapeProto, }; 9 | use tensorboard_rs::proto::step_stats::{RunMetadata, }; 10 | use protobuf::RepeatedField; 11 | use std::collections::HashMap; 12 | 13 | pub fn main() { 14 | let mut writer = SummaryWriter::new(&("./logdir".to_string())); 15 | 16 | let mut node1 = NodeDef::new(); 17 | node1.set_name("node1".to_string()); 18 | node1.set_op("op1".to_string()); 19 | 20 | let inputs = RepeatedField::from(vec![]); 21 | node1.set_input(inputs); 22 | 23 | let mut attrs = HashMap::new(); 24 | let mut v1 = AttrValue::new(); 25 | v1.set_i(16); 26 | attrs.insert("attr1".to_string(), v1); 27 | node1.set_attr(attrs); 28 | 29 | writer.add_graph(&[node1]); 30 | 31 | writer.flush(); 32 | } 33 | -------------------------------------------------------------------------------- /examples/draw_histo.rs: -------------------------------------------------------------------------------- 1 | use tensorboard_rs::summary_writer::SummaryWriter; 2 | use image::{open, }; 3 | 4 | pub fn main() { 5 | 6 | let mut writer = SummaryWriter::new(&("./logdir".to_string())); 7 | 8 | let min = 1.001; 9 | let max = 29.001; 10 | let num = 435.; 11 | let sum = 8555.435; 12 | let sum_squares = 189242.110435; 13 | let bucket_limits = [3.8009999999999997, 6.600999999999999, 9.400999999999998, 12.200999999999999, 15.001, 17.801, 20.601, 23.401, 26.201, 29.001]; 14 | let bucket_counts = [ 6., 15., 24., 33., 27., 48., 57., 66., 75., 84.]; 15 | 16 | writer.add_histogram_raw("run1/histo1", 17 | min, max, 18 | num, 19 | sum, sum_squares, 20 | &bucket_limits, &bucket_counts, 21 | 1 22 | ); 23 | 24 | writer.add_histogram_raw("run1/histo1", 25 | min, max, 26 | num, 27 | sum, sum_squares, 28 | &bucket_limits, &bucket_counts, 29 | 2 30 | ); 31 | 32 | writer.add_histogram_raw("run1/histo1", 33 | min, max, 34 | num, 35 | sum, sum_squares, 36 | &bucket_limits, &bucket_counts, 37 | 3 38 | ); 39 | writer.flush(); 40 | } 41 | -------------------------------------------------------------------------------- /examples/draw_image.rs: -------------------------------------------------------------------------------- 1 | use tensorboard_rs::summary_writer::SummaryWriter; 2 | use image::{open, }; 3 | 4 | pub fn main() { 5 | 6 | let mut writer = SummaryWriter::new(&("./logdir".to_string())); 7 | 8 | let stop_image = "./examples/stop.jpg"; 9 | let img = open(stop_image).expect(""); 10 | let img = img.into_rgb(); 11 | let (width, height) = img.dimensions(); 12 | 13 | 14 | writer.add_image(&"test_image".to_string(), &img.into_raw()[..], &vec![3, width as usize, height as usize][..], 12); 15 | writer.flush(); 16 | } 17 | -------------------------------------------------------------------------------- /examples/draw_scalar.rs: -------------------------------------------------------------------------------- 1 | use tensorboard_rs::summary_writer::SummaryWriter; 2 | use std::collections::HashMap; 3 | 4 | pub fn main() { 5 | let mut writer = SummaryWriter::new(&("./logdir".to_string())); 6 | 7 | let name = "run1"; 8 | let mut scalar = 2.3; 9 | let mut step = 12; 10 | for i in 0..2 { 11 | println!("{}", i); 12 | scalar += (i as f32)*0.1; 13 | step += i; 14 | 15 | writer.add_scalar(name, scalar, step); 16 | } 17 | writer.flush(); 18 | 19 | for n_iter in 0..100 { 20 | let mut map = HashMap::new(); 21 | map.insert("xsinx".to_string(), (n_iter as f32) * (n_iter as f32).sin()); 22 | map.insert("xcosx".to_string(), (n_iter as f32) * (n_iter as f32).cos()); 23 | map.insert("arctanx".to_string(), (n_iter as f32).atan()); 24 | writer.add_scalars("data/scalar_group", &map, n_iter); 25 | } 26 | writer.flush(); 27 | } 28 | -------------------------------------------------------------------------------- /examples/stop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pipehappy1/tensorboard-rs/3c166a5a5370284e3e52be055cd4a412ea72ee2f/examples/stop.jpg -------------------------------------------------------------------------------- /src/event_file_writer.rs: -------------------------------------------------------------------------------- 1 | use std::path::{PathBuf, Path}; 2 | use std::fs; 3 | use std::time::SystemTime; 4 | use gethostname::gethostname; 5 | use std::process::id; 6 | use std::fs::File; 7 | use protobuf::Message; 8 | use std::thread::{spawn, JoinHandle}; 9 | use std::sync::mpsc::{channel, Sender}; 10 | 11 | use crate::proto::event::Event; 12 | use crate::record_writer::RecordWriter; 13 | 14 | enum EventSignal { 15 | Data(Vec), 16 | Flush, 17 | Stop, 18 | } 19 | 20 | pub struct EventFileWriter { 21 | logdir: PathBuf, 22 | writer: Sender, 23 | child: Option>, 24 | } 25 | impl EventFileWriter { 26 | //pub fn new>(logdir: P) -> EventFileWriter { 27 | pub fn new>(logdir: P) -> EventFileWriter { 28 | let logdir = logdir.as_ref().to_path_buf(); 29 | 30 | fs::create_dir_all(&logdir).expect(""); 31 | 32 | let mut time = 0; 33 | let mut time_full = 0.0; 34 | if let Ok(n) = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) { 35 | time = n.as_secs(); 36 | time_full = n.as_secs_f64(); 37 | } 38 | let hostname = gethostname().into_string().expect(""); 39 | let pid = id(); 40 | 41 | let file_name = format!("events.out.tfevents.{:010}.{}.{}.{}", time, hostname, pid, 0); 42 | //let file_writer = File::create(logdir.join(file_name)).expect(""); 43 | //let writer = RecordWriter::new(file_writer); 44 | 45 | let logdir_move = logdir.clone(); 46 | let (tx, rx) = channel(); 47 | let child = spawn(move || { 48 | let file_writer = File::create(logdir_move.join(file_name)).expect(""); 49 | let mut writer = RecordWriter::new(file_writer); 50 | 51 | loop { 52 | let result: EventSignal = rx.recv().unwrap(); 53 | match result { 54 | EventSignal::Data(d) => { 55 | writer.write(&d).expect("write error"); 56 | }, 57 | EventSignal::Flush => {writer.flush().expect("flush error");}, 58 | EventSignal::Stop => {break;}, 59 | } 60 | }; 61 | writer.flush().expect("flush error"); 62 | }); 63 | 64 | let mut ret = EventFileWriter { 65 | logdir: logdir, 66 | writer: tx, 67 | child: Some(child), 68 | }; 69 | 70 | let mut evn = Event::new(); 71 | evn.set_wall_time(time_full); 72 | evn.set_file_version("brain.Event:2".to_string()); 73 | ret.add_event(&evn); 74 | ret.flush(); 75 | 76 | ret 77 | } 78 | } 79 | 80 | impl EventFileWriter { 81 | pub fn get_logdir(&self) -> PathBuf { 82 | self.logdir.to_path_buf() 83 | } 84 | 85 | pub fn add_event(&mut self, event: &Event) { 86 | let mut data: Vec = Vec::new(); 87 | event.write_to_vec(&mut data).expect(""); 88 | self.writer.send(EventSignal::Data(data)).expect(""); 89 | } 90 | 91 | pub fn flush(&mut self) { 92 | self.writer.send(EventSignal::Flush).expect(""); 93 | } 94 | } 95 | 96 | impl Drop for EventFileWriter { 97 | fn drop(&mut self) { 98 | self.writer.send(EventSignal::Stop).expect(""); 99 | self.child.take().unwrap().join().expect(""); 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | 2 | //! Write data for Tensorboard from Rust. 3 | //! ============================================================= 4 | //! 5 | //! 6 | //! Introduction 7 | //! ------------ 8 | //! 9 | //! Install 10 | //! ------------ 11 | //! 12 | //! Example 13 | //! ------------ 14 | //! 15 | //! Licese 16 | //! ------------ 17 | 18 | 19 | 20 | 21 | pub mod proto; 22 | pub mod masked_crc32c; 23 | pub mod record_writer; 24 | pub mod event_file_writer; 25 | pub mod summary_writer; 26 | pub mod summary; 27 | -------------------------------------------------------------------------------- /src/masked_crc32c.rs: -------------------------------------------------------------------------------- 1 | pub fn masked_crc32c(data: &[u8]) -> u32 { 2 | let x = crc32c(data); 3 | ((x >> 15) | (x << 17)).overflowing_add(0xa282ead8).0 4 | } 5 | 6 | //pub fn u32(data: &[u8]) -> u32{ 7 | // 8 | //} 9 | 10 | const CRC_TABLE: [u32; 256] = [ 11 | 0x00000000, 0xf26b8303, 0xe13b70f7, 0x1350f3f4, 12 | 0xc79a971f, 0x35f1141c, 0x26a1e7e8, 0xd4ca64eb, 13 | 0x8ad958cf, 0x78b2dbcc, 0x6be22838, 0x9989ab3b, 14 | 0x4d43cfd0, 0xbf284cd3, 0xac78bf27, 0x5e133c24, 15 | 0x105ec76f, 0xe235446c, 0xf165b798, 0x030e349b, 16 | 0xd7c45070, 0x25afd373, 0x36ff2087, 0xc494a384, 17 | 0x9a879fa0, 0x68ec1ca3, 0x7bbcef57, 0x89d76c54, 18 | 0x5d1d08bf, 0xaf768bbc, 0xbc267848, 0x4e4dfb4b, 19 | 0x20bd8ede, 0xd2d60ddd, 0xc186fe29, 0x33ed7d2a, 20 | 0xe72719c1, 0x154c9ac2, 0x061c6936, 0xf477ea35, 21 | 0xaa64d611, 0x580f5512, 0x4b5fa6e6, 0xb93425e5, 22 | 0x6dfe410e, 0x9f95c20d, 0x8cc531f9, 0x7eaeb2fa, 23 | 0x30e349b1, 0xc288cab2, 0xd1d83946, 0x23b3ba45, 24 | 0xf779deae, 0x05125dad, 0x1642ae59, 0xe4292d5a, 25 | 0xba3a117e, 0x4851927d, 0x5b016189, 0xa96ae28a, 26 | 0x7da08661, 0x8fcb0562, 0x9c9bf696, 0x6ef07595, 27 | 0x417b1dbc, 0xb3109ebf, 0xa0406d4b, 0x522bee48, 28 | 0x86e18aa3, 0x748a09a0, 0x67dafa54, 0x95b17957, 29 | 0xcba24573, 0x39c9c670, 0x2a993584, 0xd8f2b687, 30 | 0x0c38d26c, 0xfe53516f, 0xed03a29b, 0x1f682198, 31 | 0x5125dad3, 0xa34e59d0, 0xb01eaa24, 0x42752927, 32 | 0x96bf4dcc, 0x64d4cecf, 0x77843d3b, 0x85efbe38, 33 | 0xdbfc821c, 0x2997011f, 0x3ac7f2eb, 0xc8ac71e8, 34 | 0x1c661503, 0xee0d9600, 0xfd5d65f4, 0x0f36e6f7, 35 | 0x61c69362, 0x93ad1061, 0x80fde395, 0x72966096, 36 | 0xa65c047d, 0x5437877e, 0x4767748a, 0xb50cf789, 37 | 0xeb1fcbad, 0x197448ae, 0x0a24bb5a, 0xf84f3859, 38 | 0x2c855cb2, 0xdeeedfb1, 0xcdbe2c45, 0x3fd5af46, 39 | 0x7198540d, 0x83f3d70e, 0x90a324fa, 0x62c8a7f9, 40 | 0xb602c312, 0x44694011, 0x5739b3e5, 0xa55230e6, 41 | 0xfb410cc2, 0x092a8fc1, 0x1a7a7c35, 0xe811ff36, 42 | 0x3cdb9bdd, 0xceb018de, 0xdde0eb2a, 0x2f8b6829, 43 | 0x82f63b78, 0x709db87b, 0x63cd4b8f, 0x91a6c88c, 44 | 0x456cac67, 0xb7072f64, 0xa457dc90, 0x563c5f93, 45 | 0x082f63b7, 0xfa44e0b4, 0xe9141340, 0x1b7f9043, 46 | 0xcfb5f4a8, 0x3dde77ab, 0x2e8e845f, 0xdce5075c, 47 | 0x92a8fc17, 0x60c37f14, 0x73938ce0, 0x81f80fe3, 48 | 0x55326b08, 0xa759e80b, 0xb4091bff, 0x466298fc, 49 | 0x1871a4d8, 0xea1a27db, 0xf94ad42f, 0x0b21572c, 50 | 0xdfeb33c7, 0x2d80b0c4, 0x3ed04330, 0xccbbc033, 51 | 0xa24bb5a6, 0x502036a5, 0x4370c551, 0xb11b4652, 52 | 0x65d122b9, 0x97baa1ba, 0x84ea524e, 0x7681d14d, 53 | 0x2892ed69, 0xdaf96e6a, 0xc9a99d9e, 0x3bc21e9d, 54 | 0xef087a76, 0x1d63f975, 0x0e330a81, 0xfc588982, 55 | 0xb21572c9, 0x407ef1ca, 0x532e023e, 0xa145813d, 56 | 0x758fe5d6, 0x87e466d5, 0x94b49521, 0x66df1622, 57 | 0x38cc2a06, 0xcaa7a905, 0xd9f75af1, 0x2b9cd9f2, 58 | 0xff56bd19, 0x0d3d3e1a, 0x1e6dcdee, 0xec064eed, 59 | 0xc38d26c4, 0x31e6a5c7, 0x22b65633, 0xd0ddd530, 60 | 0x0417b1db, 0xf67c32d8, 0xe52cc12c, 0x1747422f, 61 | 0x49547e0b, 0xbb3ffd08, 0xa86f0efc, 0x5a048dff, 62 | 0x8ecee914, 0x7ca56a17, 0x6ff599e3, 0x9d9e1ae0, 63 | 0xd3d3e1ab, 0x21b862a8, 0x32e8915c, 0xc083125f, 64 | 0x144976b4, 0xe622f5b7, 0xf5720643, 0x07198540, 65 | 0x590ab964, 0xab613a67, 0xb831c993, 0x4a5a4a90, 66 | 0x9e902e7b, 0x6cfbad78, 0x7fab5e8c, 0x8dc0dd8f, 67 | 0xe330a81a, 0x115b2b19, 0x020bd8ed, 0xf0605bee, 68 | 0x24aa3f05, 0xd6c1bc06, 0xc5914ff2, 0x37faccf1, 69 | 0x69e9f0d5, 0x9b8273d6, 0x88d28022, 0x7ab90321, 70 | 0xae7367ca, 0x5c18e4c9, 0x4f48173d, 0xbd23943e, 71 | 0xf36e6f75, 0x0105ec76, 0x12551f82, 0xe03e9c81, 72 | 0x34f4f86a, 0xc69f7b69, 0xd5cf889d, 0x27a40b9e, 73 | 0x79b737ba, 0x8bdcb4b9, 0x988c474d, 0x6ae7c44e, 74 | 0xbe2da0a5, 0x4c4623a6, 0x5f16d052, 0xad7d5351, 75 | ]; 76 | 77 | const CRC_INIT: u32 = 0; 78 | 79 | const _MASK: u32 = 0xFFFFFFFF; 80 | 81 | pub fn crc_update(crc: u32, data: &[u8]) -> u32 { 82 | let mut crc = crc ^ _MASK; 83 | for b in data { 84 | let table_index = ((crc & 0xff ) as u8 )^ b; 85 | crc = (CRC_TABLE[table_index as usize] ^ (crc >> 8)) & _MASK; 86 | } 87 | crc ^ _MASK 88 | } 89 | 90 | pub fn crc_finalize(crc: u32) -> u32{ 91 | crc & _MASK 92 | } 93 | 94 | pub fn crc32c(data: &[u8]) -> u32 { 95 | crc_finalize(crc_update(CRC_INIT, data)) 96 | } 97 | -------------------------------------------------------------------------------- /src/proto.rs: -------------------------------------------------------------------------------- 1 | pub mod api; 2 | pub mod attr_value; 3 | pub mod event; 4 | pub mod graph; 5 | pub mod layout; 6 | pub mod node_def; 7 | pub mod plugin_hparams; 8 | pub mod plugin_mesh; 9 | pub mod plugin_pr_curve; 10 | pub mod plugin_text; 11 | pub mod resource_handle; 12 | pub mod step_stats; 13 | pub mod summary; 14 | pub mod tensor; 15 | pub mod tensor_shape; 16 | pub mod types; 17 | pub mod versions; 18 | -------------------------------------------------------------------------------- /src/proto/api.proto: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | // Defines a proto3-based REST API that the HParams web-component of the plugin 17 | // would use to read data from a hyperparameter-tuning experiment. 18 | // This file defines the message types (resources) used 19 | // to pass information into and out of the API methods. These messages will be 20 | // transmitted using proto3 native JSON encoding. See http_api.md for a 21 | // description of the actual HTTP API. 22 | 23 | // General note: in what follows we use the field 'name' of a message to 24 | // stores its id. We avoid calling this field 'id' since it is a reserved word 25 | // in Python, as well as to be more compliant with the API style guide 26 | // detailed in https://cloud.google.com/apis/design/. 27 | 28 | // IMPORTANT: If you change any of the messages here, make sure to also update 29 | // api.d.ts accordingly. 30 | 31 | syntax = "proto3"; 32 | 33 | import "google/protobuf/struct.proto"; 34 | 35 | package tensorboardrs.hparam; 36 | 37 | // Represents a single experiment. 38 | // An experiment consists of multiple "sessions". Typically, in each session 39 | // a model is trained for a given set of hyperparameter values. In each session 40 | // a training program may generate one or more series of real numbers--each 41 | // containing the evaluation of some metric on the model at different training 42 | // steps. 43 | // 44 | // Note that Sessions can consist of multiple Tensorboard "runs", since in 45 | // a distributed Tensorflow deployment, training can be accomplished using 46 | // several cooporating processes, each one emitting Summary data to a different 47 | // log directory or run. For example, in a single session one process could 48 | // periodically compute the loss on the validation set, and another could 49 | // compute the loss on the training set. 50 | // NEXT_TAG: 7 51 | message Experiment { 52 | // -- Experiments are scoped by a global name. 53 | // Currently, Tensorboard supports displaying data for a single experiment. 54 | string name = 6; 55 | 56 | // A description. May contain markdown. 57 | string description = 1; 58 | 59 | // An id for the owning user or group. 60 | string user = 2; 61 | 62 | // The time the experiment was created. In seconds since the UNIX epoch. 63 | double time_created_secs = 3; 64 | 65 | // Information about each hyperparameter used in the experiment. 66 | repeated HParamInfo hparam_infos = 4; 67 | 68 | // Information about each metric used in the experiment. 69 | repeated MetricInfo metric_infos = 5; 70 | } 71 | 72 | // NEXT_TAG: 7 73 | message HParamInfo { 74 | // An id for the hyperparameter. 75 | string name = 1; 76 | 77 | // A string used to display the hyperparameter in the UI. If empty, the UI 78 | // will display the 'name' field. 79 | string display_name = 2; 80 | 81 | // A description. May contain markdown. 82 | string description = 3; 83 | 84 | // The data type of this hyperparameter. 85 | DataType type = 4; 86 | 87 | // Specifies the set of values this hyperparameter can hold. The UI assumes 88 | // every instance of this hyperparameter will hold a value from this set. It 89 | // is used by the UI to allow filtering so that only session groups (see 90 | // below) whose associated hyperparameter value "passes" the filter are 91 | // displayed. If this is not populated, the domain is assumed to be the 92 | // entire domain of the type of the hyperparameter. 93 | oneof domain { 94 | // A discrete set of the values this hyperparameter can hold. 95 | google.protobuf.ListValue domain_discrete = 5; 96 | // Numeric data type only. The (real) interval from which values of this 97 | // hyperparameter are taken. 98 | Interval domain_interval = 6; 99 | } 100 | } 101 | 102 | enum DataType { 103 | DATA_TYPE_UNSET = 0; 104 | DATA_TYPE_STRING = 1; 105 | DATA_TYPE_BOOL = 2; 106 | DATA_TYPE_FLOAT64 = 3; 107 | } 108 | 109 | // Represents the closed interval [min_value, max_value] of the real line. 110 | // NEXT_TAG: 3 111 | message Interval { 112 | double min_value = 1; 113 | double max_value = 2; 114 | } 115 | 116 | // NEXT_TAG: 3 117 | message MetricName { 118 | // An identifier for a metric. A metric is a real-valued function of the 119 | // model. The UI can plot metrics for a session evaluated on the model at 120 | // different training steps. 121 | // 122 | // We identify a metric by a (group, tag) pair of strings. The UI treats 123 | // both of these as opaque strings. The only requirement is that the pair 124 | // uniquely identifies a metric in the experiment. 125 | // 126 | // We use a pair so the UI could allow the user to group metrics for a 127 | // single session by either group or tag to be displayed in the same chart. 128 | // For instance, one can set the metric group to correspond to the dataset 129 | // on which the model was evaluated, and the UI can then display different 130 | // metrics describing the same underlying computation and using different 131 | // datasets, on the same chart. 132 | // 133 | // When exporting summaries from Tensorflow, in a typical setup, a 134 | // training session exports evaluations of metrics at different training steps 135 | // as Scalar-plugin summaries--each having a run of the form 136 | // "/", and some associated tag. The same 137 | // metric for different sessions would use the same sub_dir and tag, but 138 | // would have a different session_base_log_dir. For example, a session 139 | // computing two metrics: model loss on the validation set and model loss on 140 | // the training set, can export these as scalar summaries with the tag "loss" 141 | // and runs session_base_log_dir/validation and session_base_log_dir/training, 142 | // respectively. In this setup, the 'group' field can be populated with 143 | // the "sub_dir" associated with the metric, and the 'tag' field can be 144 | // populated with the tag: "loss". 145 | string group = 1; 146 | string tag = 2; 147 | } 148 | 149 | // NEXT_TAG: 6 150 | message MetricInfo { 151 | MetricName name = 1; 152 | 153 | // A string used to display the metric in the UI. If empty, the UI 154 | // will display the 'name' field. 155 | string display_name = 3; 156 | 157 | // A description. May contain markdown. 158 | string description = 4; 159 | 160 | // The dataset type (validation, training) on which the metric is computed. 161 | DatasetType dataset_type = 5; 162 | } 163 | 164 | enum DatasetType { 165 | DATASET_UNKNOWN = 0; 166 | DATASET_TRAINING = 1; 167 | DATASET_VALIDATION = 2; 168 | } 169 | 170 | // In some experiments, the user trains a model with the same set of 171 | // hyperparameters multiple times to get the distribution of metric 172 | // evaluations, when the computation (such as the training algorithm, or metric 173 | // evaluation) is non-deterministic. To make the UI aware of this, sessions 174 | // are partitioned into groups: each group consists of all training sessions 175 | // which share the same values for the hyperparameters. In experiments with no 176 | // repeated executions, each group consists of exactly one session. 177 | // NEXT_TAG: 6 178 | message SessionGroup { 179 | string name = 1; 180 | 181 | // Stores the hyperparameters for sessions within this group as a mapping 182 | // from the hyperparameter name to its value. 183 | map hparams = 2; 184 | 185 | // A list of pairs (metric, value)--one for each metric in the experiment. 186 | // The value denotes the evaluation of the corresponding metric on 187 | // the model aggregated across the sessions in this group. The exact method 188 | // of aggregation is specified in the comments of ListSessionGroupsRequest. 189 | // Unfortunately, we can't store these as a map, since proto maps can't have 190 | // message keys. 191 | repeated MetricValue metric_values = 3; 192 | 193 | // The sessions belonging to this group. 194 | repeated Session sessions = 4; 195 | 196 | // An optional link to a web page monitoring the session group. 197 | string monitor_url = 5; 198 | } 199 | 200 | // NEXT_TAG: 5 201 | message MetricValue { 202 | MetricName name = 1; 203 | 204 | double value = 2; 205 | 206 | // The training step at which this value is computed. 207 | int32 training_step = 3; 208 | 209 | // The wall time in seconds since UNIX epoch at which this value is computed. 210 | double wall_time_secs = 4; 211 | } 212 | 213 | // NEXT_TAG: 8 214 | message Session { 215 | // An id for the session. Unique within an experiment (not just the group). 216 | string name = 1; 217 | 218 | // In seconds since the UNIX epoch. 219 | double start_time_secs = 2; 220 | 221 | // In seconds since the UNIX epoch. 222 | // May be 0 if unavailable or the session has not finished yet. 223 | double end_time_secs = 3; 224 | 225 | // May be STATUS_UNKNOWN if unavailable. 226 | Status status = 4; 227 | 228 | // A URI for a resource that will allow the user to reconstruct the model for 229 | // this session. E.g., in Tensorflow this could point to a directory where the 230 | // checkpoints are stored. Currently, this is treated opaquely by the UI 231 | // and only displayed to the user as it is passed here. 232 | string model_uri = 5; 233 | 234 | // Stores each metric evaluation on the model at the current training step. 235 | // Unfortunately, we can't store these as a map, since proto maps can't have 236 | // message keys. 237 | repeated MetricValue metric_values = 6; 238 | 239 | // An optional link to a web page monitoring the session. 240 | string monitor_url = 7; 241 | } 242 | 243 | // Represents the status of a Session. 244 | enum Status { 245 | STATUS_UNKNOWN = 0; 246 | STATUS_SUCCESS = 1; 247 | STATUS_FAILURE = 2; 248 | STATUS_RUNNING = 3; 249 | } 250 | 251 | // Parameters for a GetExperiment API call. 252 | // Each experiment is scoped by a unique global id. 253 | // NEXT_TAG: 2 254 | message GetExperimentRequest { 255 | // REQUIRED 256 | string experiment_name = 1; 257 | } 258 | 259 | // Parameters for a ListSessionGroups API call. 260 | // Computes a list of the current session groups allowing for filtering and 261 | // sorting by metrics and hyperparameter values. Returns a "slice" of 262 | // that list specified by start_index and slice_size. 263 | // NEXT_TAG: 8 264 | message ListSessionGroupsRequest { 265 | string experiment_name = 6; 266 | 267 | // Filters the set of sessions (from which the session groups are formed) to 268 | // contain only these sessions whose status is contained in 269 | // 'allowed_statuses'. 270 | repeated Status allowed_statuses = 7; 271 | 272 | // A list of ColParams messages--one for each "column" of a session group. A 273 | // session group column contains either a metric evaluated at the current 274 | // reported computation step or a hyperparameter value. In addition to 275 | // 'regular' values, a column may take on a special 'missing-value' which 276 | // denotes that the hyperparameter or metric is not available 277 | // for the session group (for example, if the metric is not used in the 278 | // group). 279 | // 280 | // The ColParams messages in the repeated field below configure filtering and 281 | // sorting of the resulting collection of session groups. See the comments of 282 | // the fields in the ColParam message below for more details. 283 | repeated ColParams col_params = 1; 284 | 285 | // Fields controlling how to aggregate metrics across sessions within a 286 | // session group. 287 | // If aggregation_type is AGGREGATION_AVG, each metric value of the 288 | // session group is the average of the values of the metric across the 289 | // sessions. 290 | // Otherwise, the session group metric values are taken directly from a 291 | // "representative" session in the group, selected as a session for which 292 | // primary_metric takes on its minimum, maximum, or median value, as 293 | // specified by the choice of aggregation_type (for median, if the number of 294 | // sessions in the group is even, a session with a lower "middle" value is 295 | // chosen as the representative session). 296 | AggregationType aggregation_type = 2; 297 | 298 | // See comment for 'aggregation_type' above. 299 | MetricName aggregation_metric = 3; 300 | 301 | // The next two parameters determine the "slice" of the full list of 302 | // session groups--sorted and filtered by the parameters above--to return. 303 | // The 0-based index of the first session group to return. 304 | int32 start_index = 4; 305 | 306 | // The number of session groups to return starting at the session group 307 | // indexed by 'start_index'. The actual number of session groups returned 308 | // is min{slice_size, total_size - start_index}, where 309 | // total_size is the number of session groups in the full list 310 | // sorted and filtered by the parameters above (if start_index > total_size 311 | // no session groups are returned). 312 | int32 slice_size = 5; 313 | } 314 | 315 | // Defines parmeters for a ListSessionGroupsRequest for a specific column. 316 | // See the comment for "ListSessionGroupsRequest" above for more details. 317 | // NEXT_TAG: 9 318 | message ColParams { 319 | oneof name { 320 | MetricName metric = 1; 321 | string hparam = 2; 322 | } 323 | 324 | // Sorting. 325 | // The final order of session groups in the response is defined by the sub 326 | // collection of ColParams messages (out of the 327 | // ListSessionGroupsRequest.col_params repeated field) whose 'order' field 328 | // (below) is not ORDER_UNSPECIFIED. In each of the messages in this 329 | // sub-collection, the next two fields specify the ordering of the values 330 | // and missing_values in the associated column of the session group. The 331 | // order of the ColParams messages themselves within the sub-collection 332 | // determines the "significance" of the associated column as a sorting key: 333 | // with the first being the primary sorting key, the second being the 334 | // secondary sorting key, etc. 335 | // Note: The 'session group name' is added as a least significant sorting 336 | // key to the keys defined by the user, so the order in the response is always 337 | // deterministic. 338 | SortOrder order = 3; 339 | // This field is ignored if order is ORDER_UNSPECIFIED. 340 | // Otherwise, if true, missing values are ordered before every other value in 341 | // the column; if false they are ordered after every other value in the 342 | // column. 343 | bool missing_values_first = 4; 344 | 345 | // Filtering. 346 | // The 'filter' oneof specifies a subset of the domain of the values a column 347 | // may take. Only session groups with each of their column values belonging 348 | // to this subset are included in the response. If this field is not 349 | // specified, the subset is taken to be the entire column domain. 350 | oneof filter { 351 | // Only valid for string-valued hyperparameter columns. The subset is 352 | // the set of all strings matching the regular expression stored 353 | // in 'regexp' as a partial match (use '^$' to have a full 354 | // match against regexp). 355 | string filter_regexp = 5; 356 | 357 | // Only valid for numeric-valued columns. The subset is the given interval. 358 | Interval filter_interval = 6; 359 | 360 | // Valid for all data types. The subset is defined explicitly. 361 | google.protobuf.ListValue filter_discrete = 7; 362 | } 363 | // Specifies whether to exclude session groups whose column value is missing 364 | // from the response. 365 | bool exclude_missing_values = 8; 366 | } 367 | 368 | enum SortOrder { 369 | ORDER_UNSPECIFIED = 0; 370 | ORDER_ASC = 1; 371 | ORDER_DESC = 2; 372 | } 373 | 374 | enum AggregationType { 375 | AGGREGATION_UNSET = 0; 376 | AGGREGATION_AVG = 1; 377 | AGGREGATION_MEDIAN = 2; 378 | AGGREGATION_MIN = 3; 379 | AGGREGATION_MAX = 4; 380 | } 381 | 382 | // See ListSessionGroups in http_api.md. 383 | // NEXT_TAG: 4 384 | message ListSessionGroupsResponse { 385 | repeated SessionGroup session_groups = 1; 386 | 387 | // Denotes the total number of session groups in the full filtered list. 388 | // (Recall that this response may only be a slice). 389 | // It is used by the UI to calculate total number of pages and can be 390 | // set here to -1 to mean "unknown". 391 | int32 total_size = 3; 392 | } 393 | 394 | // See ListMetricEvalsRequest in http_api.md. 395 | // NEXT_TAG: 4 396 | message ListMetricEvalsRequest { 397 | string experiment_name = 3; 398 | string session_name = 1; 399 | MetricName metric_name = 2; 400 | } 401 | -------------------------------------------------------------------------------- /src/proto/attr_value.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorboardrs; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "AttrValueProtos"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | 9 | import "src/tensorboardrs/proto/tensor.proto"; 10 | import "src/tensorboardrs/proto/tensor_shape.proto"; 11 | import "src/tensorboardrs/proto/types.proto"; 12 | 13 | // Protocol buffer representing the value for an attr used to configure an Op. 14 | // Comment indicates the corresponding attr type. Only the field matching the 15 | // attr type may be filled. 16 | message AttrValue { 17 | // LINT.IfChange 18 | message ListValue { 19 | repeated bytes s = 2; // "list(string)" 20 | repeated int64 i = 3 [packed = true]; // "list(int)" 21 | repeated float f = 4 [packed = true]; // "list(float)" 22 | repeated bool b = 5 [packed = true]; // "list(bool)" 23 | repeated DataType type = 6 [packed = true]; // "list(type)" 24 | repeated TensorShapeProto shape = 7; // "list(shape)" 25 | repeated TensorProto tensor = 8; // "list(tensor)" 26 | repeated NameAttrList func = 9; // "list(attr)" 27 | } 28 | // LINT.ThenChange(https://www.tensorflow.org/code/tensorflow/c/c_api.cc) 29 | 30 | oneof value { 31 | bytes s = 2; // "string" 32 | int64 i = 3; // "int" 33 | float f = 4; // "float" 34 | bool b = 5; // "bool" 35 | DataType type = 6; // "type" 36 | TensorShapeProto shape = 7; // "shape" 37 | TensorProto tensor = 8; // "tensor" 38 | ListValue list = 1; // any "list(...)" 39 | 40 | // "func" represents a function. func.name is a function's name or 41 | // a primitive op's name. func.attr.first is the name of an attr 42 | // defined for that function. func.attr.second is the value for 43 | // that attr in the instantiation. 44 | NameAttrList func = 10; 45 | 46 | // This is a placeholder only used in nodes defined inside a 47 | // function. It indicates the attr value will be supplied when 48 | // the function is instantiated. For example, let us suppose a 49 | // node "N" in function "FN". "N" has an attr "A" with value 50 | // placeholder = "foo". When FN is instantiated with attr "foo" 51 | // set to "bar", the instantiated node N's attr A will have been 52 | // given the value "bar". 53 | string placeholder = 9; 54 | } 55 | } 56 | 57 | // A list of attr names and their values. The whole list is attached 58 | // with a string name. E.g., MatMul[T=float]. 59 | message NameAttrList { 60 | string name = 1; 61 | map attr = 2; 62 | } 63 | -------------------------------------------------------------------------------- /src/proto/event.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorboardrs; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "EventProtos"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.util"; 8 | 9 | import "src/tensorboardrs/proto/summary.proto"; 10 | 11 | // Protocol buffer representing an event that happened during 12 | // the execution of a Brain model. 13 | message Event { 14 | // Timestamp of the event. 15 | double wall_time = 1; 16 | 17 | // Global step of the event. 18 | int64 step = 2; 19 | 20 | oneof what { 21 | // An event file was started, with the specified version. 22 | // This is use to identify the contents of the record IO files 23 | // easily. Current version is "brain.Event:2". All versions 24 | // start with "brain.Event:". 25 | string file_version = 3; 26 | // An encoded version of a GraphDef. 27 | bytes graph_def = 4; 28 | // A summary was generated. 29 | Summary summary = 5; 30 | // The user output a log message. Not all messages are logged, only ones 31 | // generated via the Python tensorboard_logging module. 32 | LogMessage log_message = 6; 33 | // The state of the session which can be used for restarting after crashes. 34 | SessionLog session_log = 7; 35 | // The metadata returned by running a session.run() call. 36 | TaggedRunMetadata tagged_run_metadata = 8; 37 | // An encoded version of a MetaGraphDef. 38 | bytes meta_graph_def = 9; 39 | } 40 | } 41 | 42 | // Protocol buffer used for logging messages to the events file. 43 | message LogMessage { 44 | enum Level { 45 | UNKNOWN = 0; 46 | DEBUG = 10; 47 | INFO = 20; 48 | WARN = 30; 49 | ERROR = 40; 50 | FATAL = 50; 51 | } 52 | Level level = 1; 53 | string message = 2; 54 | } 55 | 56 | // Protocol buffer used for logging session state. 57 | message SessionLog { 58 | enum SessionStatus { 59 | STATUS_UNSPECIFIED = 0; 60 | START = 1; 61 | STOP = 2; 62 | CHECKPOINT = 3; 63 | } 64 | 65 | SessionStatus status = 1; 66 | // This checkpoint_path contains both the path and filename. 67 | string checkpoint_path = 2; 68 | string msg = 3; 69 | } 70 | 71 | // For logging the metadata output for a single session.run() call. 72 | message TaggedRunMetadata { 73 | // Tag name associated with this metadata. 74 | string tag = 1; 75 | // Byte-encoded version of the `RunMetadata` proto in order to allow lazy 76 | // deserialization. 77 | bytes run_metadata = 2; 78 | } 79 | -------------------------------------------------------------------------------- /src/proto/graph.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorboardrs; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "GraphProtos"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | 9 | import "src/tensorboardrs/proto/node_def.proto"; 10 | //import "tensorflow/core/framework/function.proto"; 11 | import "src/tensorboardrs/proto/versions.proto"; 12 | 13 | // Represents the graph of operations 14 | message GraphDef { 15 | repeated NodeDef node = 1; 16 | 17 | // Compatibility versions of the graph. See core/public/version.h for version 18 | // history. The GraphDef version is distinct from the TensorFlow version, and 19 | // each release of TensorFlow will support a range of GraphDef versions. 20 | VersionDef versions = 4; 21 | 22 | // Deprecated single version field; use versions above instead. Since all 23 | // GraphDef changes before "versions" was introduced were forward 24 | // compatible, this field is entirely ignored. 25 | int32 version = 3 [deprecated = true]; 26 | 27 | // EXPERIMENTAL. DO NOT USE OR DEPEND ON THIS YET. 28 | // 29 | // "library" provides user-defined functions. 30 | // 31 | // Naming: 32 | // * library.function.name are in a flat namespace. 33 | // NOTE: We may need to change it to be hierarchical to support 34 | // different orgs. E.g., 35 | // { "/google/nn", { ... }}, 36 | // { "/google/vision", { ... }} 37 | // { "/org_foo/module_bar", { ... }} 38 | // map named_lib; 39 | // * If node[i].op is the name of one function in "library", 40 | // node[i] is deemed as a function call. Otherwise, node[i].op 41 | // must be a primitive operation supported by the runtime. 42 | // 43 | // 44 | // Function call semantics: 45 | // 46 | // * The callee may start execution as soon as some of its inputs 47 | // are ready. The caller may want to use Tuple() mechanism to 48 | // ensure all inputs are ready in the same time. 49 | // 50 | // * The consumer of return values may start executing as soon as 51 | // the return values the consumer depends on are ready. The 52 | // consumer may want to use Tuple() mechanism to ensure the 53 | // consumer does not start until all return values of the callee 54 | // function are ready. 55 | //FunctionDefLibrary library = 2; 56 | }; 57 | -------------------------------------------------------------------------------- /src/proto/graph.rs: -------------------------------------------------------------------------------- 1 | // This file is generated by rust-protobuf 2.14.0. Do not edit 2 | // @generated 3 | 4 | // https://github.com/rust-lang/rust-clippy/issues/702 5 | #![allow(unknown_lints)] 6 | #![allow(clippy::all)] 7 | 8 | #![cfg_attr(rustfmt, rustfmt_skip)] 9 | 10 | #![allow(box_pointers)] 11 | #![allow(dead_code)] 12 | #![allow(missing_docs)] 13 | #![allow(non_camel_case_types)] 14 | #![allow(non_snake_case)] 15 | #![allow(non_upper_case_globals)] 16 | #![allow(trivial_casts)] 17 | #![allow(unsafe_code)] 18 | #![allow(unused_imports)] 19 | #![allow(unused_results)] 20 | //! Generated file from `src/tensorboardrs/proto/graph.proto` 21 | 22 | use protobuf::Message as Message_imported_for_functions; 23 | use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; 24 | 25 | /// Generated files are compatible only with the same version 26 | /// of protobuf runtime. 27 | // const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_14_0; 28 | 29 | #[derive(PartialEq,Clone,Default)] 30 | pub struct GraphDef { 31 | // message fields 32 | pub node: ::protobuf::RepeatedField, 33 | pub versions: ::protobuf::SingularPtrField, 34 | pub version: i32, 35 | // special fields 36 | pub unknown_fields: ::protobuf::UnknownFields, 37 | pub cached_size: ::protobuf::CachedSize, 38 | } 39 | 40 | impl<'a> ::std::default::Default for &'a GraphDef { 41 | fn default() -> &'a GraphDef { 42 | ::default_instance() 43 | } 44 | } 45 | 46 | impl GraphDef { 47 | pub fn new() -> GraphDef { 48 | ::std::default::Default::default() 49 | } 50 | 51 | // repeated .tensorboardrs.NodeDef node = 1; 52 | 53 | 54 | pub fn get_node(&self) -> &[super::node_def::NodeDef] { 55 | &self.node 56 | } 57 | pub fn clear_node(&mut self) { 58 | self.node.clear(); 59 | } 60 | 61 | // Param is passed by value, moved 62 | pub fn set_node(&mut self, v: ::protobuf::RepeatedField) { 63 | self.node = v; 64 | } 65 | 66 | // Mutable pointer to the field. 67 | pub fn mut_node(&mut self) -> &mut ::protobuf::RepeatedField { 68 | &mut self.node 69 | } 70 | 71 | // Take field 72 | pub fn take_node(&mut self) -> ::protobuf::RepeatedField { 73 | ::std::mem::replace(&mut self.node, ::protobuf::RepeatedField::new()) 74 | } 75 | 76 | // .tensorboardrs.VersionDef versions = 4; 77 | 78 | 79 | pub fn get_versions(&self) -> &super::versions::VersionDef { 80 | self.versions.as_ref().unwrap_or_else(|| super::versions::VersionDef::default_instance()) 81 | } 82 | pub fn clear_versions(&mut self) { 83 | self.versions.clear(); 84 | } 85 | 86 | pub fn has_versions(&self) -> bool { 87 | self.versions.is_some() 88 | } 89 | 90 | // Param is passed by value, moved 91 | pub fn set_versions(&mut self, v: super::versions::VersionDef) { 92 | self.versions = ::protobuf::SingularPtrField::some(v); 93 | } 94 | 95 | // Mutable pointer to the field. 96 | // If field is not initialized, it is initialized with default value first. 97 | pub fn mut_versions(&mut self) -> &mut super::versions::VersionDef { 98 | if self.versions.is_none() { 99 | self.versions.set_default(); 100 | } 101 | self.versions.as_mut().unwrap() 102 | } 103 | 104 | // Take field 105 | pub fn take_versions(&mut self) -> super::versions::VersionDef { 106 | self.versions.take().unwrap_or_else(|| super::versions::VersionDef::new()) 107 | } 108 | 109 | // int32 version = 3; 110 | 111 | 112 | pub fn get_version(&self) -> i32 { 113 | self.version 114 | } 115 | pub fn clear_version(&mut self) { 116 | self.version = 0; 117 | } 118 | 119 | // Param is passed by value, moved 120 | pub fn set_version(&mut self, v: i32) { 121 | self.version = v; 122 | } 123 | } 124 | 125 | impl ::protobuf::Message for GraphDef { 126 | fn is_initialized(&self) -> bool { 127 | for v in &self.node { 128 | if !v.is_initialized() { 129 | return false; 130 | } 131 | }; 132 | for v in &self.versions { 133 | if !v.is_initialized() { 134 | return false; 135 | } 136 | }; 137 | true 138 | } 139 | 140 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 141 | while !is.eof()? { 142 | let (field_number, wire_type) = is.read_tag_unpack()?; 143 | match field_number { 144 | 1 => { 145 | ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.node)?; 146 | }, 147 | 4 => { 148 | ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.versions)?; 149 | }, 150 | 3 => { 151 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 152 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 153 | } 154 | let tmp = is.read_int32()?; 155 | self.version = tmp; 156 | }, 157 | _ => { 158 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 159 | }, 160 | }; 161 | } 162 | ::std::result::Result::Ok(()) 163 | } 164 | 165 | // Compute sizes of nested messages 166 | #[allow(unused_variables)] 167 | fn compute_size(&self) -> u32 { 168 | let mut my_size = 0; 169 | for value in &self.node { 170 | let len = value.compute_size(); 171 | my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; 172 | }; 173 | if let Some(ref v) = self.versions.as_ref() { 174 | let len = v.compute_size(); 175 | my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; 176 | } 177 | if self.version != 0 { 178 | my_size += ::protobuf::rt::value_size(3, self.version, ::protobuf::wire_format::WireTypeVarint); 179 | } 180 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 181 | self.cached_size.set(my_size); 182 | my_size 183 | } 184 | 185 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 186 | for v in &self.node { 187 | os.write_tag(1, ::protobuf::wire_format::WireTypeLengthDelimited)?; 188 | os.write_raw_varint32(v.get_cached_size())?; 189 | v.write_to_with_cached_sizes(os)?; 190 | }; 191 | if let Some(ref v) = self.versions.as_ref() { 192 | os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?; 193 | os.write_raw_varint32(v.get_cached_size())?; 194 | v.write_to_with_cached_sizes(os)?; 195 | } 196 | if self.version != 0 { 197 | os.write_int32(3, self.version)?; 198 | } 199 | os.write_unknown_fields(self.get_unknown_fields())?; 200 | ::std::result::Result::Ok(()) 201 | } 202 | 203 | fn get_cached_size(&self) -> u32 { 204 | self.cached_size.get() 205 | } 206 | 207 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 208 | &self.unknown_fields 209 | } 210 | 211 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 212 | &mut self.unknown_fields 213 | } 214 | 215 | fn as_any(&self) -> &dyn (::std::any::Any) { 216 | self as &dyn (::std::any::Any) 217 | } 218 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 219 | self as &mut dyn (::std::any::Any) 220 | } 221 | fn into_any(self: Box) -> ::std::boxed::Box { 222 | self 223 | } 224 | 225 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 226 | Self::descriptor_static() 227 | } 228 | 229 | fn new() -> GraphDef { 230 | GraphDef::new() 231 | } 232 | 233 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 234 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; 235 | unsafe { 236 | descriptor.get(|| { 237 | let mut fields = ::std::vec::Vec::new(); 238 | fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( 239 | "node", 240 | |m: &GraphDef| { &m.node }, 241 | |m: &mut GraphDef| { &mut m.node }, 242 | )); 243 | fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( 244 | "versions", 245 | |m: &GraphDef| { &m.versions }, 246 | |m: &mut GraphDef| { &mut m.versions }, 247 | )); 248 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( 249 | "version", 250 | |m: &GraphDef| { &m.version }, 251 | |m: &mut GraphDef| { &mut m.version }, 252 | )); 253 | ::protobuf::reflect::MessageDescriptor::new_pb_name::( 254 | "GraphDef", 255 | fields, 256 | file_descriptor_proto() 257 | ) 258 | }) 259 | } 260 | } 261 | 262 | fn default_instance() -> &'static GraphDef { 263 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; 264 | unsafe { 265 | instance.get(GraphDef::new) 266 | } 267 | } 268 | } 269 | 270 | impl ::protobuf::Clear for GraphDef { 271 | fn clear(&mut self) { 272 | self.node.clear(); 273 | self.versions.clear(); 274 | self.version = 0; 275 | self.unknown_fields.clear(); 276 | } 277 | } 278 | 279 | impl ::std::fmt::Debug for GraphDef { 280 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 281 | ::protobuf::text_format::fmt(self, f) 282 | } 283 | } 284 | 285 | impl ::protobuf::reflect::ProtobufValue for GraphDef { 286 | fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { 287 | ::protobuf::reflect::ReflectValueRef::Message(self) 288 | } 289 | } 290 | 291 | static file_descriptor_proto_data: &'static [u8] = b"\ 292 | \n#src/tensorboardrs/proto/graph.proto\x12\rtensorboardrs\x1a&src/tensor\ 293 | boardrs/proto/node_def.proto\x1a&src/tensorboardrs/proto/versions.proto\ 294 | \"\x8b\x01\n\x08GraphDef\x12*\n\x04node\x18\x01\x20\x03(\x0b2\x16.tensor\ 295 | boardrs.NodeDefR\x04node\x125\n\x08versions\x18\x04\x20\x01(\x0b2\x19.te\ 296 | nsorboardrs.VersionDefR\x08versions\x12\x1c\n\x07version\x18\x03\x20\x01\ 297 | (\x05R\x07versionB\x02\x18\x01B,\n\x18org.tensorflow.frameworkB\x0bGraph\ 298 | ProtosP\x01\xf8\x01\x01J\xe8\x06\n\x06\x12\x04\0\07\x02\n\x08\n\x01\x0c\ 299 | \x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x02\0\x16\n\x08\n\x01\x08\x12\ 300 | \x03\x03\0\x1f\n\t\n\x02\x08\x1f\x12\x03\x03\0\x1f\n\x08\n\x01\x08\x12\ 301 | \x03\x04\0,\n\t\n\x02\x08\x08\x12\x03\x04\0,\n\x08\n\x01\x08\x12\x03\x05\ 302 | \0\"\n\t\n\x02\x08\n\x12\x03\x05\0\"\n\x08\n\x01\x08\x12\x03\x06\01\n\t\ 303 | \n\x02\x08\x01\x12\x03\x06\01\n\t\n\x02\x03\0\x12\x03\x08\00\n>\n\x02\ 304 | \x03\x01\x12\x03\n\00\x1a3import\x20\"tensorflow/core/framework/function\ 305 | .proto\";\n\n0\n\x02\x04\0\x12\x04\r\07\x01\x1a$\x20Represents\x20the\ 306 | \x20graph\x20of\x20operations\n\n\n\n\x03\x04\0\x01\x12\x03\r\x08\x10\n\ 307 | \x0b\n\x04\x04\0\x02\0\x12\x03\x0e\x02\x1c\n\x0c\n\x05\x04\0\x02\0\x04\ 308 | \x12\x03\x0e\x02\n\n\x0c\n\x05\x04\0\x02\0\x06\x12\x03\x0e\x0b\x12\n\x0c\ 309 | \n\x05\x04\0\x02\0\x01\x12\x03\x0e\x13\x17\n\x0c\n\x05\x04\0\x02\0\x03\ 310 | \x12\x03\x0e\x1a\x1b\n\xef\x01\n\x04\x04\0\x02\x01\x12\x03\x13\x02\x1a\ 311 | \x1a\xe1\x01\x20Compatibility\x20versions\x20of\x20the\x20graph.\x20\x20\ 312 | See\x20core/public/version.h\x20for\x20version\n\x20history.\x20\x20The\ 313 | \x20GraphDef\x20version\x20is\x20distinct\x20from\x20the\x20TensorFlow\ 314 | \x20version,\x20and\n\x20each\x20release\x20of\x20TensorFlow\x20will\x20\ 315 | support\x20a\x20range\x20of\x20GraphDef\x20versions.\n\n\x0c\n\x05\x04\0\ 316 | \x02\x01\x06\x12\x03\x13\x02\x0c\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\ 317 | \x13\r\x15\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x13\x18\x19\n\xc4\x01\n\ 318 | \x04\x04\0\x02\x02\x12\x03\x18\x02(\x1a\xb6\x01\x20Deprecated\x20single\ 319 | \x20version\x20field;\x20use\x20versions\x20above\x20instead.\x20\x20Sin\ 320 | ce\x20all\n\x20GraphDef\x20changes\x20before\x20\"versions\"\x20was\x20i\ 321 | ntroduced\x20were\x20forward\n\x20compatible,\x20this\x20field\x20is\x20\ 322 | entirely\x20ignored.\n\n\x0c\n\x05\x04\0\x02\x02\x05\x12\x03\x18\x02\x07\ 323 | \n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x18\x08\x0f\n\x0c\n\x05\x04\0\x02\ 324 | \x02\x03\x12\x03\x18\x12\x13\n\x0c\n\x05\x04\0\x02\x02\x08\x12\x03\x18\ 325 | \x14'\n\r\n\x06\x04\0\x02\x02\x08\x03\x12\x03\x18\x15&b\x06proto3\ 326 | "; 327 | 328 | static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT; 329 | 330 | fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { 331 | ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() 332 | } 333 | 334 | pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { 335 | unsafe { 336 | file_descriptor_proto_lazy.get(|| { 337 | parse_descriptor_proto() 338 | }) 339 | } 340 | } 341 | -------------------------------------------------------------------------------- /src/proto/layout.proto: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | syntax = "proto3"; 17 | 18 | package tensorboardrs; 19 | 20 | 21 | /** 22 | * Encapsulates information on a single chart. Many charts appear in a category. 23 | */ 24 | message Chart { 25 | // The title shown atop this chart. Optional. Defaults to 'untitled'. 26 | string title = 1; 27 | 28 | // The content of the chart. This depends on the type of the chart. 29 | oneof content { 30 | MultilineChartContent multiline = 2; 31 | MarginChartContent margin = 3; 32 | } 33 | } 34 | 35 | /** 36 | * Encapsulates information on a single line chart. This line chart may have 37 | * lines associated with several tags. 38 | */ 39 | message MultilineChartContent { 40 | // A list of regular expressions for tags that should appear in this chart. 41 | // Tags are matched from beginning to end. Each regex captures a set of tags. 42 | repeated string tag = 1; 43 | } 44 | 45 | /** 46 | * Encapsulates information on a single margin chart. A margin chart uses fill 47 | * area to visualize lower and upper bounds that surround a value. 48 | */ 49 | message MarginChartContent { 50 | /** 51 | * Encapsulates a tag of data for the chart. 52 | */ 53 | message Series { 54 | // The exact tag string associated with the scalar summaries making up the 55 | // main value between the bounds. 56 | string value = 1; 57 | 58 | // The exact tag string associated with the scalar summaries making up the 59 | // lower bound. 60 | string lower = 2; 61 | 62 | // The exact tag string associated with the scalar summaries making up the 63 | // upper bound. 64 | string upper = 3; 65 | } 66 | 67 | // A list of data series to include within this margin chart. 68 | repeated Series series = 1; 69 | } 70 | 71 | /** 72 | * A category contains a group of charts. Each category maps to a collapsible 73 | * within the dashboard. 74 | */ 75 | message Category { 76 | // This string appears atop each grouping of charts within the dashboard. 77 | string title = 1; 78 | 79 | // Encapsulates data on charts to be shown in the category. 80 | repeated Chart chart = 2; 81 | 82 | // Whether this category should be initially closed. False by default. 83 | bool closed = 3; 84 | } 85 | 86 | /** 87 | * A layout encapsulates how charts are laid out within the custom scalars 88 | * dashboard. 89 | */ 90 | message Layout { 91 | // Version `0` is the only supported version. 92 | int32 version = 1; 93 | 94 | // The categories here are rendered from top to bottom. 95 | repeated Category category = 2; 96 | } 97 | -------------------------------------------------------------------------------- /src/proto/node_def.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorboardrs; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "NodeProto"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | 9 | import "src/tensorboardrs/proto/attr_value.proto"; 10 | 11 | message NodeDef { 12 | // The name given to this operator. Used for naming inputs, 13 | // logging, visualization, etc. Unique within a single GraphDef. 14 | // Must match the regexp "[A-Za-z0-9.][A-Za-z0-9_./]*". 15 | string name = 1; 16 | 17 | // The operation name. There may be custom parameters in attrs. 18 | // Op names starting with an underscore are reserved for internal use. 19 | string op = 2; 20 | 21 | // Each input is "node:src_output" with "node" being a string name and 22 | // "src_output" indicating which output tensor to use from "node". If 23 | // "src_output" is 0 the ":0" suffix can be omitted. Regular inputs 24 | // may optionally be followed by control inputs that have the format 25 | // "^node". 26 | repeated string input = 3; 27 | 28 | // A (possibly partial) specification for the device on which this 29 | // node should be placed. 30 | // The expected syntax for this string is as follows: 31 | // 32 | // DEVICE_SPEC ::= PARTIAL_SPEC 33 | // 34 | // PARTIAL_SPEC ::= ("/" CONSTRAINT) * 35 | // CONSTRAINT ::= ("job:" JOB_NAME) 36 | // | ("replica:" [1-9][0-9]*) 37 | // | ("task:" [1-9][0-9]*) 38 | // | ( ("gpu" | "cpu") ":" ([1-9][0-9]* | "*") ) 39 | // 40 | // Valid values for this string include: 41 | // * "/job:worker/replica:0/task:1/gpu:3" (full specification) 42 | // * "/job:worker/gpu:3" (partial specification) 43 | // * "" (no specification) 44 | // 45 | // If the constraints do not resolve to a single device (or if this 46 | // field is empty or not present), the runtime will attempt to 47 | // choose a device automatically. 48 | string device = 4; 49 | 50 | // Operation-specific graph-construction-time configuration. 51 | // Note that this should include all attrs defined in the 52 | // corresponding OpDef, including those with a value matching 53 | // the default -- this allows the default to change and makes 54 | // NodeDefs easier to interpret on their own. However, if 55 | // an attr with a default is not specified in this list, the 56 | // default will be used. 57 | // The "names" (keys) must match the regexp "[a-z][a-z0-9_]+" (and 58 | // one of the names from the corresponding OpDef's attr field). 59 | // The values must have a type matching the corresponding OpDef 60 | // attr's type field. 61 | // TODO(josh11b): Add some examples here showing best practices. 62 | map attr = 5; 63 | }; 64 | -------------------------------------------------------------------------------- /src/proto/node_def.rs: -------------------------------------------------------------------------------- 1 | // This file is generated by rust-protobuf 2.14.0. Do not edit 2 | // @generated 3 | 4 | // https://github.com/rust-lang/rust-clippy/issues/702 5 | #![allow(unknown_lints)] 6 | #![allow(clippy::all)] 7 | 8 | #![cfg_attr(rustfmt, rustfmt_skip)] 9 | 10 | #![allow(box_pointers)] 11 | #![allow(dead_code)] 12 | #![allow(missing_docs)] 13 | #![allow(non_camel_case_types)] 14 | #![allow(non_snake_case)] 15 | #![allow(non_upper_case_globals)] 16 | #![allow(trivial_casts)] 17 | #![allow(unsafe_code)] 18 | #![allow(unused_imports)] 19 | #![allow(unused_results)] 20 | //! Generated file from `src/tensorboardrs/proto/node_def.proto` 21 | 22 | use protobuf::Message as Message_imported_for_functions; 23 | use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; 24 | 25 | /// Generated files are compatible only with the same version 26 | /// of protobuf runtime. 27 | // const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_14_0; 28 | 29 | #[derive(PartialEq,Clone,Default)] 30 | pub struct NodeDef { 31 | // message fields 32 | pub name: ::std::string::String, 33 | pub op: ::std::string::String, 34 | pub input: ::protobuf::RepeatedField<::std::string::String>, 35 | pub device: ::std::string::String, 36 | pub attr: ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue>, 37 | // special fields 38 | pub unknown_fields: ::protobuf::UnknownFields, 39 | pub cached_size: ::protobuf::CachedSize, 40 | } 41 | 42 | impl<'a> ::std::default::Default for &'a NodeDef { 43 | fn default() -> &'a NodeDef { 44 | ::default_instance() 45 | } 46 | } 47 | 48 | impl NodeDef { 49 | pub fn new() -> NodeDef { 50 | ::std::default::Default::default() 51 | } 52 | 53 | // string name = 1; 54 | 55 | 56 | pub fn get_name(&self) -> &str { 57 | &self.name 58 | } 59 | pub fn clear_name(&mut self) { 60 | self.name.clear(); 61 | } 62 | 63 | // Param is passed by value, moved 64 | pub fn set_name(&mut self, v: ::std::string::String) { 65 | self.name = v; 66 | } 67 | 68 | // Mutable pointer to the field. 69 | // If field is not initialized, it is initialized with default value first. 70 | pub fn mut_name(&mut self) -> &mut ::std::string::String { 71 | &mut self.name 72 | } 73 | 74 | // Take field 75 | pub fn take_name(&mut self) -> ::std::string::String { 76 | ::std::mem::replace(&mut self.name, ::std::string::String::new()) 77 | } 78 | 79 | // string op = 2; 80 | 81 | 82 | pub fn get_op(&self) -> &str { 83 | &self.op 84 | } 85 | pub fn clear_op(&mut self) { 86 | self.op.clear(); 87 | } 88 | 89 | // Param is passed by value, moved 90 | pub fn set_op(&mut self, v: ::std::string::String) { 91 | self.op = v; 92 | } 93 | 94 | // Mutable pointer to the field. 95 | // If field is not initialized, it is initialized with default value first. 96 | pub fn mut_op(&mut self) -> &mut ::std::string::String { 97 | &mut self.op 98 | } 99 | 100 | // Take field 101 | pub fn take_op(&mut self) -> ::std::string::String { 102 | ::std::mem::replace(&mut self.op, ::std::string::String::new()) 103 | } 104 | 105 | // repeated string input = 3; 106 | 107 | 108 | pub fn get_input(&self) -> &[::std::string::String] { 109 | &self.input 110 | } 111 | pub fn clear_input(&mut self) { 112 | self.input.clear(); 113 | } 114 | 115 | // Param is passed by value, moved 116 | pub fn set_input(&mut self, v: ::protobuf::RepeatedField<::std::string::String>) { 117 | self.input = v; 118 | } 119 | 120 | // Mutable pointer to the field. 121 | pub fn mut_input(&mut self) -> &mut ::protobuf::RepeatedField<::std::string::String> { 122 | &mut self.input 123 | } 124 | 125 | // Take field 126 | pub fn take_input(&mut self) -> ::protobuf::RepeatedField<::std::string::String> { 127 | ::std::mem::replace(&mut self.input, ::protobuf::RepeatedField::new()) 128 | } 129 | 130 | // string device = 4; 131 | 132 | 133 | pub fn get_device(&self) -> &str { 134 | &self.device 135 | } 136 | pub fn clear_device(&mut self) { 137 | self.device.clear(); 138 | } 139 | 140 | // Param is passed by value, moved 141 | pub fn set_device(&mut self, v: ::std::string::String) { 142 | self.device = v; 143 | } 144 | 145 | // Mutable pointer to the field. 146 | // If field is not initialized, it is initialized with default value first. 147 | pub fn mut_device(&mut self) -> &mut ::std::string::String { 148 | &mut self.device 149 | } 150 | 151 | // Take field 152 | pub fn take_device(&mut self) -> ::std::string::String { 153 | ::std::mem::replace(&mut self.device, ::std::string::String::new()) 154 | } 155 | 156 | // repeated .tensorboardrs.NodeDef.AttrEntry attr = 5; 157 | 158 | 159 | pub fn get_attr(&self) -> &::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue> { 160 | &self.attr 161 | } 162 | pub fn clear_attr(&mut self) { 163 | self.attr.clear(); 164 | } 165 | 166 | // Param is passed by value, moved 167 | pub fn set_attr(&mut self, v: ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue>) { 168 | self.attr = v; 169 | } 170 | 171 | // Mutable pointer to the field. 172 | pub fn mut_attr(&mut self) -> &mut ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue> { 173 | &mut self.attr 174 | } 175 | 176 | // Take field 177 | pub fn take_attr(&mut self) -> ::std::collections::HashMap<::std::string::String, super::attr_value::AttrValue> { 178 | ::std::mem::replace(&mut self.attr, ::std::collections::HashMap::new()) 179 | } 180 | } 181 | 182 | impl ::protobuf::Message for NodeDef { 183 | fn is_initialized(&self) -> bool { 184 | true 185 | } 186 | 187 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 188 | while !is.eof()? { 189 | let (field_number, wire_type) = is.read_tag_unpack()?; 190 | match field_number { 191 | 1 => { 192 | ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; 193 | }, 194 | 2 => { 195 | ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.op)?; 196 | }, 197 | 3 => { 198 | ::protobuf::rt::read_repeated_string_into(wire_type, is, &mut self.input)?; 199 | }, 200 | 4 => { 201 | ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.device)?; 202 | }, 203 | 5 => { 204 | ::protobuf::rt::read_map_into::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(wire_type, is, &mut self.attr)?; 205 | }, 206 | _ => { 207 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 208 | }, 209 | }; 210 | } 211 | ::std::result::Result::Ok(()) 212 | } 213 | 214 | // Compute sizes of nested messages 215 | #[allow(unused_variables)] 216 | fn compute_size(&self) -> u32 { 217 | let mut my_size = 0; 218 | if !self.name.is_empty() { 219 | my_size += ::protobuf::rt::string_size(1, &self.name); 220 | } 221 | if !self.op.is_empty() { 222 | my_size += ::protobuf::rt::string_size(2, &self.op); 223 | } 224 | for value in &self.input { 225 | my_size += ::protobuf::rt::string_size(3, &value); 226 | }; 227 | if !self.device.is_empty() { 228 | my_size += ::protobuf::rt::string_size(4, &self.device); 229 | } 230 | my_size += ::protobuf::rt::compute_map_size::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(5, &self.attr); 231 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 232 | self.cached_size.set(my_size); 233 | my_size 234 | } 235 | 236 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 237 | if !self.name.is_empty() { 238 | os.write_string(1, &self.name)?; 239 | } 240 | if !self.op.is_empty() { 241 | os.write_string(2, &self.op)?; 242 | } 243 | for v in &self.input { 244 | os.write_string(3, &v)?; 245 | }; 246 | if !self.device.is_empty() { 247 | os.write_string(4, &self.device)?; 248 | } 249 | ::protobuf::rt::write_map_with_cached_sizes::<::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>(5, &self.attr, os)?; 250 | os.write_unknown_fields(self.get_unknown_fields())?; 251 | ::std::result::Result::Ok(()) 252 | } 253 | 254 | fn get_cached_size(&self) -> u32 { 255 | self.cached_size.get() 256 | } 257 | 258 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 259 | &self.unknown_fields 260 | } 261 | 262 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 263 | &mut self.unknown_fields 264 | } 265 | 266 | fn as_any(&self) -> &dyn (::std::any::Any) { 267 | self as &dyn (::std::any::Any) 268 | } 269 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 270 | self as &mut dyn (::std::any::Any) 271 | } 272 | fn into_any(self: Box) -> ::std::boxed::Box { 273 | self 274 | } 275 | 276 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 277 | Self::descriptor_static() 278 | } 279 | 280 | fn new() -> NodeDef { 281 | NodeDef::new() 282 | } 283 | 284 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 285 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; 286 | unsafe { 287 | descriptor.get(|| { 288 | let mut fields = ::std::vec::Vec::new(); 289 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( 290 | "name", 291 | |m: &NodeDef| { &m.name }, 292 | |m: &mut NodeDef| { &mut m.name }, 293 | )); 294 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( 295 | "op", 296 | |m: &NodeDef| { &m.op }, 297 | |m: &mut NodeDef| { &mut m.op }, 298 | )); 299 | fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( 300 | "input", 301 | |m: &NodeDef| { &m.input }, 302 | |m: &mut NodeDef| { &mut m.input }, 303 | )); 304 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( 305 | "device", 306 | |m: &NodeDef| { &m.device }, 307 | |m: &mut NodeDef| { &mut m.device }, 308 | )); 309 | fields.push(::protobuf::reflect::accessor::make_map_accessor::<_, ::protobuf::types::ProtobufTypeString, ::protobuf::types::ProtobufTypeMessage>( 310 | "attr", 311 | |m: &NodeDef| { &m.attr }, 312 | |m: &mut NodeDef| { &mut m.attr }, 313 | )); 314 | ::protobuf::reflect::MessageDescriptor::new_pb_name::( 315 | "NodeDef", 316 | fields, 317 | file_descriptor_proto() 318 | ) 319 | }) 320 | } 321 | } 322 | 323 | fn default_instance() -> &'static NodeDef { 324 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; 325 | unsafe { 326 | instance.get(NodeDef::new) 327 | } 328 | } 329 | } 330 | 331 | impl ::protobuf::Clear for NodeDef { 332 | fn clear(&mut self) { 333 | self.name.clear(); 334 | self.op.clear(); 335 | self.input.clear(); 336 | self.device.clear(); 337 | self.attr.clear(); 338 | self.unknown_fields.clear(); 339 | } 340 | } 341 | 342 | impl ::std::fmt::Debug for NodeDef { 343 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 344 | ::protobuf::text_format::fmt(self, f) 345 | } 346 | } 347 | 348 | impl ::protobuf::reflect::ProtobufValue for NodeDef { 349 | fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { 350 | ::protobuf::reflect::ReflectValueRef::Message(self) 351 | } 352 | } 353 | 354 | static file_descriptor_proto_data: &'static [u8] = b"\ 355 | \n&src/tensorboardrs/proto/node_def.proto\x12\rtensorboardrs\x1a(src/ten\ 356 | sorboardrs/proto/attr_value.proto\"\xe4\x01\n\x07NodeDef\x12\x12\n\x04na\ 357 | me\x18\x01\x20\x01(\tR\x04name\x12\x0e\n\x02op\x18\x02\x20\x01(\tR\x02op\ 358 | \x12\x14\n\x05input\x18\x03\x20\x03(\tR\x05input\x12\x16\n\x06device\x18\ 359 | \x04\x20\x01(\tR\x06device\x124\n\x04attr\x18\x05\x20\x03(\x0b2\x20.tens\ 360 | orboardrs.NodeDef.AttrEntryR\x04attr\x1aQ\n\tAttrEntry\x12\x10\n\x03key\ 361 | \x18\x01\x20\x01(\tR\x03key\x12.\n\x05value\x18\x02\x20\x01(\x0b2\x18.te\ 362 | nsorboardrs.AttrValueR\x05value:\x028\x01B*\n\x18org.tensorflow.framewor\ 363 | kB\tNodeProtoP\x01\xf8\x01\x01J\x9d\x13\n\x06\x12\x04\0\0>\x02\n\x08\n\ 364 | \x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x02\0\x16\n\x08\n\x01\ 365 | \x08\x12\x03\x03\0\x1f\n\t\n\x02\x08\x1f\x12\x03\x03\0\x1f\n\x08\n\x01\ 366 | \x08\x12\x03\x04\0*\n\t\n\x02\x08\x08\x12\x03\x04\0*\n\x08\n\x01\x08\x12\ 367 | \x03\x05\0\"\n\t\n\x02\x08\n\x12\x03\x05\0\"\n\x08\n\x01\x08\x12\x03\x06\ 368 | \01\n\t\n\x02\x08\x01\x12\x03\x06\01\n\t\n\x02\x03\0\x12\x03\x08\02\n\n\ 369 | \n\x02\x04\0\x12\x04\n\0>\x01\n\n\n\x03\x04\0\x01\x12\x03\n\x08\x0f\n\ 370 | \xbe\x01\n\x04\x04\0\x02\0\x12\x03\x0e\x02\x12\x1a\xb0\x01\x20The\x20nam\ 371 | e\x20given\x20to\x20this\x20operator.\x20Used\x20for\x20naming\x20inputs\ 372 | ,\n\x20logging,\x20visualization,\x20etc.\x20\x20Unique\x20within\x20a\ 373 | \x20single\x20GraphDef.\n\x20Must\x20match\x20the\x20regexp\x20\"[A-Za-z\ 374 | 0-9.][A-Za-z0-9_./]*\".\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x0e\x02\ 375 | \x08\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x0e\t\r\n\x0c\n\x05\x04\0\x02\0\ 376 | \x03\x12\x03\x0e\x10\x11\n\x92\x01\n\x04\x04\0\x02\x01\x12\x03\x12\x02\ 377 | \x10\x1a\x84\x01\x20The\x20operation\x20name.\x20\x20There\x20may\x20be\ 378 | \x20custom\x20parameters\x20in\x20attrs.\n\x20Op\x20names\x20starting\ 379 | \x20with\x20an\x20underscore\x20are\x20reserved\x20for\x20internal\x20us\ 380 | e.\n\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x12\x02\x08\n\x0c\n\x05\x04\0\ 381 | \x02\x01\x01\x12\x03\x12\t\x0b\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x12\ 382 | \x0e\x0f\n\xa7\x02\n\x04\x04\0\x02\x02\x12\x03\x19\x02\x1c\x1a\x99\x02\ 383 | \x20Each\x20input\x20is\x20\"node:src_output\"\x20with\x20\"node\"\x20be\ 384 | ing\x20a\x20string\x20name\x20and\n\x20\"src_output\"\x20indicating\x20w\ 385 | hich\x20output\x20tensor\x20to\x20use\x20from\x20\"node\".\x20If\n\x20\"\ 386 | src_output\"\x20is\x200\x20the\x20\":0\"\x20suffix\x20can\x20be\x20omitt\ 387 | ed.\x20\x20Regular\x20inputs\n\x20may\x20optionally\x20be\x20followed\ 388 | \x20by\x20control\x20inputs\x20that\x20have\x20the\x20format\n\x20\"^nod\ 389 | e\".\n\n\x0c\n\x05\x04\0\x02\x02\x04\x12\x03\x19\x02\n\n\x0c\n\x05\x04\0\ 390 | \x02\x02\x05\x12\x03\x19\x0b\x11\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\ 391 | \x19\x12\x17\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x19\x1a\x1b\n\x90\x06\ 392 | \n\x04\x04\0\x02\x03\x12\x03/\x02\x14\x1a\x82\x06\x20A\x20(possibly\x20p\ 393 | artial)\x20specification\x20for\x20the\x20device\x20on\x20which\x20this\ 394 | \n\x20node\x20should\x20be\x20placed.\n\x20The\x20expected\x20syntax\x20\ 395 | for\x20this\x20string\x20is\x20as\x20follows:\n\n\x20DEVICE_SPEC\x20::=\ 396 | \x20PARTIAL_SPEC\n\n\x20PARTIAL_SPEC\x20::=\x20(\"/\"\x20CONSTRAINT)\x20\ 397 | *\n\x20CONSTRAINT\x20::=\x20(\"job:\"\x20JOB_NAME)\n\x20\x20\x20\x20\x20\ 398 | \x20\x20\x20\x20\x20\x20\x20\x20\x20|\x20(\"replica:\"\x20[1-9][0-9]*)\n\ 399 | \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20|\x20(\"task:\"\ 400 | \x20[1-9][0-9]*)\n\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\ 401 | \x20|\x20(\x20(\"gpu\"\x20|\x20\"cpu\")\x20\":\"\x20([1-9][0-9]*\x20|\ 402 | \x20\"*\")\x20)\n\n\x20Valid\x20values\x20for\x20this\x20string\x20inclu\ 403 | de:\n\x20*\x20\"/job:worker/replica:0/task:1/gpu:3\"\x20\x20(full\x20spe\ 404 | cification)\n\x20*\x20\"/job:worker/gpu:3\"\x20\x20\x20\x20\x20\x20\x20\ 405 | \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20(partial\x20specificatio\ 406 | n)\n\x20*\x20\"\"\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\ 407 | \x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\ 408 | \x20\x20\x20\x20\x20(no\x20specification)\n\n\x20If\x20the\x20constraint\ 409 | s\x20do\x20not\x20resolve\x20to\x20a\x20single\x20device\x20(or\x20if\ 410 | \x20this\n\x20field\x20is\x20empty\x20or\x20not\x20present),\x20the\x20r\ 411 | untime\x20will\x20attempt\x20to\n\x20choose\x20a\x20device\x20automatica\ 412 | lly.\n\n\x0c\n\x05\x04\0\x02\x03\x05\x12\x03/\x02\x08\n\x0c\n\x05\x04\0\ 413 | \x02\x03\x01\x12\x03/\t\x0f\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03/\x12\ 414 | \x13\n\x94\x05\n\x04\x04\0\x02\x04\x12\x03=\x02\"\x1a\x86\x05\x20Operati\ 415 | on-specific\x20graph-construction-time\x20configuration.\n\x20Note\x20th\ 416 | at\x20this\x20should\x20include\x20all\x20attrs\x20defined\x20in\x20the\ 417 | \n\x20corresponding\x20OpDef,\x20including\x20those\x20with\x20a\x20valu\ 418 | e\x20matching\n\x20the\x20default\x20--\x20this\x20allows\x20the\x20defa\ 419 | ult\x20to\x20change\x20and\x20makes\n\x20NodeDefs\x20easier\x20to\x20int\ 420 | erpret\x20on\x20their\x20own.\x20\x20However,\x20if\n\x20an\x20attr\x20w\ 421 | ith\x20a\x20default\x20is\x20not\x20specified\x20in\x20this\x20list,\x20\ 422 | the\n\x20default\x20will\x20be\x20used.\n\x20The\x20\"names\"\x20(keys)\ 423 | \x20must\x20match\x20the\x20regexp\x20\"[a-z][a-z0-9_]+\"\x20(and\n\x20o\ 424 | ne\x20of\x20the\x20names\x20from\x20the\x20corresponding\x20OpDef's\x20a\ 425 | ttr\x20field).\n\x20The\x20values\x20must\x20have\x20a\x20type\x20matchi\ 426 | ng\x20the\x20corresponding\x20OpDef\n\x20attr's\x20type\x20field.\n\x20T\ 427 | ODO(josh11b):\x20Add\x20some\x20examples\x20here\x20showing\x20best\x20p\ 428 | ractices.\n\n\x0c\n\x05\x04\0\x02\x04\x06\x12\x03=\x02\x18\n\x0c\n\x05\ 429 | \x04\0\x02\x04\x01\x12\x03=\x19\x1d\n\x0c\n\x05\x04\0\x02\x04\x03\x12\ 430 | \x03=\x20!b\x06proto3\ 431 | "; 432 | 433 | static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT; 434 | 435 | fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { 436 | ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() 437 | } 438 | 439 | pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { 440 | unsafe { 441 | file_descriptor_proto_lazy.get(|| { 442 | parse_descriptor_proto() 443 | }) 444 | } 445 | } 446 | -------------------------------------------------------------------------------- /src/proto/plugin_hparams.proto: -------------------------------------------------------------------------------- 1 | /* Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | // Defines protos for storing a hypertuning experiment data inside Summary tags. 17 | // 18 | // A hypertuning-experiment data consists of metadata that's constant 19 | // throughout the experiment and evolving metric data for each training session 20 | // in the experiment. The HParams plugin assumes the following organization of 21 | // this entire data set. Experiment metadata is recorded in the empty run in a 22 | // tag (named by the Python constant) metadata.EXPERIMENT_TAG. Within the 23 | // experiment, for a session named by its metadata is recorded 24 | // in the run in the tags metadata.SESSION_START_INFO and 25 | // metadata.SESSION_END_INFO. Finally, the session's metric data for a metric 26 | // with a (, ) name (see MetricName in api.proto), is recorded 27 | // in a Scalar-plugin summary with tag in the run . 28 | 29 | syntax = "proto3"; 30 | 31 | import "src/tensorboardrs/proto/api.proto"; 32 | import "google/protobuf/struct.proto"; 33 | 34 | package tensorboardrs.hparam; 35 | 36 | // HParam summaries created by `tensorboard.plugins.hparams.summary` 37 | // module will include `SummaryMetadata` whose `plugin_data` field has 38 | // as `content` a serialized HParamsPluginData message. 39 | message HParamsPluginData { 40 | // The version of the plugin data schema. 41 | int32 version = 1; 42 | oneof data { 43 | Experiment experiment = 2; 44 | SessionStartInfo session_start_info = 3; 45 | SessionEndInfo session_end_info = 4; 46 | } 47 | } 48 | 49 | message SessionStartInfo { 50 | // A map describing the hyperparameter values for the session. 51 | // Maps each hyperparameter name to its value. 52 | // Currently only scalars are supported. 53 | map hparams = 1; 54 | 55 | // A URI for where checkpoints are saved. 56 | string model_uri = 2; 57 | 58 | // An optional URL to a website monitoring the session. 59 | string monitor_url = 3; 60 | 61 | // The name of the session group containing this session. If empty, the 62 | // group name is taken to be the session id (so this session is the only 63 | // member of its group). 64 | string group_name = 4; 65 | 66 | // The time the session started in seconds since epoch. 67 | double start_time_secs = 5; 68 | } 69 | 70 | message SessionEndInfo { 71 | Status status = 1; 72 | 73 | // The time the session ended in seconds since epoch. 74 | double end_time_secs = 2; 75 | } 76 | -------------------------------------------------------------------------------- /src/proto/plugin_mesh.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorboardrs.mesh; 4 | 5 | // A MeshPluginData encapsulates information on which plugins are able to make 6 | // use of a certain summary value. 7 | message MeshPluginData { 8 | enum ContentType { 9 | UNDEFINED = 0; 10 | VERTEX = 1; 11 | FACE = 2; // Triangle face. 12 | COLOR = 3; 13 | } 14 | 15 | // Version `0` is the only supported version. 16 | int32 version = 1; 17 | 18 | // The name of the mesh summary this particular summary belongs to. 19 | string name = 2; 20 | 21 | // Type of data in the summary. 22 | ContentType content_type = 3; 23 | 24 | // JSON-serialized dictionary of ThreeJS classes configuration. 25 | string json_config = 5; 26 | 27 | // Shape of underlying data. Cache it here for performance reasons. 28 | repeated int32 shape = 6; 29 | } 30 | -------------------------------------------------------------------------------- /src/proto/plugin_mesh.rs: -------------------------------------------------------------------------------- 1 | // This file is generated by rust-protobuf 2.14.0. Do not edit 2 | // @generated 3 | 4 | // https://github.com/rust-lang/rust-clippy/issues/702 5 | #![allow(unknown_lints)] 6 | #![allow(clippy::all)] 7 | 8 | #![cfg_attr(rustfmt, rustfmt_skip)] 9 | 10 | #![allow(box_pointers)] 11 | #![allow(dead_code)] 12 | #![allow(missing_docs)] 13 | #![allow(non_camel_case_types)] 14 | #![allow(non_snake_case)] 15 | #![allow(non_upper_case_globals)] 16 | #![allow(trivial_casts)] 17 | #![allow(unsafe_code)] 18 | #![allow(unused_imports)] 19 | #![allow(unused_results)] 20 | //! Generated file from `src/tensorboardrs/proto/plugin_mesh.proto` 21 | 22 | use protobuf::Message as Message_imported_for_functions; 23 | use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; 24 | 25 | /// Generated files are compatible only with the same version 26 | /// of protobuf runtime. 27 | // const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_14_0; 28 | 29 | #[derive(PartialEq,Clone,Default)] 30 | pub struct MeshPluginData { 31 | // message fields 32 | pub version: i32, 33 | pub name: ::std::string::String, 34 | pub content_type: MeshPluginData_ContentType, 35 | pub json_config: ::std::string::String, 36 | pub shape: ::std::vec::Vec, 37 | // special fields 38 | pub unknown_fields: ::protobuf::UnknownFields, 39 | pub cached_size: ::protobuf::CachedSize, 40 | } 41 | 42 | impl<'a> ::std::default::Default for &'a MeshPluginData { 43 | fn default() -> &'a MeshPluginData { 44 | ::default_instance() 45 | } 46 | } 47 | 48 | impl MeshPluginData { 49 | pub fn new() -> MeshPluginData { 50 | ::std::default::Default::default() 51 | } 52 | 53 | // int32 version = 1; 54 | 55 | 56 | pub fn get_version(&self) -> i32 { 57 | self.version 58 | } 59 | pub fn clear_version(&mut self) { 60 | self.version = 0; 61 | } 62 | 63 | // Param is passed by value, moved 64 | pub fn set_version(&mut self, v: i32) { 65 | self.version = v; 66 | } 67 | 68 | // string name = 2; 69 | 70 | 71 | pub fn get_name(&self) -> &str { 72 | &self.name 73 | } 74 | pub fn clear_name(&mut self) { 75 | self.name.clear(); 76 | } 77 | 78 | // Param is passed by value, moved 79 | pub fn set_name(&mut self, v: ::std::string::String) { 80 | self.name = v; 81 | } 82 | 83 | // Mutable pointer to the field. 84 | // If field is not initialized, it is initialized with default value first. 85 | pub fn mut_name(&mut self) -> &mut ::std::string::String { 86 | &mut self.name 87 | } 88 | 89 | // Take field 90 | pub fn take_name(&mut self) -> ::std::string::String { 91 | ::std::mem::replace(&mut self.name, ::std::string::String::new()) 92 | } 93 | 94 | // .tensorboardrs.mesh.MeshPluginData.ContentType content_type = 3; 95 | 96 | 97 | pub fn get_content_type(&self) -> MeshPluginData_ContentType { 98 | self.content_type 99 | } 100 | pub fn clear_content_type(&mut self) { 101 | self.content_type = MeshPluginData_ContentType::UNDEFINED; 102 | } 103 | 104 | // Param is passed by value, moved 105 | pub fn set_content_type(&mut self, v: MeshPluginData_ContentType) { 106 | self.content_type = v; 107 | } 108 | 109 | // string json_config = 5; 110 | 111 | 112 | pub fn get_json_config(&self) -> &str { 113 | &self.json_config 114 | } 115 | pub fn clear_json_config(&mut self) { 116 | self.json_config.clear(); 117 | } 118 | 119 | // Param is passed by value, moved 120 | pub fn set_json_config(&mut self, v: ::std::string::String) { 121 | self.json_config = v; 122 | } 123 | 124 | // Mutable pointer to the field. 125 | // If field is not initialized, it is initialized with default value first. 126 | pub fn mut_json_config(&mut self) -> &mut ::std::string::String { 127 | &mut self.json_config 128 | } 129 | 130 | // Take field 131 | pub fn take_json_config(&mut self) -> ::std::string::String { 132 | ::std::mem::replace(&mut self.json_config, ::std::string::String::new()) 133 | } 134 | 135 | // repeated int32 shape = 6; 136 | 137 | 138 | pub fn get_shape(&self) -> &[i32] { 139 | &self.shape 140 | } 141 | pub fn clear_shape(&mut self) { 142 | self.shape.clear(); 143 | } 144 | 145 | // Param is passed by value, moved 146 | pub fn set_shape(&mut self, v: ::std::vec::Vec) { 147 | self.shape = v; 148 | } 149 | 150 | // Mutable pointer to the field. 151 | pub fn mut_shape(&mut self) -> &mut ::std::vec::Vec { 152 | &mut self.shape 153 | } 154 | 155 | // Take field 156 | pub fn take_shape(&mut self) -> ::std::vec::Vec { 157 | ::std::mem::replace(&mut self.shape, ::std::vec::Vec::new()) 158 | } 159 | } 160 | 161 | impl ::protobuf::Message for MeshPluginData { 162 | fn is_initialized(&self) -> bool { 163 | true 164 | } 165 | 166 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 167 | while !is.eof()? { 168 | let (field_number, wire_type) = is.read_tag_unpack()?; 169 | match field_number { 170 | 1 => { 171 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 172 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 173 | } 174 | let tmp = is.read_int32()?; 175 | self.version = tmp; 176 | }, 177 | 2 => { 178 | ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; 179 | }, 180 | 3 => { 181 | ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.content_type, 3, &mut self.unknown_fields)? 182 | }, 183 | 5 => { 184 | ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.json_config)?; 185 | }, 186 | 6 => { 187 | ::protobuf::rt::read_repeated_int32_into(wire_type, is, &mut self.shape)?; 188 | }, 189 | _ => { 190 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 191 | }, 192 | }; 193 | } 194 | ::std::result::Result::Ok(()) 195 | } 196 | 197 | // Compute sizes of nested messages 198 | #[allow(unused_variables)] 199 | fn compute_size(&self) -> u32 { 200 | let mut my_size = 0; 201 | if self.version != 0 { 202 | my_size += ::protobuf::rt::value_size(1, self.version, ::protobuf::wire_format::WireTypeVarint); 203 | } 204 | if !self.name.is_empty() { 205 | my_size += ::protobuf::rt::string_size(2, &self.name); 206 | } 207 | if self.content_type != MeshPluginData_ContentType::UNDEFINED { 208 | my_size += ::protobuf::rt::enum_size(3, self.content_type); 209 | } 210 | if !self.json_config.is_empty() { 211 | my_size += ::protobuf::rt::string_size(5, &self.json_config); 212 | } 213 | for value in &self.shape { 214 | my_size += ::protobuf::rt::value_size(6, *value, ::protobuf::wire_format::WireTypeVarint); 215 | }; 216 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 217 | self.cached_size.set(my_size); 218 | my_size 219 | } 220 | 221 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 222 | if self.version != 0 { 223 | os.write_int32(1, self.version)?; 224 | } 225 | if !self.name.is_empty() { 226 | os.write_string(2, &self.name)?; 227 | } 228 | if self.content_type != MeshPluginData_ContentType::UNDEFINED { 229 | os.write_enum(3, self.content_type.value())?; 230 | } 231 | if !self.json_config.is_empty() { 232 | os.write_string(5, &self.json_config)?; 233 | } 234 | for v in &self.shape { 235 | os.write_int32(6, *v)?; 236 | }; 237 | os.write_unknown_fields(self.get_unknown_fields())?; 238 | ::std::result::Result::Ok(()) 239 | } 240 | 241 | fn get_cached_size(&self) -> u32 { 242 | self.cached_size.get() 243 | } 244 | 245 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 246 | &self.unknown_fields 247 | } 248 | 249 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 250 | &mut self.unknown_fields 251 | } 252 | 253 | fn as_any(&self) -> &dyn (::std::any::Any) { 254 | self as &dyn (::std::any::Any) 255 | } 256 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 257 | self as &mut dyn (::std::any::Any) 258 | } 259 | fn into_any(self: Box) -> ::std::boxed::Box { 260 | self 261 | } 262 | 263 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 264 | Self::descriptor_static() 265 | } 266 | 267 | fn new() -> MeshPluginData { 268 | MeshPluginData::new() 269 | } 270 | 271 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 272 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; 273 | unsafe { 274 | descriptor.get(|| { 275 | let mut fields = ::std::vec::Vec::new(); 276 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( 277 | "version", 278 | |m: &MeshPluginData| { &m.version }, 279 | |m: &mut MeshPluginData| { &mut m.version }, 280 | )); 281 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( 282 | "name", 283 | |m: &MeshPluginData| { &m.name }, 284 | |m: &mut MeshPluginData| { &mut m.name }, 285 | )); 286 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum>( 287 | "content_type", 288 | |m: &MeshPluginData| { &m.content_type }, 289 | |m: &mut MeshPluginData| { &mut m.content_type }, 290 | )); 291 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( 292 | "json_config", 293 | |m: &MeshPluginData| { &m.json_config }, 294 | |m: &mut MeshPluginData| { &mut m.json_config }, 295 | )); 296 | fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( 297 | "shape", 298 | |m: &MeshPluginData| { &m.shape }, 299 | |m: &mut MeshPluginData| { &mut m.shape }, 300 | )); 301 | ::protobuf::reflect::MessageDescriptor::new_pb_name::( 302 | "MeshPluginData", 303 | fields, 304 | file_descriptor_proto() 305 | ) 306 | }) 307 | } 308 | } 309 | 310 | fn default_instance() -> &'static MeshPluginData { 311 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; 312 | unsafe { 313 | instance.get(MeshPluginData::new) 314 | } 315 | } 316 | } 317 | 318 | impl ::protobuf::Clear for MeshPluginData { 319 | fn clear(&mut self) { 320 | self.version = 0; 321 | self.name.clear(); 322 | self.content_type = MeshPluginData_ContentType::UNDEFINED; 323 | self.json_config.clear(); 324 | self.shape.clear(); 325 | self.unknown_fields.clear(); 326 | } 327 | } 328 | 329 | impl ::std::fmt::Debug for MeshPluginData { 330 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 331 | ::protobuf::text_format::fmt(self, f) 332 | } 333 | } 334 | 335 | impl ::protobuf::reflect::ProtobufValue for MeshPluginData { 336 | fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { 337 | ::protobuf::reflect::ReflectValueRef::Message(self) 338 | } 339 | } 340 | 341 | #[derive(Clone,PartialEq,Eq,Debug,Hash)] 342 | pub enum MeshPluginData_ContentType { 343 | UNDEFINED = 0, 344 | VERTEX = 1, 345 | FACE = 2, 346 | COLOR = 3, 347 | } 348 | 349 | impl ::protobuf::ProtobufEnum for MeshPluginData_ContentType { 350 | fn value(&self) -> i32 { 351 | *self as i32 352 | } 353 | 354 | fn from_i32(value: i32) -> ::std::option::Option { 355 | match value { 356 | 0 => ::std::option::Option::Some(MeshPluginData_ContentType::UNDEFINED), 357 | 1 => ::std::option::Option::Some(MeshPluginData_ContentType::VERTEX), 358 | 2 => ::std::option::Option::Some(MeshPluginData_ContentType::FACE), 359 | 3 => ::std::option::Option::Some(MeshPluginData_ContentType::COLOR), 360 | _ => ::std::option::Option::None 361 | } 362 | } 363 | 364 | fn values() -> &'static [Self] { 365 | static values: &'static [MeshPluginData_ContentType] = &[ 366 | MeshPluginData_ContentType::UNDEFINED, 367 | MeshPluginData_ContentType::VERTEX, 368 | MeshPluginData_ContentType::FACE, 369 | MeshPluginData_ContentType::COLOR, 370 | ]; 371 | values 372 | } 373 | 374 | fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { 375 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy::INIT; 376 | unsafe { 377 | descriptor.get(|| { 378 | ::protobuf::reflect::EnumDescriptor::new_pb_name::("MeshPluginData.ContentType", file_descriptor_proto()) 379 | }) 380 | } 381 | } 382 | } 383 | 384 | impl ::std::marker::Copy for MeshPluginData_ContentType { 385 | } 386 | 387 | impl ::std::default::Default for MeshPluginData_ContentType { 388 | fn default() -> Self { 389 | MeshPluginData_ContentType::UNDEFINED 390 | } 391 | } 392 | 393 | impl ::protobuf::reflect::ProtobufValue for MeshPluginData_ContentType { 394 | fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { 395 | ::protobuf::reflect::ReflectValueRef::Enum(self.descriptor()) 396 | } 397 | } 398 | 399 | static file_descriptor_proto_data: &'static [u8] = b"\ 400 | \n)src/tensorboardrs/proto/plugin_mesh.proto\x12\x12tensorboardrs.mesh\"\ 401 | \x87\x02\n\x0eMeshPluginData\x12\x18\n\x07version\x18\x01\x20\x01(\x05R\ 402 | \x07version\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04name\x12Q\n\x0ccont\ 403 | ent_type\x18\x03\x20\x01(\x0e2..tensorboardrs.mesh.MeshPluginData.Conten\ 404 | tTypeR\x0bcontentType\x12\x1f\n\x0bjson_config\x18\x05\x20\x01(\tR\njson\ 405 | Config\x12\x14\n\x05shape\x18\x06\x20\x03(\x05R\x05shape\"=\n\x0bContent\ 406 | Type\x12\r\n\tUNDEFINED\x10\0\x12\n\n\x06VERTEX\x10\x01\x12\x08\n\x04FAC\ 407 | E\x10\x02\x12\t\n\x05COLOR\x10\x03J\xc5\x07\n\x06\x12\x04\0\0\x1c\x01\n\ 408 | \x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x02\0\x1b\nz\n\ 409 | \x02\x04\0\x12\x04\x06\0\x1c\x01\x1an\x20A\x20MeshPluginData\x20encapsul\ 410 | ates\x20information\x20on\x20which\x20plugins\x20are\x20able\x20to\x20ma\ 411 | ke\n\x20use\x20of\x20a\x20certain\x20summary\x20value.\n\n\n\n\x03\x04\0\ 412 | \x01\x12\x03\x06\x08\x16\n\x0c\n\x04\x04\0\x04\0\x12\x04\x07\x02\x0c\x03\ 413 | \n\x0c\n\x05\x04\0\x04\0\x01\x12\x03\x07\x07\x12\n\r\n\x06\x04\0\x04\0\ 414 | \x02\0\x12\x03\x08\x04\x12\n\x0e\n\x07\x04\0\x04\0\x02\0\x01\x12\x03\x08\ 415 | \x04\r\n\x0e\n\x07\x04\0\x04\0\x02\0\x02\x12\x03\x08\x10\x11\n\r\n\x06\ 416 | \x04\0\x04\0\x02\x01\x12\x03\t\x04\x0f\n\x0e\n\x07\x04\0\x04\0\x02\x01\ 417 | \x01\x12\x03\t\x04\n\n\x0e\n\x07\x04\0\x04\0\x02\x01\x02\x12\x03\t\r\x0e\ 418 | \n\x1f\n\x06\x04\0\x04\0\x02\x02\x12\x03\n\x04\r\"\x10\x20Triangle\x20fa\ 419 | ce.\n\n\x0e\n\x07\x04\0\x04\0\x02\x02\x01\x12\x03\n\x04\x08\n\x0e\n\x07\ 420 | \x04\0\x04\0\x02\x02\x02\x12\x03\n\x0b\x0c\n\r\n\x06\x04\0\x04\0\x02\x03\ 421 | \x12\x03\x0b\x04\x0e\n\x0e\n\x07\x04\0\x04\0\x02\x03\x01\x12\x03\x0b\x04\ 422 | \t\n\x0e\n\x07\x04\0\x04\0\x02\x03\x02\x12\x03\x0b\x0c\r\n9\n\x04\x04\0\ 423 | \x02\0\x12\x03\x0f\x02\x14\x1a,\x20Version\x20`0`\x20is\x20the\x20only\ 424 | \x20supported\x20version.\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x0f\x02\ 425 | \x07\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x0f\x08\x0f\n\x0c\n\x05\x04\0\ 426 | \x02\0\x03\x12\x03\x0f\x12\x13\nO\n\x04\x04\0\x02\x01\x12\x03\x12\x02\ 427 | \x12\x1aB\x20The\x20name\x20of\x20the\x20mesh\x20summary\x20this\x20part\ 428 | icular\x20summary\x20belongs\x20to.\n\n\x0c\n\x05\x04\0\x02\x01\x05\x12\ 429 | \x03\x12\x02\x08\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x12\t\r\n\x0c\n\ 430 | \x05\x04\0\x02\x01\x03\x12\x03\x12\x10\x11\n+\n\x04\x04\0\x02\x02\x12\ 431 | \x03\x15\x02\x1f\x1a\x1e\x20Type\x20of\x20data\x20in\x20the\x20summary.\ 432 | \n\n\x0c\n\x05\x04\0\x02\x02\x06\x12\x03\x15\x02\r\n\x0c\n\x05\x04\0\x02\ 433 | \x02\x01\x12\x03\x15\x0e\x1a\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x15\ 434 | \x1d\x1e\nK\n\x04\x04\0\x02\x03\x12\x03\x18\x02\x19\x1a>\x20JSON-seriali\ 435 | zed\x20dictionary\x20of\x20ThreeJS\x20classes\x20configuration.\n\n\x0c\ 436 | \n\x05\x04\0\x02\x03\x05\x12\x03\x18\x02\x08\n\x0c\n\x05\x04\0\x02\x03\ 437 | \x01\x12\x03\x18\t\x14\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\x18\x17\x18\ 438 | \nO\n\x04\x04\0\x02\x04\x12\x03\x1b\x02\x1b\x1aB\x20Shape\x20of\x20under\ 439 | lying\x20data.\x20Cache\x20it\x20here\x20for\x20performance\x20reasons.\ 440 | \n\n\x0c\n\x05\x04\0\x02\x04\x04\x12\x03\x1b\x02\n\n\x0c\n\x05\x04\0\x02\ 441 | \x04\x05\x12\x03\x1b\x0b\x10\n\x0c\n\x05\x04\0\x02\x04\x01\x12\x03\x1b\ 442 | \x11\x16\n\x0c\n\x05\x04\0\x02\x04\x03\x12\x03\x1b\x19\x1ab\x06proto3\ 443 | "; 444 | 445 | static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT; 446 | 447 | fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { 448 | ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() 449 | } 450 | 451 | pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { 452 | unsafe { 453 | file_descriptor_proto_lazy.get(|| { 454 | parse_descriptor_proto() 455 | }) 456 | } 457 | } 458 | -------------------------------------------------------------------------------- /src/proto/plugin_pr_curve.proto: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | syntax = "proto3"; 17 | 18 | package tensorboardrs; 19 | 20 | message PrCurvePluginData { 21 | // Version `0` is the only supported version. 22 | int32 version = 1; 23 | 24 | uint32 num_thresholds = 2; 25 | } 26 | -------------------------------------------------------------------------------- /src/proto/plugin_pr_curve.rs: -------------------------------------------------------------------------------- 1 | // This file is generated by rust-protobuf 2.14.0. Do not edit 2 | // @generated 3 | 4 | // https://github.com/rust-lang/rust-clippy/issues/702 5 | #![allow(unknown_lints)] 6 | #![allow(clippy::all)] 7 | 8 | #![cfg_attr(rustfmt, rustfmt_skip)] 9 | 10 | #![allow(box_pointers)] 11 | #![allow(dead_code)] 12 | #![allow(missing_docs)] 13 | #![allow(non_camel_case_types)] 14 | #![allow(non_snake_case)] 15 | #![allow(non_upper_case_globals)] 16 | #![allow(trivial_casts)] 17 | #![allow(unsafe_code)] 18 | #![allow(unused_imports)] 19 | #![allow(unused_results)] 20 | //! Generated file from `src/tensorboardrs/proto/plugin_pr_curve.proto` 21 | 22 | use protobuf::Message as Message_imported_for_functions; 23 | use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; 24 | 25 | /// Generated files are compatible only with the same version 26 | /// of protobuf runtime. 27 | // const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_14_0; 28 | 29 | #[derive(PartialEq,Clone,Default)] 30 | pub struct PrCurvePluginData { 31 | // message fields 32 | pub version: i32, 33 | pub num_thresholds: u32, 34 | // special fields 35 | pub unknown_fields: ::protobuf::UnknownFields, 36 | pub cached_size: ::protobuf::CachedSize, 37 | } 38 | 39 | impl<'a> ::std::default::Default for &'a PrCurvePluginData { 40 | fn default() -> &'a PrCurvePluginData { 41 | ::default_instance() 42 | } 43 | } 44 | 45 | impl PrCurvePluginData { 46 | pub fn new() -> PrCurvePluginData { 47 | ::std::default::Default::default() 48 | } 49 | 50 | // int32 version = 1; 51 | 52 | 53 | pub fn get_version(&self) -> i32 { 54 | self.version 55 | } 56 | pub fn clear_version(&mut self) { 57 | self.version = 0; 58 | } 59 | 60 | // Param is passed by value, moved 61 | pub fn set_version(&mut self, v: i32) { 62 | self.version = v; 63 | } 64 | 65 | // uint32 num_thresholds = 2; 66 | 67 | 68 | pub fn get_num_thresholds(&self) -> u32 { 69 | self.num_thresholds 70 | } 71 | pub fn clear_num_thresholds(&mut self) { 72 | self.num_thresholds = 0; 73 | } 74 | 75 | // Param is passed by value, moved 76 | pub fn set_num_thresholds(&mut self, v: u32) { 77 | self.num_thresholds = v; 78 | } 79 | } 80 | 81 | impl ::protobuf::Message for PrCurvePluginData { 82 | fn is_initialized(&self) -> bool { 83 | true 84 | } 85 | 86 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 87 | while !is.eof()? { 88 | let (field_number, wire_type) = is.read_tag_unpack()?; 89 | match field_number { 90 | 1 => { 91 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 92 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 93 | } 94 | let tmp = is.read_int32()?; 95 | self.version = tmp; 96 | }, 97 | 2 => { 98 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 99 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 100 | } 101 | let tmp = is.read_uint32()?; 102 | self.num_thresholds = tmp; 103 | }, 104 | _ => { 105 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 106 | }, 107 | }; 108 | } 109 | ::std::result::Result::Ok(()) 110 | } 111 | 112 | // Compute sizes of nested messages 113 | #[allow(unused_variables)] 114 | fn compute_size(&self) -> u32 { 115 | let mut my_size = 0; 116 | if self.version != 0 { 117 | my_size += ::protobuf::rt::value_size(1, self.version, ::protobuf::wire_format::WireTypeVarint); 118 | } 119 | if self.num_thresholds != 0 { 120 | my_size += ::protobuf::rt::value_size(2, self.num_thresholds, ::protobuf::wire_format::WireTypeVarint); 121 | } 122 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 123 | self.cached_size.set(my_size); 124 | my_size 125 | } 126 | 127 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 128 | if self.version != 0 { 129 | os.write_int32(1, self.version)?; 130 | } 131 | if self.num_thresholds != 0 { 132 | os.write_uint32(2, self.num_thresholds)?; 133 | } 134 | os.write_unknown_fields(self.get_unknown_fields())?; 135 | ::std::result::Result::Ok(()) 136 | } 137 | 138 | fn get_cached_size(&self) -> u32 { 139 | self.cached_size.get() 140 | } 141 | 142 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 143 | &self.unknown_fields 144 | } 145 | 146 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 147 | &mut self.unknown_fields 148 | } 149 | 150 | fn as_any(&self) -> &dyn (::std::any::Any) { 151 | self as &dyn (::std::any::Any) 152 | } 153 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 154 | self as &mut dyn (::std::any::Any) 155 | } 156 | fn into_any(self: Box) -> ::std::boxed::Box { 157 | self 158 | } 159 | 160 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 161 | Self::descriptor_static() 162 | } 163 | 164 | fn new() -> PrCurvePluginData { 165 | PrCurvePluginData::new() 166 | } 167 | 168 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 169 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; 170 | unsafe { 171 | descriptor.get(|| { 172 | let mut fields = ::std::vec::Vec::new(); 173 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( 174 | "version", 175 | |m: &PrCurvePluginData| { &m.version }, 176 | |m: &mut PrCurvePluginData| { &mut m.version }, 177 | )); 178 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint32>( 179 | "num_thresholds", 180 | |m: &PrCurvePluginData| { &m.num_thresholds }, 181 | |m: &mut PrCurvePluginData| { &mut m.num_thresholds }, 182 | )); 183 | ::protobuf::reflect::MessageDescriptor::new_pb_name::( 184 | "PrCurvePluginData", 185 | fields, 186 | file_descriptor_proto() 187 | ) 188 | }) 189 | } 190 | } 191 | 192 | fn default_instance() -> &'static PrCurvePluginData { 193 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; 194 | unsafe { 195 | instance.get(PrCurvePluginData::new) 196 | } 197 | } 198 | } 199 | 200 | impl ::protobuf::Clear for PrCurvePluginData { 201 | fn clear(&mut self) { 202 | self.version = 0; 203 | self.num_thresholds = 0; 204 | self.unknown_fields.clear(); 205 | } 206 | } 207 | 208 | impl ::std::fmt::Debug for PrCurvePluginData { 209 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 210 | ::protobuf::text_format::fmt(self, f) 211 | } 212 | } 213 | 214 | impl ::protobuf::reflect::ProtobufValue for PrCurvePluginData { 215 | fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { 216 | ::protobuf::reflect::ReflectValueRef::Message(self) 217 | } 218 | } 219 | 220 | static file_descriptor_proto_data: &'static [u8] = b"\ 221 | \n-src/tensorboardrs/proto/plugin_pr_curve.proto\x12\rtensorboardrs\"T\n\ 222 | \x11PrCurvePluginData\x12\x18\n\x07version\x18\x01\x20\x01(\x05R\x07vers\ 223 | ion\x12%\n\x0enum_thresholds\x18\x02\x20\x01(\rR\rnumThresholdsJ\xe8\x06\ 224 | \n\x06\x12\x04\x0f\0\x18\x01\n\x9f\x05\n\x01\x0c\x12\x03\x0f\0\x122\x94\ 225 | \x05\x20Copyright\x202017\x20The\x20TensorFlow\x20Authors.\x20All\x20Rig\ 226 | hts\x20Reserved.\n\nLicensed\x20under\x20the\x20Apache\x20License,\x20Ve\ 227 | rsion\x202.0\x20(the\x20\"License\");\nyou\x20may\x20not\x20use\x20this\ 228 | \x20file\x20except\x20in\x20compliance\x20with\x20the\x20License.\nYou\ 229 | \x20may\x20obtain\x20a\x20copy\x20of\x20the\x20License\x20at\n\nhttp://w\ 230 | ww.apache.org/licenses/LICENSE-2.0\n\nUnless\x20required\x20by\x20applic\ 231 | able\x20law\x20or\x20agreed\x20to\x20in\x20writing,\x20software\ndistrib\ 232 | uted\x20under\x20the\x20License\x20is\x20distributed\x20on\x20an\x20\"AS\ 233 | \x20IS\"\x20BASIS,\nWITHOUT\x20WARRANTIES\x20OR\x20CONDITIONS\x20OF\x20A\ 234 | NY\x20KIND,\x20either\x20express\x20or\x20implied.\nSee\x20the\x20Licens\ 235 | e\x20for\x20the\x20specific\x20language\x20governing\x20permissions\x20a\ 236 | nd\nlimitations\x20under\x20the\x20License.\n===========================\ 237 | ===================================================\n\x08\n\x01\x02\x12\ 238 | \x03\x11\0\x16\n\n\n\x02\x04\0\x12\x04\x13\0\x18\x01\n\n\n\x03\x04\0\x01\ 239 | \x12\x03\x13\x08\x19\n9\n\x04\x04\0\x02\0\x12\x03\x15\x02\x14\x1a,\x20Ve\ 240 | rsion\x20`0`\x20is\x20the\x20only\x20supported\x20version.\n\n\x0c\n\x05\ 241 | \x04\0\x02\0\x05\x12\x03\x15\x02\x07\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\ 242 | \x15\x08\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x15\x12\x13\n\x0b\n\x04\ 243 | \x04\0\x02\x01\x12\x03\x17\x02\x1c\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\ 244 | \x17\x02\x08\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x17\t\x17\n\x0c\n\x05\ 245 | \x04\0\x02\x01\x03\x12\x03\x17\x1a\x1bb\x06proto3\ 246 | "; 247 | 248 | static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT; 249 | 250 | fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { 251 | ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() 252 | } 253 | 254 | pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { 255 | unsafe { 256 | file_descriptor_proto_lazy.get(|| { 257 | parse_descriptor_proto() 258 | }) 259 | } 260 | } 261 | -------------------------------------------------------------------------------- /src/proto/plugin_text.proto: -------------------------------------------------------------------------------- 1 | /* Copyright 2017 The TensorFlow Authors. All Rights Reserved. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | ==============================================================================*/ 15 | 16 | syntax = "proto3"; 17 | 18 | package tensorboardrs; 19 | 20 | // Text summaries created by the `tensorboard.plugins.text.summary` 21 | // module will include `SummaryMetadata` whose `plugin_data` field has 22 | // as `content` a binary string that is the encoding of an 23 | // `TextPluginData` proto. 24 | message TextPluginData { 25 | // Version `0` is the only supported version. 26 | int32 version = 1; 27 | } 28 | -------------------------------------------------------------------------------- /src/proto/plugin_text.rs: -------------------------------------------------------------------------------- 1 | // This file is generated by rust-protobuf 2.14.0. Do not edit 2 | // @generated 3 | 4 | // https://github.com/rust-lang/rust-clippy/issues/702 5 | #![allow(unknown_lints)] 6 | #![allow(clippy::all)] 7 | 8 | #![cfg_attr(rustfmt, rustfmt_skip)] 9 | 10 | #![allow(box_pointers)] 11 | #![allow(dead_code)] 12 | #![allow(missing_docs)] 13 | #![allow(non_camel_case_types)] 14 | #![allow(non_snake_case)] 15 | #![allow(non_upper_case_globals)] 16 | #![allow(trivial_casts)] 17 | #![allow(unsafe_code)] 18 | #![allow(unused_imports)] 19 | #![allow(unused_results)] 20 | //! Generated file from `src/tensorboardrs/proto/plugin_text.proto` 21 | 22 | use protobuf::Message as Message_imported_for_functions; 23 | use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; 24 | 25 | /// Generated files are compatible only with the same version 26 | /// of protobuf runtime. 27 | // const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_14_0; 28 | 29 | #[derive(PartialEq,Clone,Default)] 30 | pub struct TextPluginData { 31 | // message fields 32 | pub version: i32, 33 | // special fields 34 | pub unknown_fields: ::protobuf::UnknownFields, 35 | pub cached_size: ::protobuf::CachedSize, 36 | } 37 | 38 | impl<'a> ::std::default::Default for &'a TextPluginData { 39 | fn default() -> &'a TextPluginData { 40 | ::default_instance() 41 | } 42 | } 43 | 44 | impl TextPluginData { 45 | pub fn new() -> TextPluginData { 46 | ::std::default::Default::default() 47 | } 48 | 49 | // int32 version = 1; 50 | 51 | 52 | pub fn get_version(&self) -> i32 { 53 | self.version 54 | } 55 | pub fn clear_version(&mut self) { 56 | self.version = 0; 57 | } 58 | 59 | // Param is passed by value, moved 60 | pub fn set_version(&mut self, v: i32) { 61 | self.version = v; 62 | } 63 | } 64 | 65 | impl ::protobuf::Message for TextPluginData { 66 | fn is_initialized(&self) -> bool { 67 | true 68 | } 69 | 70 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 71 | while !is.eof()? { 72 | let (field_number, wire_type) = is.read_tag_unpack()?; 73 | match field_number { 74 | 1 => { 75 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 76 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 77 | } 78 | let tmp = is.read_int32()?; 79 | self.version = tmp; 80 | }, 81 | _ => { 82 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 83 | }, 84 | }; 85 | } 86 | ::std::result::Result::Ok(()) 87 | } 88 | 89 | // Compute sizes of nested messages 90 | #[allow(unused_variables)] 91 | fn compute_size(&self) -> u32 { 92 | let mut my_size = 0; 93 | if self.version != 0 { 94 | my_size += ::protobuf::rt::value_size(1, self.version, ::protobuf::wire_format::WireTypeVarint); 95 | } 96 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 97 | self.cached_size.set(my_size); 98 | my_size 99 | } 100 | 101 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 102 | if self.version != 0 { 103 | os.write_int32(1, self.version)?; 104 | } 105 | os.write_unknown_fields(self.get_unknown_fields())?; 106 | ::std::result::Result::Ok(()) 107 | } 108 | 109 | fn get_cached_size(&self) -> u32 { 110 | self.cached_size.get() 111 | } 112 | 113 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 114 | &self.unknown_fields 115 | } 116 | 117 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 118 | &mut self.unknown_fields 119 | } 120 | 121 | fn as_any(&self) -> &dyn (::std::any::Any) { 122 | self as &dyn (::std::any::Any) 123 | } 124 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 125 | self as &mut dyn (::std::any::Any) 126 | } 127 | fn into_any(self: Box) -> ::std::boxed::Box { 128 | self 129 | } 130 | 131 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 132 | Self::descriptor_static() 133 | } 134 | 135 | fn new() -> TextPluginData { 136 | TextPluginData::new() 137 | } 138 | 139 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 140 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; 141 | unsafe { 142 | descriptor.get(|| { 143 | let mut fields = ::std::vec::Vec::new(); 144 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( 145 | "version", 146 | |m: &TextPluginData| { &m.version }, 147 | |m: &mut TextPluginData| { &mut m.version }, 148 | )); 149 | ::protobuf::reflect::MessageDescriptor::new_pb_name::( 150 | "TextPluginData", 151 | fields, 152 | file_descriptor_proto() 153 | ) 154 | }) 155 | } 156 | } 157 | 158 | fn default_instance() -> &'static TextPluginData { 159 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; 160 | unsafe { 161 | instance.get(TextPluginData::new) 162 | } 163 | } 164 | } 165 | 166 | impl ::protobuf::Clear for TextPluginData { 167 | fn clear(&mut self) { 168 | self.version = 0; 169 | self.unknown_fields.clear(); 170 | } 171 | } 172 | 173 | impl ::std::fmt::Debug for TextPluginData { 174 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 175 | ::protobuf::text_format::fmt(self, f) 176 | } 177 | } 178 | 179 | impl ::protobuf::reflect::ProtobufValue for TextPluginData { 180 | fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { 181 | ::protobuf::reflect::ReflectValueRef::Message(self) 182 | } 183 | } 184 | 185 | static file_descriptor_proto_data: &'static [u8] = b"\ 186 | \n)src/tensorboardrs/proto/plugin_text.proto\x12\rtensorboardrs\"*\n\x0e\ 187 | TextPluginData\x12\x18\n\x07version\x18\x01\x20\x01(\x05R\x07versionJ\ 188 | \x8e\x08\n\x06\x12\x04\x0f\0\x1a\x01\n\x9f\x05\n\x01\x0c\x12\x03\x0f\0\ 189 | \x122\x94\x05\x20Copyright\x202017\x20The\x20TensorFlow\x20Authors.\x20A\ 190 | ll\x20Rights\x20Reserved.\n\nLicensed\x20under\x20the\x20Apache\x20Licen\ 191 | se,\x20Version\x202.0\x20(the\x20\"License\");\nyou\x20may\x20not\x20use\ 192 | \x20this\x20file\x20except\x20in\x20compliance\x20with\x20the\x20License\ 193 | .\nYou\x20may\x20obtain\x20a\x20copy\x20of\x20the\x20License\x20at\n\nht\ 194 | tp://www.apache.org/licenses/LICENSE-2.0\n\nUnless\x20required\x20by\x20\ 195 | applicable\x20law\x20or\x20agreed\x20to\x20in\x20writing,\x20software\nd\ 196 | istributed\x20under\x20the\x20License\x20is\x20distributed\x20on\x20an\ 197 | \x20\"AS\x20IS\"\x20BASIS,\nWITHOUT\x20WARRANTIES\x20OR\x20CONDITIONS\ 198 | \x20OF\x20ANY\x20KIND,\x20either\x20express\x20or\x20implied.\nSee\x20th\ 199 | e\x20License\x20for\x20the\x20specific\x20language\x20governing\x20permi\ 200 | ssions\x20and\nlimitations\x20under\x20the\x20License.\n================\ 201 | ==============================================================\n\x08\n\ 202 | \x01\x02\x12\x03\x11\0\x16\n\xe6\x01\n\x02\x04\0\x12\x04\x17\0\x1a\x01\ 203 | \x1a\xd9\x01\x20Text\x20summaries\x20created\x20by\x20the\x20`tensorboar\ 204 | d.plugins.text.summary`\n\x20module\x20will\x20include\x20`SummaryMetada\ 205 | ta`\x20whose\x20`plugin_data`\x20field\x20has\n\x20as\x20`content`\x20a\ 206 | \x20binary\x20string\x20that\x20is\x20the\x20encoding\x20of\x20an\n\x20`\ 207 | TextPluginData`\x20proto.\n\n\n\n\x03\x04\0\x01\x12\x03\x17\x08\x16\n9\n\ 208 | \x04\x04\0\x02\0\x12\x03\x19\x02\x14\x1a,\x20Version\x20`0`\x20is\x20the\ 209 | \x20only\x20supported\x20version.\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\ 210 | \x19\x02\x07\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x19\x08\x0f\n\x0c\n\x05\ 211 | \x04\0\x02\0\x03\x12\x03\x19\x12\x13b\x06proto3\ 212 | "; 213 | 214 | static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT; 215 | 216 | fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { 217 | ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() 218 | } 219 | 220 | pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { 221 | unsafe { 222 | file_descriptor_proto_lazy.get(|| { 223 | parse_descriptor_proto() 224 | }) 225 | } 226 | } 227 | -------------------------------------------------------------------------------- /src/proto/resource_handle.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorboardrs; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "ResourceHandle"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | 9 | // Protocol buffer representing a handle to a tensorflow resource. Handles are 10 | // not valid across executions, but can be serialized back and forth from within 11 | // a single run. 12 | message ResourceHandleProto { 13 | // Unique name for the device containing the resource. 14 | string device = 1; 15 | 16 | // Container in which this resource is placed. 17 | string container = 2; 18 | 19 | // Unique name of this resource. 20 | string name = 3; 21 | 22 | // Hash code for the type of the resource. Is only valid in the same device 23 | // and in the same execution. 24 | uint64 hash_code = 4; 25 | 26 | // For debug-only, the name of the type pointed to by this handle, if 27 | // available. 28 | string maybe_type_name = 5; 29 | }; 30 | -------------------------------------------------------------------------------- /src/proto/resource_handle.rs: -------------------------------------------------------------------------------- 1 | // This file is generated by rust-protobuf 2.14.0. Do not edit 2 | // @generated 3 | 4 | // https://github.com/rust-lang/rust-clippy/issues/702 5 | #![allow(unknown_lints)] 6 | #![allow(clippy::all)] 7 | 8 | #![cfg_attr(rustfmt, rustfmt_skip)] 9 | 10 | #![allow(box_pointers)] 11 | #![allow(dead_code)] 12 | #![allow(missing_docs)] 13 | #![allow(non_camel_case_types)] 14 | #![allow(non_snake_case)] 15 | #![allow(non_upper_case_globals)] 16 | #![allow(trivial_casts)] 17 | #![allow(unsafe_code)] 18 | #![allow(unused_imports)] 19 | #![allow(unused_results)] 20 | //! Generated file from `src/tensorboardrs/proto/resource_handle.proto` 21 | 22 | use protobuf::Message as Message_imported_for_functions; 23 | use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; 24 | 25 | /// Generated files are compatible only with the same version 26 | /// of protobuf runtime. 27 | // const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_14_0; 28 | 29 | #[derive(PartialEq,Clone,Default)] 30 | pub struct ResourceHandleProto { 31 | // message fields 32 | pub device: ::std::string::String, 33 | pub container: ::std::string::String, 34 | pub name: ::std::string::String, 35 | pub hash_code: u64, 36 | pub maybe_type_name: ::std::string::String, 37 | // special fields 38 | pub unknown_fields: ::protobuf::UnknownFields, 39 | pub cached_size: ::protobuf::CachedSize, 40 | } 41 | 42 | impl<'a> ::std::default::Default for &'a ResourceHandleProto { 43 | fn default() -> &'a ResourceHandleProto { 44 | ::default_instance() 45 | } 46 | } 47 | 48 | impl ResourceHandleProto { 49 | pub fn new() -> ResourceHandleProto { 50 | ::std::default::Default::default() 51 | } 52 | 53 | // string device = 1; 54 | 55 | 56 | pub fn get_device(&self) -> &str { 57 | &self.device 58 | } 59 | pub fn clear_device(&mut self) { 60 | self.device.clear(); 61 | } 62 | 63 | // Param is passed by value, moved 64 | pub fn set_device(&mut self, v: ::std::string::String) { 65 | self.device = v; 66 | } 67 | 68 | // Mutable pointer to the field. 69 | // If field is not initialized, it is initialized with default value first. 70 | pub fn mut_device(&mut self) -> &mut ::std::string::String { 71 | &mut self.device 72 | } 73 | 74 | // Take field 75 | pub fn take_device(&mut self) -> ::std::string::String { 76 | ::std::mem::replace(&mut self.device, ::std::string::String::new()) 77 | } 78 | 79 | // string container = 2; 80 | 81 | 82 | pub fn get_container(&self) -> &str { 83 | &self.container 84 | } 85 | pub fn clear_container(&mut self) { 86 | self.container.clear(); 87 | } 88 | 89 | // Param is passed by value, moved 90 | pub fn set_container(&mut self, v: ::std::string::String) { 91 | self.container = v; 92 | } 93 | 94 | // Mutable pointer to the field. 95 | // If field is not initialized, it is initialized with default value first. 96 | pub fn mut_container(&mut self) -> &mut ::std::string::String { 97 | &mut self.container 98 | } 99 | 100 | // Take field 101 | pub fn take_container(&mut self) -> ::std::string::String { 102 | ::std::mem::replace(&mut self.container, ::std::string::String::new()) 103 | } 104 | 105 | // string name = 3; 106 | 107 | 108 | pub fn get_name(&self) -> &str { 109 | &self.name 110 | } 111 | pub fn clear_name(&mut self) { 112 | self.name.clear(); 113 | } 114 | 115 | // Param is passed by value, moved 116 | pub fn set_name(&mut self, v: ::std::string::String) { 117 | self.name = v; 118 | } 119 | 120 | // Mutable pointer to the field. 121 | // If field is not initialized, it is initialized with default value first. 122 | pub fn mut_name(&mut self) -> &mut ::std::string::String { 123 | &mut self.name 124 | } 125 | 126 | // Take field 127 | pub fn take_name(&mut self) -> ::std::string::String { 128 | ::std::mem::replace(&mut self.name, ::std::string::String::new()) 129 | } 130 | 131 | // uint64 hash_code = 4; 132 | 133 | 134 | pub fn get_hash_code(&self) -> u64 { 135 | self.hash_code 136 | } 137 | pub fn clear_hash_code(&mut self) { 138 | self.hash_code = 0; 139 | } 140 | 141 | // Param is passed by value, moved 142 | pub fn set_hash_code(&mut self, v: u64) { 143 | self.hash_code = v; 144 | } 145 | 146 | // string maybe_type_name = 5; 147 | 148 | 149 | pub fn get_maybe_type_name(&self) -> &str { 150 | &self.maybe_type_name 151 | } 152 | pub fn clear_maybe_type_name(&mut self) { 153 | self.maybe_type_name.clear(); 154 | } 155 | 156 | // Param is passed by value, moved 157 | pub fn set_maybe_type_name(&mut self, v: ::std::string::String) { 158 | self.maybe_type_name = v; 159 | } 160 | 161 | // Mutable pointer to the field. 162 | // If field is not initialized, it is initialized with default value first. 163 | pub fn mut_maybe_type_name(&mut self) -> &mut ::std::string::String { 164 | &mut self.maybe_type_name 165 | } 166 | 167 | // Take field 168 | pub fn take_maybe_type_name(&mut self) -> ::std::string::String { 169 | ::std::mem::replace(&mut self.maybe_type_name, ::std::string::String::new()) 170 | } 171 | } 172 | 173 | impl ::protobuf::Message for ResourceHandleProto { 174 | fn is_initialized(&self) -> bool { 175 | true 176 | } 177 | 178 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 179 | while !is.eof()? { 180 | let (field_number, wire_type) = is.read_tag_unpack()?; 181 | match field_number { 182 | 1 => { 183 | ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.device)?; 184 | }, 185 | 2 => { 186 | ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.container)?; 187 | }, 188 | 3 => { 189 | ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; 190 | }, 191 | 4 => { 192 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 193 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 194 | } 195 | let tmp = is.read_uint64()?; 196 | self.hash_code = tmp; 197 | }, 198 | 5 => { 199 | ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.maybe_type_name)?; 200 | }, 201 | _ => { 202 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 203 | }, 204 | }; 205 | } 206 | ::std::result::Result::Ok(()) 207 | } 208 | 209 | // Compute sizes of nested messages 210 | #[allow(unused_variables)] 211 | fn compute_size(&self) -> u32 { 212 | let mut my_size = 0; 213 | if !self.device.is_empty() { 214 | my_size += ::protobuf::rt::string_size(1, &self.device); 215 | } 216 | if !self.container.is_empty() { 217 | my_size += ::protobuf::rt::string_size(2, &self.container); 218 | } 219 | if !self.name.is_empty() { 220 | my_size += ::protobuf::rt::string_size(3, &self.name); 221 | } 222 | if self.hash_code != 0 { 223 | my_size += ::protobuf::rt::value_size(4, self.hash_code, ::protobuf::wire_format::WireTypeVarint); 224 | } 225 | if !self.maybe_type_name.is_empty() { 226 | my_size += ::protobuf::rt::string_size(5, &self.maybe_type_name); 227 | } 228 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 229 | self.cached_size.set(my_size); 230 | my_size 231 | } 232 | 233 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 234 | if !self.device.is_empty() { 235 | os.write_string(1, &self.device)?; 236 | } 237 | if !self.container.is_empty() { 238 | os.write_string(2, &self.container)?; 239 | } 240 | if !self.name.is_empty() { 241 | os.write_string(3, &self.name)?; 242 | } 243 | if self.hash_code != 0 { 244 | os.write_uint64(4, self.hash_code)?; 245 | } 246 | if !self.maybe_type_name.is_empty() { 247 | os.write_string(5, &self.maybe_type_name)?; 248 | } 249 | os.write_unknown_fields(self.get_unknown_fields())?; 250 | ::std::result::Result::Ok(()) 251 | } 252 | 253 | fn get_cached_size(&self) -> u32 { 254 | self.cached_size.get() 255 | } 256 | 257 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 258 | &self.unknown_fields 259 | } 260 | 261 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 262 | &mut self.unknown_fields 263 | } 264 | 265 | fn as_any(&self) -> &dyn (::std::any::Any) { 266 | self as &dyn (::std::any::Any) 267 | } 268 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 269 | self as &mut dyn (::std::any::Any) 270 | } 271 | fn into_any(self: Box) -> ::std::boxed::Box { 272 | self 273 | } 274 | 275 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 276 | Self::descriptor_static() 277 | } 278 | 279 | fn new() -> ResourceHandleProto { 280 | ResourceHandleProto::new() 281 | } 282 | 283 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 284 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; 285 | unsafe { 286 | descriptor.get(|| { 287 | let mut fields = ::std::vec::Vec::new(); 288 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( 289 | "device", 290 | |m: &ResourceHandleProto| { &m.device }, 291 | |m: &mut ResourceHandleProto| { &mut m.device }, 292 | )); 293 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( 294 | "container", 295 | |m: &ResourceHandleProto| { &m.container }, 296 | |m: &mut ResourceHandleProto| { &mut m.container }, 297 | )); 298 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( 299 | "name", 300 | |m: &ResourceHandleProto| { &m.name }, 301 | |m: &mut ResourceHandleProto| { &mut m.name }, 302 | )); 303 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeUint64>( 304 | "hash_code", 305 | |m: &ResourceHandleProto| { &m.hash_code }, 306 | |m: &mut ResourceHandleProto| { &mut m.hash_code }, 307 | )); 308 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( 309 | "maybe_type_name", 310 | |m: &ResourceHandleProto| { &m.maybe_type_name }, 311 | |m: &mut ResourceHandleProto| { &mut m.maybe_type_name }, 312 | )); 313 | ::protobuf::reflect::MessageDescriptor::new_pb_name::( 314 | "ResourceHandleProto", 315 | fields, 316 | file_descriptor_proto() 317 | ) 318 | }) 319 | } 320 | } 321 | 322 | fn default_instance() -> &'static ResourceHandleProto { 323 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; 324 | unsafe { 325 | instance.get(ResourceHandleProto::new) 326 | } 327 | } 328 | } 329 | 330 | impl ::protobuf::Clear for ResourceHandleProto { 331 | fn clear(&mut self) { 332 | self.device.clear(); 333 | self.container.clear(); 334 | self.name.clear(); 335 | self.hash_code = 0; 336 | self.maybe_type_name.clear(); 337 | self.unknown_fields.clear(); 338 | } 339 | } 340 | 341 | impl ::std::fmt::Debug for ResourceHandleProto { 342 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 343 | ::protobuf::text_format::fmt(self, f) 344 | } 345 | } 346 | 347 | impl ::protobuf::reflect::ProtobufValue for ResourceHandleProto { 348 | fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { 349 | ::protobuf::reflect::ReflectValueRef::Message(self) 350 | } 351 | } 352 | 353 | static file_descriptor_proto_data: &'static [u8] = b"\ 354 | \n-src/tensorboardrs/proto/resource_handle.proto\x12\rtensorboardrs\"\ 355 | \xa4\x01\n\x13ResourceHandleProto\x12\x16\n\x06device\x18\x01\x20\x01(\t\ 356 | R\x06device\x12\x1c\n\tcontainer\x18\x02\x20\x01(\tR\tcontainer\x12\x12\ 357 | \n\x04name\x18\x03\x20\x01(\tR\x04name\x12\x1b\n\thash_code\x18\x04\x20\ 358 | \x01(\x04R\x08hashCode\x12&\n\x0fmaybe_type_name\x18\x05\x20\x01(\tR\rma\ 359 | ybeTypeNameB/\n\x18org.tensorflow.frameworkB\x0eResourceHandleP\x01\xf8\ 360 | \x01\x01J\x8b\x07\n\x06\x12\x04\0\0\x1c\x02\n\x08\n\x01\x0c\x12\x03\0\0\ 361 | \x12\n\x08\n\x01\x02\x12\x03\x02\0\x16\n\x08\n\x01\x08\x12\x03\x03\0\x1f\ 362 | \n\t\n\x02\x08\x1f\x12\x03\x03\0\x1f\n\x08\n\x01\x08\x12\x03\x04\0/\n\t\ 363 | \n\x02\x08\x08\x12\x03\x04\0/\n\x08\n\x01\x08\x12\x03\x05\0\"\n\t\n\x02\ 364 | \x08\n\x12\x03\x05\0\"\n\x08\n\x01\x08\x12\x03\x06\01\n\t\n\x02\x08\x01\ 365 | \x12\x03\x06\01\n\xb8\x01\n\x02\x04\0\x12\x04\x0b\0\x1c\x01\x1a\xab\x01\ 366 | \x20Protocol\x20buffer\x20representing\x20a\x20handle\x20to\x20a\x20tens\ 367 | orflow\x20resource.\x20Handles\x20are\n\x20not\x20valid\x20across\x20exe\ 368 | cutions,\x20but\x20can\x20be\x20serialized\x20back\x20and\x20forth\x20fr\ 369 | om\x20within\n\x20a\x20single\x20run.\n\n\n\n\x03\x04\0\x01\x12\x03\x0b\ 370 | \x08\x1b\nB\n\x04\x04\0\x02\0\x12\x03\r\x02\x14\x1a5\x20Unique\x20name\ 371 | \x20for\x20the\x20device\x20containing\x20the\x20resource.\n\n\x0c\n\x05\ 372 | \x04\0\x02\0\x05\x12\x03\r\x02\x08\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\r\ 373 | \t\x0f\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\r\x12\x13\n:\n\x04\x04\0\x02\ 374 | \x01\x12\x03\x10\x02\x17\x1a-\x20Container\x20in\x20which\x20this\x20res\ 375 | ource\x20is\x20placed.\n\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03\x10\x02\ 376 | \x08\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x10\t\x12\n\x0c\n\x05\x04\0\ 377 | \x02\x01\x03\x12\x03\x10\x15\x16\n,\n\x04\x04\0\x02\x02\x12\x03\x13\x02\ 378 | \x12\x1a\x1f\x20Unique\x20name\x20of\x20this\x20resource.\n\n\x0c\n\x05\ 379 | \x04\0\x02\x02\x05\x12\x03\x13\x02\x08\n\x0c\n\x05\x04\0\x02\x02\x01\x12\ 380 | \x03\x13\t\r\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x13\x10\x11\ns\n\x04\ 381 | \x04\0\x02\x03\x12\x03\x17\x02\x17\x1af\x20Hash\x20code\x20for\x20the\ 382 | \x20type\x20of\x20the\x20resource.\x20Is\x20only\x20valid\x20in\x20the\ 383 | \x20same\x20device\n\x20and\x20in\x20the\x20same\x20execution.\n\n\x0c\n\ 384 | \x05\x04\0\x02\x03\x05\x12\x03\x17\x02\x08\n\x0c\n\x05\x04\0\x02\x03\x01\ 385 | \x12\x03\x17\t\x12\n\x0c\n\x05\x04\0\x02\x03\x03\x12\x03\x17\x15\x16\n]\ 386 | \n\x04\x04\0\x02\x04\x12\x03\x1b\x02\x1d\x1aP\x20For\x20debug-only,\x20t\ 387 | he\x20name\x20of\x20the\x20type\x20pointed\x20to\x20by\x20this\x20handle\ 388 | ,\x20if\n\x20available.\n\n\x0c\n\x05\x04\0\x02\x04\x05\x12\x03\x1b\x02\ 389 | \x08\n\x0c\n\x05\x04\0\x02\x04\x01\x12\x03\x1b\t\x18\n\x0c\n\x05\x04\0\ 390 | \x02\x04\x03\x12\x03\x1b\x1b\x1cb\x06proto3\ 391 | "; 392 | 393 | static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT; 394 | 395 | fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { 396 | ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() 397 | } 398 | 399 | pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { 400 | unsafe { 401 | file_descriptor_proto_lazy.get(|| { 402 | parse_descriptor_proto() 403 | }) 404 | } 405 | } 406 | -------------------------------------------------------------------------------- /src/proto/step_stats.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorboardrs; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "StepStatsProtos"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/framework"; 9 | //import "tensorflow/core/framework/allocation_description.proto"; 10 | //import "tensorflow/core/framework/tensor_description.proto"; 11 | 12 | // An allocation/de-allocation operation performed by the allocator. 13 | message AllocationRecord { 14 | // The timestamp of the operation. 15 | int64 alloc_micros = 1; 16 | // Number of bytes allocated, or de-allocated if negative. 17 | int64 alloc_bytes = 2; 18 | } 19 | 20 | message AllocatorMemoryUsed { 21 | string allocator_name = 1; 22 | // These are per-node allocator memory stats. 23 | int64 total_bytes = 2; 24 | int64 peak_bytes = 3; 25 | // The bytes that are not deallocated. 26 | int64 live_bytes = 4; 27 | // The allocation and deallocation timeline. 28 | repeated AllocationRecord allocation_records = 6; 29 | 30 | // These are snapshots of the overall allocator memory stats. 31 | // The number of live bytes currently allocated by the allocator. 32 | int64 allocator_bytes_in_use = 5; 33 | } 34 | 35 | // Output sizes recorded for a single execution of a graph node. 36 | message NodeOutput { 37 | int32 slot = 1; 38 | // TensorDescription tensor_description = 3; 39 | }; 40 | 41 | // For memory tracking. 42 | message MemoryStats { 43 | int64 temp_memory_size = 1; 44 | int64 persistent_memory_size = 3; 45 | repeated int64 persistent_tensor_alloc_ids = 5; 46 | 47 | int64 device_temp_memory_size = 2 [deprecated = true]; 48 | int64 device_persistent_memory_size = 4 [deprecated = true]; 49 | repeated int64 device_persistent_tensor_alloc_ids = 6 [deprecated = true]; 50 | } 51 | 52 | // Time/size stats recorded for a single execution of a graph node. 53 | message NodeExecStats { 54 | // TODO(tucker): Use some more compact form of node identity than 55 | // the full string name. Either all processes should agree on a 56 | // global id (cost_id?) for each node, or we should use a hash of 57 | // the name. 58 | string node_name = 1; 59 | int64 all_start_micros = 2; 60 | int64 op_start_rel_micros = 3; 61 | int64 op_end_rel_micros = 4; 62 | int64 all_end_rel_micros = 5; 63 | repeated AllocatorMemoryUsed memory = 6; 64 | repeated NodeOutput output = 7; 65 | string timeline_label = 8; 66 | int64 scheduled_micros = 9; 67 | uint32 thread_id = 10; 68 | // repeated AllocationDescription referenced_tensor = 11; 69 | MemoryStats memory_stats = 12; 70 | }; 71 | 72 | message DeviceStepStats { 73 | string device = 1; 74 | repeated NodeExecStats node_stats = 2; 75 | } 76 | 77 | message StepStats { 78 | repeated DeviceStepStats dev_stats = 1; 79 | }; 80 | 81 | 82 | // lanpa, copied from config.proto 83 | // Metadata output (i.e., non-Tensor) for a single Run() call. 84 | message RunMetadata { 85 | // Statistics traced for this step. Populated if tracing is turned on via the 86 | // "RunOptions" proto. 87 | // EXPERIMENTAL: The format and set of events may change in future versions. 88 | StepStats step_stats = 1; 89 | 90 | // The cost graph for the computation defined by the run call. 91 | // CostGraphDef cost_graph = 2; 92 | 93 | // Graphs of the partitions executed by executors. 94 | // repeated GraphDef partition_graphs = 3; 95 | } 96 | -------------------------------------------------------------------------------- /src/proto/summary.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorboardrs; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "SummaryProtos"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | 9 | import "src/tensorboardrs/proto/tensor.proto"; 10 | 11 | // Metadata associated with a series of Summary data 12 | message SummaryDescription { 13 | // Hint on how plugins should process the data in this series. 14 | // Supported values include "scalar", "histogram", "image", "audio" 15 | string type_hint = 1; 16 | } 17 | 18 | // Serialization format for histogram module in 19 | // core/lib/histogram/histogram.h 20 | message HistogramProto { 21 | double min = 1; 22 | double max = 2; 23 | double num = 3; 24 | double sum = 4; 25 | double sum_squares = 5; 26 | 27 | // Parallel arrays encoding the bucket boundaries and the bucket values. 28 | // bucket(i) is the count for the bucket i. The range for 29 | // a bucket is: 30 | // i == 0: -DBL_MAX .. bucket_limit(0) 31 | // i != 0: bucket_limit(i-1) .. bucket_limit(i) 32 | repeated double bucket_limit = 6 [packed = true]; 33 | repeated double bucket = 7 [packed = true]; 34 | }; 35 | 36 | // A SummaryMetadata encapsulates information on which plugins are able to make 37 | // use of a certain summary value. 38 | message SummaryMetadata { 39 | message PluginData { 40 | // The name of the plugin this data pertains to. 41 | string plugin_name = 1; 42 | 43 | // The content to store for the plugin. The best practice is for this to be 44 | // a binary serialized protocol buffer. 45 | bytes content = 2; 46 | } 47 | 48 | // Data that associates a summary with a certain plugin. 49 | PluginData plugin_data = 1; 50 | 51 | // Display name for viewing in TensorBoard. 52 | string display_name = 2; 53 | 54 | // Longform readable description of the summary sequence. Markdown supported. 55 | string summary_description = 3; 56 | }; 57 | 58 | // A Summary is a set of named values to be displayed by the 59 | // visualizer. 60 | // 61 | // Summaries are produced regularly during training, as controlled by 62 | // the "summary_interval_secs" attribute of the training operation. 63 | // Summaries are also produced at the end of an evaluation. 64 | message Summary { 65 | message Image { 66 | // Dimensions of the image. 67 | int32 height = 1; 68 | int32 width = 2; 69 | // Valid colorspace values are 70 | // 1 - grayscale 71 | // 2 - grayscale + alpha 72 | // 3 - RGB 73 | // 4 - RGBA 74 | // 5 - DIGITAL_YUV 75 | // 6 - BGRA 76 | int32 colorspace = 3; 77 | // Image data in encoded format. All image formats supported by 78 | // image_codec::CoderUtil can be stored here. 79 | bytes encoded_image_string = 4; 80 | } 81 | 82 | message Audio { 83 | // Sample rate of the audio in Hz. 84 | float sample_rate = 1; 85 | // Number of channels of audio. 86 | int64 num_channels = 2; 87 | // Length of the audio in frames (samples per channel). 88 | int64 length_frames = 3; 89 | // Encoded audio data and its associated RFC 2045 content type (e.g. 90 | // "audio/wav"). 91 | bytes encoded_audio_string = 4; 92 | string content_type = 5; 93 | } 94 | 95 | message Value { 96 | // This field is deprecated and will not be set. 97 | string node_name = 7; 98 | 99 | // Tag name for the data. Used by TensorBoard plugins to organize data. Tags 100 | // are often organized by scope (which contains slashes to convey 101 | // hierarchy). For example: foo/bar/0 102 | string tag = 1; 103 | 104 | // Contains metadata on the summary value such as which plugins may use it. 105 | // Take note that many summary values may lack a metadata field. This is 106 | // because the FileWriter only keeps a metadata object on the first summary 107 | // value with a certain tag for each tag. TensorBoard then remembers which 108 | // tags are associated with which plugins. This saves space. 109 | SummaryMetadata metadata = 9; 110 | 111 | // Value associated with the tag. 112 | oneof value { 113 | float simple_value = 2; 114 | bytes obsolete_old_style_histogram = 3; 115 | Image image = 4; 116 | HistogramProto histo = 5; 117 | Audio audio = 6; 118 | TensorProto tensor = 8; 119 | } 120 | } 121 | 122 | // Set of values for the summary. 123 | repeated Value value = 1; 124 | } 125 | -------------------------------------------------------------------------------- /src/proto/tensor.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorboardrs; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "TensorProtos"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | 9 | import "src/tensorboardrs/proto/resource_handle.proto"; 10 | import "src/tensorboardrs/proto/tensor_shape.proto"; 11 | import "src/tensorboardrs/proto/types.proto"; 12 | 13 | // Protocol buffer representing a tensor. 14 | message TensorProto { 15 | DataType dtype = 1; 16 | 17 | // Shape of the tensor. TODO(touts): sort out the 0-rank issues. 18 | TensorShapeProto tensor_shape = 2; 19 | 20 | // Only one of the representations below is set, one of "tensor_contents" and 21 | // the "xxx_val" attributes. We are not using oneof because as oneofs cannot 22 | // contain repeated fields it would require another extra set of messages. 23 | 24 | // Version number. 25 | // 26 | // In version 0, if the "repeated xxx" representations contain only one 27 | // element, that element is repeated to fill the shape. This makes it easy 28 | // to represent a constant Tensor with a single value. 29 | int32 version_number = 3; 30 | 31 | // Serialized raw tensor content from either Tensor::AsProtoTensorContent or 32 | // memcpy in tensorflow::grpc::EncodeTensorToByteBuffer. This representation 33 | // can be used for all tensor types. The purpose of this representation is to 34 | // reduce serialization overhead during RPC call by avoiding serialization of 35 | // many repeated small items. 36 | bytes tensor_content = 4; 37 | 38 | // Type specific representations that make it easy to create tensor protos in 39 | // all languages. Only the representation corresponding to "dtype" can 40 | // be set. The values hold the flattened representation of the tensor in 41 | // row major order. 42 | 43 | // DT_HALF. Note that since protobuf has no int16 type, we'll have some 44 | // pointless zero padding for each value here. 45 | repeated int32 half_val = 13 [packed = true]; 46 | 47 | // DT_FLOAT. 48 | repeated float float_val = 5 [packed = true]; 49 | 50 | // DT_DOUBLE. 51 | repeated double double_val = 6 [packed = true]; 52 | 53 | // DT_INT32, DT_INT16, DT_INT8, DT_UINT8. 54 | repeated int32 int_val = 7 [packed = true]; 55 | 56 | // DT_STRING 57 | repeated bytes string_val = 8; 58 | 59 | // DT_COMPLEX64. scomplex_val(2*i) and scomplex_val(2*i+1) are real 60 | // and imaginary parts of i-th single precision complex. 61 | repeated float scomplex_val = 9 [packed = true]; 62 | 63 | // DT_INT64 64 | repeated int64 int64_val = 10 [packed = true]; 65 | 66 | // DT_BOOL 67 | repeated bool bool_val = 11 [packed = true]; 68 | 69 | // DT_COMPLEX128. dcomplex_val(2*i) and dcomplex_val(2*i+1) are real 70 | // and imaginary parts of i-th double precision complex. 71 | repeated double dcomplex_val = 12 [packed = true]; 72 | 73 | // DT_RESOURCE 74 | repeated ResourceHandleProto resource_handle_val = 14; 75 | }; 76 | -------------------------------------------------------------------------------- /src/proto/tensor_shape.proto: -------------------------------------------------------------------------------- 1 | // Protocol buffer representing the shape of tensors. 2 | 3 | syntax = "proto3"; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "TensorShapeProtos"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | 9 | package tensorboardrs; 10 | 11 | // Dimensions of a tensor. 12 | message TensorShapeProto { 13 | // One dimension of the tensor. 14 | message Dim { 15 | // Size of the tensor in that dimension. 16 | // This value must be >= -1, but values of -1 are reserved for "unknown" 17 | // shapes (values of -1 mean "unknown" dimension). Certain wrappers 18 | // that work with TensorShapeProto may fail at runtime when deserializing 19 | // a TensorShapeProto containing a dim value of -1. 20 | int64 size = 1; 21 | 22 | // Optional name of the tensor dimension. 23 | string name = 2; 24 | }; 25 | 26 | // Dimensions of the tensor, such as {"input", 30}, {"output", 40} 27 | // for a 30 x 40 2D tensor. If an entry has size -1, this 28 | // corresponds to a dimension of unknown size. The names are 29 | // optional. 30 | // 31 | // The order of entries in "dim" matters: It indicates the layout of the 32 | // values in the tensor in-memory representation. 33 | // 34 | // The first entry in "dim" is the outermost dimension used to layout the 35 | // values, the last entry is the innermost dimension. This matches the 36 | // in-memory layout of RowMajor Eigen tensors. 37 | // 38 | // If "dim.size()" > 0, "unknown_rank" must be false. 39 | repeated Dim dim = 2; 40 | 41 | // If true, the number of dimensions in the shape is unknown. 42 | // 43 | // If true, "dim.size()" must be 0. 44 | bool unknown_rank = 3; 45 | }; 46 | -------------------------------------------------------------------------------- /src/proto/tensor_shape.rs: -------------------------------------------------------------------------------- 1 | // This file is generated by rust-protobuf 2.14.0. Do not edit 2 | // @generated 3 | 4 | // https://github.com/rust-lang/rust-clippy/issues/702 5 | #![allow(unknown_lints)] 6 | #![allow(clippy::all)] 7 | 8 | #![cfg_attr(rustfmt, rustfmt_skip)] 9 | 10 | #![allow(box_pointers)] 11 | #![allow(dead_code)] 12 | #![allow(missing_docs)] 13 | #![allow(non_camel_case_types)] 14 | #![allow(non_snake_case)] 15 | #![allow(non_upper_case_globals)] 16 | #![allow(trivial_casts)] 17 | #![allow(unsafe_code)] 18 | #![allow(unused_imports)] 19 | #![allow(unused_results)] 20 | //! Generated file from `src/tensorboardrs/proto/tensor_shape.proto` 21 | 22 | use protobuf::Message as Message_imported_for_functions; 23 | use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; 24 | 25 | /// Generated files are compatible only with the same version 26 | /// of protobuf runtime. 27 | // const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_14_0; 28 | 29 | #[derive(PartialEq,Clone,Default)] 30 | pub struct TensorShapeProto { 31 | // message fields 32 | pub dim: ::protobuf::RepeatedField, 33 | pub unknown_rank: bool, 34 | // special fields 35 | pub unknown_fields: ::protobuf::UnknownFields, 36 | pub cached_size: ::protobuf::CachedSize, 37 | } 38 | 39 | impl<'a> ::std::default::Default for &'a TensorShapeProto { 40 | fn default() -> &'a TensorShapeProto { 41 | ::default_instance() 42 | } 43 | } 44 | 45 | impl TensorShapeProto { 46 | pub fn new() -> TensorShapeProto { 47 | ::std::default::Default::default() 48 | } 49 | 50 | // repeated .tensorboardrs.TensorShapeProto.Dim dim = 2; 51 | 52 | 53 | pub fn get_dim(&self) -> &[TensorShapeProto_Dim] { 54 | &self.dim 55 | } 56 | pub fn clear_dim(&mut self) { 57 | self.dim.clear(); 58 | } 59 | 60 | // Param is passed by value, moved 61 | pub fn set_dim(&mut self, v: ::protobuf::RepeatedField) { 62 | self.dim = v; 63 | } 64 | 65 | // Mutable pointer to the field. 66 | pub fn mut_dim(&mut self) -> &mut ::protobuf::RepeatedField { 67 | &mut self.dim 68 | } 69 | 70 | // Take field 71 | pub fn take_dim(&mut self) -> ::protobuf::RepeatedField { 72 | ::std::mem::replace(&mut self.dim, ::protobuf::RepeatedField::new()) 73 | } 74 | 75 | // bool unknown_rank = 3; 76 | 77 | 78 | pub fn get_unknown_rank(&self) -> bool { 79 | self.unknown_rank 80 | } 81 | pub fn clear_unknown_rank(&mut self) { 82 | self.unknown_rank = false; 83 | } 84 | 85 | // Param is passed by value, moved 86 | pub fn set_unknown_rank(&mut self, v: bool) { 87 | self.unknown_rank = v; 88 | } 89 | } 90 | 91 | impl ::protobuf::Message for TensorShapeProto { 92 | fn is_initialized(&self) -> bool { 93 | for v in &self.dim { 94 | if !v.is_initialized() { 95 | return false; 96 | } 97 | }; 98 | true 99 | } 100 | 101 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 102 | while !is.eof()? { 103 | let (field_number, wire_type) = is.read_tag_unpack()?; 104 | match field_number { 105 | 2 => { 106 | ::protobuf::rt::read_repeated_message_into(wire_type, is, &mut self.dim)?; 107 | }, 108 | 3 => { 109 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 110 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 111 | } 112 | let tmp = is.read_bool()?; 113 | self.unknown_rank = tmp; 114 | }, 115 | _ => { 116 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 117 | }, 118 | }; 119 | } 120 | ::std::result::Result::Ok(()) 121 | } 122 | 123 | // Compute sizes of nested messages 124 | #[allow(unused_variables)] 125 | fn compute_size(&self) -> u32 { 126 | let mut my_size = 0; 127 | for value in &self.dim { 128 | let len = value.compute_size(); 129 | my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len; 130 | }; 131 | if self.unknown_rank != false { 132 | my_size += 2; 133 | } 134 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 135 | self.cached_size.set(my_size); 136 | my_size 137 | } 138 | 139 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 140 | for v in &self.dim { 141 | os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?; 142 | os.write_raw_varint32(v.get_cached_size())?; 143 | v.write_to_with_cached_sizes(os)?; 144 | }; 145 | if self.unknown_rank != false { 146 | os.write_bool(3, self.unknown_rank)?; 147 | } 148 | os.write_unknown_fields(self.get_unknown_fields())?; 149 | ::std::result::Result::Ok(()) 150 | } 151 | 152 | fn get_cached_size(&self) -> u32 { 153 | self.cached_size.get() 154 | } 155 | 156 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 157 | &self.unknown_fields 158 | } 159 | 160 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 161 | &mut self.unknown_fields 162 | } 163 | 164 | fn as_any(&self) -> &dyn (::std::any::Any) { 165 | self as &dyn (::std::any::Any) 166 | } 167 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 168 | self as &mut dyn (::std::any::Any) 169 | } 170 | fn into_any(self: Box) -> ::std::boxed::Box { 171 | self 172 | } 173 | 174 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 175 | Self::descriptor_static() 176 | } 177 | 178 | fn new() -> TensorShapeProto { 179 | TensorShapeProto::new() 180 | } 181 | 182 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 183 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; 184 | unsafe { 185 | descriptor.get(|| { 186 | let mut fields = ::std::vec::Vec::new(); 187 | fields.push(::protobuf::reflect::accessor::make_repeated_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage>( 188 | "dim", 189 | |m: &TensorShapeProto| { &m.dim }, 190 | |m: &mut TensorShapeProto| { &mut m.dim }, 191 | )); 192 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeBool>( 193 | "unknown_rank", 194 | |m: &TensorShapeProto| { &m.unknown_rank }, 195 | |m: &mut TensorShapeProto| { &mut m.unknown_rank }, 196 | )); 197 | ::protobuf::reflect::MessageDescriptor::new_pb_name::( 198 | "TensorShapeProto", 199 | fields, 200 | file_descriptor_proto() 201 | ) 202 | }) 203 | } 204 | } 205 | 206 | fn default_instance() -> &'static TensorShapeProto { 207 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; 208 | unsafe { 209 | instance.get(TensorShapeProto::new) 210 | } 211 | } 212 | } 213 | 214 | impl ::protobuf::Clear for TensorShapeProto { 215 | fn clear(&mut self) { 216 | self.dim.clear(); 217 | self.unknown_rank = false; 218 | self.unknown_fields.clear(); 219 | } 220 | } 221 | 222 | impl ::std::fmt::Debug for TensorShapeProto { 223 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 224 | ::protobuf::text_format::fmt(self, f) 225 | } 226 | } 227 | 228 | impl ::protobuf::reflect::ProtobufValue for TensorShapeProto { 229 | fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { 230 | ::protobuf::reflect::ReflectValueRef::Message(self) 231 | } 232 | } 233 | 234 | #[derive(PartialEq,Clone,Default)] 235 | pub struct TensorShapeProto_Dim { 236 | // message fields 237 | pub size: i64, 238 | pub name: ::std::string::String, 239 | // special fields 240 | pub unknown_fields: ::protobuf::UnknownFields, 241 | pub cached_size: ::protobuf::CachedSize, 242 | } 243 | 244 | impl<'a> ::std::default::Default for &'a TensorShapeProto_Dim { 245 | fn default() -> &'a TensorShapeProto_Dim { 246 | ::default_instance() 247 | } 248 | } 249 | 250 | impl TensorShapeProto_Dim { 251 | pub fn new() -> TensorShapeProto_Dim { 252 | ::std::default::Default::default() 253 | } 254 | 255 | // int64 size = 1; 256 | 257 | 258 | pub fn get_size(&self) -> i64 { 259 | self.size 260 | } 261 | pub fn clear_size(&mut self) { 262 | self.size = 0; 263 | } 264 | 265 | // Param is passed by value, moved 266 | pub fn set_size(&mut self, v: i64) { 267 | self.size = v; 268 | } 269 | 270 | // string name = 2; 271 | 272 | 273 | pub fn get_name(&self) -> &str { 274 | &self.name 275 | } 276 | pub fn clear_name(&mut self) { 277 | self.name.clear(); 278 | } 279 | 280 | // Param is passed by value, moved 281 | pub fn set_name(&mut self, v: ::std::string::String) { 282 | self.name = v; 283 | } 284 | 285 | // Mutable pointer to the field. 286 | // If field is not initialized, it is initialized with default value first. 287 | pub fn mut_name(&mut self) -> &mut ::std::string::String { 288 | &mut self.name 289 | } 290 | 291 | // Take field 292 | pub fn take_name(&mut self) -> ::std::string::String { 293 | ::std::mem::replace(&mut self.name, ::std::string::String::new()) 294 | } 295 | } 296 | 297 | impl ::protobuf::Message for TensorShapeProto_Dim { 298 | fn is_initialized(&self) -> bool { 299 | true 300 | } 301 | 302 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 303 | while !is.eof()? { 304 | let (field_number, wire_type) = is.read_tag_unpack()?; 305 | match field_number { 306 | 1 => { 307 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 308 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 309 | } 310 | let tmp = is.read_int64()?; 311 | self.size = tmp; 312 | }, 313 | 2 => { 314 | ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?; 315 | }, 316 | _ => { 317 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 318 | }, 319 | }; 320 | } 321 | ::std::result::Result::Ok(()) 322 | } 323 | 324 | // Compute sizes of nested messages 325 | #[allow(unused_variables)] 326 | fn compute_size(&self) -> u32 { 327 | let mut my_size = 0; 328 | if self.size != 0 { 329 | my_size += ::protobuf::rt::value_size(1, self.size, ::protobuf::wire_format::WireTypeVarint); 330 | } 331 | if !self.name.is_empty() { 332 | my_size += ::protobuf::rt::string_size(2, &self.name); 333 | } 334 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 335 | self.cached_size.set(my_size); 336 | my_size 337 | } 338 | 339 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 340 | if self.size != 0 { 341 | os.write_int64(1, self.size)?; 342 | } 343 | if !self.name.is_empty() { 344 | os.write_string(2, &self.name)?; 345 | } 346 | os.write_unknown_fields(self.get_unknown_fields())?; 347 | ::std::result::Result::Ok(()) 348 | } 349 | 350 | fn get_cached_size(&self) -> u32 { 351 | self.cached_size.get() 352 | } 353 | 354 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 355 | &self.unknown_fields 356 | } 357 | 358 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 359 | &mut self.unknown_fields 360 | } 361 | 362 | fn as_any(&self) -> &dyn (::std::any::Any) { 363 | self as &dyn (::std::any::Any) 364 | } 365 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 366 | self as &mut dyn (::std::any::Any) 367 | } 368 | fn into_any(self: Box) -> ::std::boxed::Box { 369 | self 370 | } 371 | 372 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 373 | Self::descriptor_static() 374 | } 375 | 376 | fn new() -> TensorShapeProto_Dim { 377 | TensorShapeProto_Dim::new() 378 | } 379 | 380 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 381 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; 382 | unsafe { 383 | descriptor.get(|| { 384 | let mut fields = ::std::vec::Vec::new(); 385 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt64>( 386 | "size", 387 | |m: &TensorShapeProto_Dim| { &m.size }, 388 | |m: &mut TensorShapeProto_Dim| { &mut m.size }, 389 | )); 390 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>( 391 | "name", 392 | |m: &TensorShapeProto_Dim| { &m.name }, 393 | |m: &mut TensorShapeProto_Dim| { &mut m.name }, 394 | )); 395 | ::protobuf::reflect::MessageDescriptor::new_pb_name::( 396 | "TensorShapeProto.Dim", 397 | fields, 398 | file_descriptor_proto() 399 | ) 400 | }) 401 | } 402 | } 403 | 404 | fn default_instance() -> &'static TensorShapeProto_Dim { 405 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; 406 | unsafe { 407 | instance.get(TensorShapeProto_Dim::new) 408 | } 409 | } 410 | } 411 | 412 | impl ::protobuf::Clear for TensorShapeProto_Dim { 413 | fn clear(&mut self) { 414 | self.size = 0; 415 | self.name.clear(); 416 | self.unknown_fields.clear(); 417 | } 418 | } 419 | 420 | impl ::std::fmt::Debug for TensorShapeProto_Dim { 421 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 422 | ::protobuf::text_format::fmt(self, f) 423 | } 424 | } 425 | 426 | impl ::protobuf::reflect::ProtobufValue for TensorShapeProto_Dim { 427 | fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { 428 | ::protobuf::reflect::ReflectValueRef::Message(self) 429 | } 430 | } 431 | 432 | static file_descriptor_proto_data: &'static [u8] = b"\ 433 | \n*src/tensorboardrs/proto/tensor_shape.proto\x12\rtensorboardrs\"\x9b\ 434 | \x01\n\x10TensorShapeProto\x125\n\x03dim\x18\x02\x20\x03(\x0b2#.tensorbo\ 435 | ardrs.TensorShapeProto.DimR\x03dim\x12!\n\x0cunknown_rank\x18\x03\x20\ 436 | \x01(\x08R\x0bunknownRank\x1a-\n\x03Dim\x12\x12\n\x04size\x18\x01\x20\ 437 | \x01(\x03R\x04size\x12\x12\n\x04name\x18\x02\x20\x01(\tR\x04nameB2\n\x18\ 438 | org.tensorflow.frameworkB\x11TensorShapeProtosP\x01\xf8\x01\x01J\xf6\x0b\ 439 | \n\x06\x12\x04\x02\0,\x02\n>\n\x01\x0c\x12\x03\x02\0\x1224\x20Protocol\ 440 | \x20buffer\x20representing\x20the\x20shape\x20of\x20tensors.\n\n\x08\n\ 441 | \x01\x08\x12\x03\x03\0\x1f\n\t\n\x02\x08\x1f\x12\x03\x03\0\x1f\n\x08\n\ 442 | \x01\x08\x12\x03\x04\02\n\t\n\x02\x08\x08\x12\x03\x04\02\n\x08\n\x01\x08\ 443 | \x12\x03\x05\0\"\n\t\n\x02\x08\n\x12\x03\x05\0\"\n\x08\n\x01\x08\x12\x03\ 444 | \x06\01\n\t\n\x02\x08\x01\x12\x03\x06\01\n\x08\n\x01\x02\x12\x03\x08\0\ 445 | \x16\n%\n\x02\x04\0\x12\x04\x0b\0,\x01\x1a\x19\x20Dimensions\x20of\x20a\ 446 | \x20tensor.\n\n\n\n\x03\x04\0\x01\x12\x03\x0b\x08\x18\n,\n\x04\x04\0\x03\ 447 | \0\x12\x04\r\x02\x17\x03\x1a\x1e\x20One\x20dimension\x20of\x20the\x20ten\ 448 | sor.\n\n\x0c\n\x05\x04\0\x03\0\x01\x12\x03\r\n\r\n\xbb\x02\n\x06\x04\0\ 449 | \x03\0\x02\0\x12\x03\x13\x04\x13\x1a\xab\x02\x20Size\x20of\x20the\x20ten\ 450 | sor\x20in\x20that\x20dimension.\n\x20This\x20value\x20must\x20be\x20>=\ 451 | \x20-1,\x20but\x20values\x20of\x20-1\x20are\x20reserved\x20for\x20\"unkn\ 452 | own\"\n\x20shapes\x20(values\x20of\x20-1\x20mean\x20\"unknown\"\x20dimen\ 453 | sion).\x20\x20Certain\x20wrappers\n\x20that\x20work\x20with\x20TensorSha\ 454 | peProto\x20may\x20fail\x20at\x20runtime\x20when\x20deserializing\n\x20a\ 455 | \x20TensorShapeProto\x20containing\x20a\x20dim\x20value\x20of\x20-1.\n\n\ 456 | \x0e\n\x07\x04\0\x03\0\x02\0\x05\x12\x03\x13\x04\t\n\x0e\n\x07\x04\0\x03\ 457 | \0\x02\0\x01\x12\x03\x13\n\x0e\n\x0e\n\x07\x04\0\x03\0\x02\0\x03\x12\x03\ 458 | \x13\x11\x12\n7\n\x06\x04\0\x03\0\x02\x01\x12\x03\x16\x04\x14\x1a(\x20Op\ 459 | tional\x20name\x20of\x20the\x20tensor\x20dimension.\n\n\x0e\n\x07\x04\0\ 460 | \x03\0\x02\x01\x05\x12\x03\x16\x04\n\n\x0e\n\x07\x04\0\x03\0\x02\x01\x01\ 461 | \x12\x03\x16\x0b\x0f\n\x0e\n\x07\x04\0\x03\0\x02\x01\x03\x12\x03\x16\x12\ 462 | \x13\n\xb7\x04\n\x04\x04\0\x02\0\x12\x03&\x02\x17\x1a\xa9\x04\x20Dimensi\ 463 | ons\x20of\x20the\x20tensor,\x20such\x20as\x20{\"input\",\x2030},\x20{\"o\ 464 | utput\",\x2040}\n\x20for\x20a\x2030\x20x\x2040\x202D\x20tensor.\x20\x20I\ 465 | f\x20an\x20entry\x20has\x20size\x20-1,\x20this\n\x20corresponds\x20to\ 466 | \x20a\x20dimension\x20of\x20unknown\x20size.\x20The\x20names\x20are\n\ 467 | \x20optional.\n\n\x20The\x20order\x20of\x20entries\x20in\x20\"dim\"\x20m\ 468 | atters:\x20It\x20indicates\x20the\x20layout\x20of\x20the\n\x20values\x20\ 469 | in\x20the\x20tensor\x20in-memory\x20representation.\n\n\x20The\x20first\ 470 | \x20entry\x20in\x20\"dim\"\x20is\x20the\x20outermost\x20dimension\x20use\ 471 | d\x20to\x20layout\x20the\n\x20values,\x20the\x20last\x20entry\x20is\x20t\ 472 | he\x20innermost\x20dimension.\x20\x20This\x20matches\x20the\n\x20in-memo\ 473 | ry\x20layout\x20of\x20RowMajor\x20Eigen\x20tensors.\n\n\x20If\x20\"dim.s\ 474 | ize()\"\x20>\x200,\x20\"unknown_rank\"\x20must\x20be\x20false.\n\n\x0c\n\ 475 | \x05\x04\0\x02\0\x04\x12\x03&\x02\n\n\x0c\n\x05\x04\0\x02\0\x06\x12\x03&\ 476 | \x0b\x0e\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03&\x0f\x12\n\x0c\n\x05\x04\0\ 477 | \x02\0\x03\x12\x03&\x15\x16\nl\n\x04\x04\0\x02\x01\x12\x03+\x02\x18\x1a_\ 478 | \x20If\x20true,\x20the\x20number\x20of\x20dimensions\x20in\x20the\x20sha\ 479 | pe\x20is\x20unknown.\n\n\x20If\x20true,\x20\"dim.size()\"\x20must\x20be\ 480 | \x200.\n\n\x0c\n\x05\x04\0\x02\x01\x05\x12\x03+\x02\x06\n\x0c\n\x05\x04\ 481 | \0\x02\x01\x01\x12\x03+\x07\x13\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03+\ 482 | \x16\x17b\x06proto3\ 483 | "; 484 | 485 | static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT; 486 | 487 | fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { 488 | ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() 489 | } 490 | 491 | pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { 492 | unsafe { 493 | file_descriptor_proto_lazy.get(|| { 494 | parse_descriptor_proto() 495 | }) 496 | } 497 | } 498 | -------------------------------------------------------------------------------- /src/proto/types.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorboardrs; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "TypesProtos"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | 9 | // LINT.IfChange 10 | enum DataType { 11 | // Not a legal value for DataType. Used to indicate a DataType field 12 | // has not been set. 13 | DT_INVALID = 0; 14 | 15 | // Data types that all computation devices are expected to be 16 | // capable to support. 17 | DT_FLOAT = 1; 18 | DT_DOUBLE = 2; 19 | DT_INT32 = 3; 20 | DT_UINT8 = 4; 21 | DT_INT16 = 5; 22 | DT_INT8 = 6; 23 | DT_STRING = 7; 24 | DT_COMPLEX64 = 8; // Single-precision complex 25 | DT_INT64 = 9; 26 | DT_BOOL = 10; 27 | DT_QINT8 = 11; // Quantized int8 28 | DT_QUINT8 = 12; // Quantized uint8 29 | DT_QINT32 = 13; // Quantized int32 30 | DT_BFLOAT16 = 14; // Float32 truncated to 16 bits. Only for cast ops. 31 | DT_QINT16 = 15; // Quantized int16 32 | DT_QUINT16 = 16; // Quantized uint16 33 | DT_UINT16 = 17; 34 | DT_COMPLEX128 = 18; // Double-precision complex 35 | DT_HALF = 19; 36 | DT_RESOURCE = 20; 37 | 38 | // TODO(josh11b): DT_GENERIC_PROTO = ??; 39 | // TODO(jeff,josh11b): DT_UINT64? DT_UINT32? 40 | 41 | // Do not use! These are only for parameters. Every enum above 42 | // should have a corresponding value below (verified by types_test). 43 | DT_FLOAT_REF = 101; 44 | DT_DOUBLE_REF = 102; 45 | DT_INT32_REF = 103; 46 | DT_UINT8_REF = 104; 47 | DT_INT16_REF = 105; 48 | DT_INT8_REF = 106; 49 | DT_STRING_REF = 107; 50 | DT_COMPLEX64_REF = 108; 51 | DT_INT64_REF = 109; 52 | DT_BOOL_REF = 110; 53 | DT_QINT8_REF = 111; 54 | DT_QUINT8_REF = 112; 55 | DT_QINT32_REF = 113; 56 | DT_BFLOAT16_REF = 114; 57 | DT_QINT16_REF = 115; 58 | DT_QUINT16_REF = 116; 59 | DT_UINT16_REF = 117; 60 | DT_COMPLEX128_REF = 118; 61 | DT_HALF_REF = 119; 62 | DT_RESOURCE_REF = 120; 63 | } 64 | // LINT.ThenChange(https://www.tensorflow.org/code/tensorflow/c/c_api.h,https://www.tensorflow.org/code/tensorflow/go/tensor.go) 65 | -------------------------------------------------------------------------------- /src/proto/types.rs: -------------------------------------------------------------------------------- 1 | // This file is generated by rust-protobuf 2.14.0. Do not edit 2 | // @generated 3 | 4 | // https://github.com/rust-lang/rust-clippy/issues/702 5 | #![allow(unknown_lints)] 6 | #![allow(clippy::all)] 7 | 8 | #![cfg_attr(rustfmt, rustfmt_skip)] 9 | 10 | #![allow(box_pointers)] 11 | #![allow(dead_code)] 12 | #![allow(missing_docs)] 13 | #![allow(non_camel_case_types)] 14 | #![allow(non_snake_case)] 15 | #![allow(non_upper_case_globals)] 16 | #![allow(trivial_casts)] 17 | #![allow(unsafe_code)] 18 | #![allow(unused_imports)] 19 | #![allow(unused_results)] 20 | //! Generated file from `src/tensorboardrs/proto/types.proto` 21 | 22 | use protobuf::Message as Message_imported_for_functions; 23 | use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; 24 | 25 | /// Generated files are compatible only with the same version 26 | /// of protobuf runtime. 27 | // const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_14_0; 28 | 29 | #[derive(Clone,PartialEq,Eq,Debug,Hash)] 30 | pub enum DataType { 31 | DT_INVALID = 0, 32 | DT_FLOAT = 1, 33 | DT_DOUBLE = 2, 34 | DT_INT32 = 3, 35 | DT_UINT8 = 4, 36 | DT_INT16 = 5, 37 | DT_INT8 = 6, 38 | DT_STRING = 7, 39 | DT_COMPLEX64 = 8, 40 | DT_INT64 = 9, 41 | DT_BOOL = 10, 42 | DT_QINT8 = 11, 43 | DT_QUINT8 = 12, 44 | DT_QINT32 = 13, 45 | DT_BFLOAT16 = 14, 46 | DT_QINT16 = 15, 47 | DT_QUINT16 = 16, 48 | DT_UINT16 = 17, 49 | DT_COMPLEX128 = 18, 50 | DT_HALF = 19, 51 | DT_RESOURCE = 20, 52 | DT_FLOAT_REF = 101, 53 | DT_DOUBLE_REF = 102, 54 | DT_INT32_REF = 103, 55 | DT_UINT8_REF = 104, 56 | DT_INT16_REF = 105, 57 | DT_INT8_REF = 106, 58 | DT_STRING_REF = 107, 59 | DT_COMPLEX64_REF = 108, 60 | DT_INT64_REF = 109, 61 | DT_BOOL_REF = 110, 62 | DT_QINT8_REF = 111, 63 | DT_QUINT8_REF = 112, 64 | DT_QINT32_REF = 113, 65 | DT_BFLOAT16_REF = 114, 66 | DT_QINT16_REF = 115, 67 | DT_QUINT16_REF = 116, 68 | DT_UINT16_REF = 117, 69 | DT_COMPLEX128_REF = 118, 70 | DT_HALF_REF = 119, 71 | DT_RESOURCE_REF = 120, 72 | } 73 | 74 | impl ::protobuf::ProtobufEnum for DataType { 75 | fn value(&self) -> i32 { 76 | *self as i32 77 | } 78 | 79 | fn from_i32(value: i32) -> ::std::option::Option { 80 | match value { 81 | 0 => ::std::option::Option::Some(DataType::DT_INVALID), 82 | 1 => ::std::option::Option::Some(DataType::DT_FLOAT), 83 | 2 => ::std::option::Option::Some(DataType::DT_DOUBLE), 84 | 3 => ::std::option::Option::Some(DataType::DT_INT32), 85 | 4 => ::std::option::Option::Some(DataType::DT_UINT8), 86 | 5 => ::std::option::Option::Some(DataType::DT_INT16), 87 | 6 => ::std::option::Option::Some(DataType::DT_INT8), 88 | 7 => ::std::option::Option::Some(DataType::DT_STRING), 89 | 8 => ::std::option::Option::Some(DataType::DT_COMPLEX64), 90 | 9 => ::std::option::Option::Some(DataType::DT_INT64), 91 | 10 => ::std::option::Option::Some(DataType::DT_BOOL), 92 | 11 => ::std::option::Option::Some(DataType::DT_QINT8), 93 | 12 => ::std::option::Option::Some(DataType::DT_QUINT8), 94 | 13 => ::std::option::Option::Some(DataType::DT_QINT32), 95 | 14 => ::std::option::Option::Some(DataType::DT_BFLOAT16), 96 | 15 => ::std::option::Option::Some(DataType::DT_QINT16), 97 | 16 => ::std::option::Option::Some(DataType::DT_QUINT16), 98 | 17 => ::std::option::Option::Some(DataType::DT_UINT16), 99 | 18 => ::std::option::Option::Some(DataType::DT_COMPLEX128), 100 | 19 => ::std::option::Option::Some(DataType::DT_HALF), 101 | 20 => ::std::option::Option::Some(DataType::DT_RESOURCE), 102 | 101 => ::std::option::Option::Some(DataType::DT_FLOAT_REF), 103 | 102 => ::std::option::Option::Some(DataType::DT_DOUBLE_REF), 104 | 103 => ::std::option::Option::Some(DataType::DT_INT32_REF), 105 | 104 => ::std::option::Option::Some(DataType::DT_UINT8_REF), 106 | 105 => ::std::option::Option::Some(DataType::DT_INT16_REF), 107 | 106 => ::std::option::Option::Some(DataType::DT_INT8_REF), 108 | 107 => ::std::option::Option::Some(DataType::DT_STRING_REF), 109 | 108 => ::std::option::Option::Some(DataType::DT_COMPLEX64_REF), 110 | 109 => ::std::option::Option::Some(DataType::DT_INT64_REF), 111 | 110 => ::std::option::Option::Some(DataType::DT_BOOL_REF), 112 | 111 => ::std::option::Option::Some(DataType::DT_QINT8_REF), 113 | 112 => ::std::option::Option::Some(DataType::DT_QUINT8_REF), 114 | 113 => ::std::option::Option::Some(DataType::DT_QINT32_REF), 115 | 114 => ::std::option::Option::Some(DataType::DT_BFLOAT16_REF), 116 | 115 => ::std::option::Option::Some(DataType::DT_QINT16_REF), 117 | 116 => ::std::option::Option::Some(DataType::DT_QUINT16_REF), 118 | 117 => ::std::option::Option::Some(DataType::DT_UINT16_REF), 119 | 118 => ::std::option::Option::Some(DataType::DT_COMPLEX128_REF), 120 | 119 => ::std::option::Option::Some(DataType::DT_HALF_REF), 121 | 120 => ::std::option::Option::Some(DataType::DT_RESOURCE_REF), 122 | _ => ::std::option::Option::None 123 | } 124 | } 125 | 126 | fn values() -> &'static [Self] { 127 | static values: &'static [DataType] = &[ 128 | DataType::DT_INVALID, 129 | DataType::DT_FLOAT, 130 | DataType::DT_DOUBLE, 131 | DataType::DT_INT32, 132 | DataType::DT_UINT8, 133 | DataType::DT_INT16, 134 | DataType::DT_INT8, 135 | DataType::DT_STRING, 136 | DataType::DT_COMPLEX64, 137 | DataType::DT_INT64, 138 | DataType::DT_BOOL, 139 | DataType::DT_QINT8, 140 | DataType::DT_QUINT8, 141 | DataType::DT_QINT32, 142 | DataType::DT_BFLOAT16, 143 | DataType::DT_QINT16, 144 | DataType::DT_QUINT16, 145 | DataType::DT_UINT16, 146 | DataType::DT_COMPLEX128, 147 | DataType::DT_HALF, 148 | DataType::DT_RESOURCE, 149 | DataType::DT_FLOAT_REF, 150 | DataType::DT_DOUBLE_REF, 151 | DataType::DT_INT32_REF, 152 | DataType::DT_UINT8_REF, 153 | DataType::DT_INT16_REF, 154 | DataType::DT_INT8_REF, 155 | DataType::DT_STRING_REF, 156 | DataType::DT_COMPLEX64_REF, 157 | DataType::DT_INT64_REF, 158 | DataType::DT_BOOL_REF, 159 | DataType::DT_QINT8_REF, 160 | DataType::DT_QUINT8_REF, 161 | DataType::DT_QINT32_REF, 162 | DataType::DT_BFLOAT16_REF, 163 | DataType::DT_QINT16_REF, 164 | DataType::DT_QUINT16_REF, 165 | DataType::DT_UINT16_REF, 166 | DataType::DT_COMPLEX128_REF, 167 | DataType::DT_HALF_REF, 168 | DataType::DT_RESOURCE_REF, 169 | ]; 170 | values 171 | } 172 | 173 | fn enum_descriptor_static() -> &'static ::protobuf::reflect::EnumDescriptor { 174 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::lazy::Lazy::INIT; 175 | unsafe { 176 | descriptor.get(|| { 177 | ::protobuf::reflect::EnumDescriptor::new_pb_name::("DataType", file_descriptor_proto()) 178 | }) 179 | } 180 | } 181 | } 182 | 183 | impl ::std::marker::Copy for DataType { 184 | } 185 | 186 | impl ::std::default::Default for DataType { 187 | fn default() -> Self { 188 | DataType::DT_INVALID 189 | } 190 | } 191 | 192 | impl ::protobuf::reflect::ProtobufValue for DataType { 193 | fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { 194 | ::protobuf::reflect::ReflectValueRef::Enum(self.descriptor()) 195 | } 196 | } 197 | 198 | static file_descriptor_proto_data: &'static [u8] = b"\ 199 | \n#src/tensorboardrs/proto/types.proto\x12\rtensorboardrs*\xc2\x05\n\x08\ 200 | DataType\x12\x0e\n\nDT_INVALID\x10\0\x12\x0c\n\x08DT_FLOAT\x10\x01\x12\r\ 201 | \n\tDT_DOUBLE\x10\x02\x12\x0c\n\x08DT_INT32\x10\x03\x12\x0c\n\x08DT_UINT\ 202 | 8\x10\x04\x12\x0c\n\x08DT_INT16\x10\x05\x12\x0b\n\x07DT_INT8\x10\x06\x12\ 203 | \r\n\tDT_STRING\x10\x07\x12\x10\n\x0cDT_COMPLEX64\x10\x08\x12\x0c\n\x08D\ 204 | T_INT64\x10\t\x12\x0b\n\x07DT_BOOL\x10\n\x12\x0c\n\x08DT_QINT8\x10\x0b\ 205 | \x12\r\n\tDT_QUINT8\x10\x0c\x12\r\n\tDT_QINT32\x10\r\x12\x0f\n\x0bDT_BFL\ 206 | OAT16\x10\x0e\x12\r\n\tDT_QINT16\x10\x0f\x12\x0e\n\nDT_QUINT16\x10\x10\ 207 | \x12\r\n\tDT_UINT16\x10\x11\x12\x11\n\rDT_COMPLEX128\x10\x12\x12\x0b\n\ 208 | \x07DT_HALF\x10\x13\x12\x0f\n\x0bDT_RESOURCE\x10\x14\x12\x10\n\x0cDT_FLO\ 209 | AT_REF\x10e\x12\x11\n\rDT_DOUBLE_REF\x10f\x12\x10\n\x0cDT_INT32_REF\x10g\ 210 | \x12\x10\n\x0cDT_UINT8_REF\x10h\x12\x10\n\x0cDT_INT16_REF\x10i\x12\x0f\n\ 211 | \x0bDT_INT8_REF\x10j\x12\x11\n\rDT_STRING_REF\x10k\x12\x14\n\x10DT_COMPL\ 212 | EX64_REF\x10l\x12\x10\n\x0cDT_INT64_REF\x10m\x12\x0f\n\x0bDT_BOOL_REF\ 213 | \x10n\x12\x10\n\x0cDT_QINT8_REF\x10o\x12\x11\n\rDT_QUINT8_REF\x10p\x12\ 214 | \x11\n\rDT_QINT32_REF\x10q\x12\x13\n\x0fDT_BFLOAT16_REF\x10r\x12\x11\n\r\ 215 | DT_QINT16_REF\x10s\x12\x12\n\x0eDT_QUINT16_REF\x10t\x12\x11\n\rDT_UINT16\ 216 | _REF\x10u\x12\x15\n\x11DT_COMPLEX128_REF\x10v\x12\x0f\n\x0bDT_HALF_REF\ 217 | \x10w\x12\x13\n\x0fDT_RESOURCE_REF\x10xB,\n\x18org.tensorflow.frameworkB\ 218 | \x0bTypesProtosP\x01\xf8\x01\x01J\xfd\x12\n\x06\x12\x04\0\0>\x01\n\x08\n\ 219 | \x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x02\0\x16\n\x08\n\x01\ 220 | \x08\x12\x03\x03\0\x1f\n\t\n\x02\x08\x1f\x12\x03\x03\0\x1f\n\x08\n\x01\ 221 | \x08\x12\x03\x04\0,\n\t\n\x02\x08\x08\x12\x03\x04\0,\n\x08\n\x01\x08\x12\ 222 | \x03\x05\0\"\n\t\n\x02\x08\n\x12\x03\x05\0\"\n\x08\n\x01\x08\x12\x03\x06\ 223 | \01\n\t\n\x02\x08\x01\x12\x03\x06\01\n\x1b\n\x02\x05\0\x12\x04\t\0>\x01\ 224 | \x1a\x0f\x20LINT.IfChange\n\n\n\n\x03\x05\0\x01\x12\x03\t\x05\r\nd\n\x04\ 225 | \x05\0\x02\0\x12\x03\x0c\x02\x11\x1aW\x20Not\x20a\x20legal\x20value\x20f\ 226 | or\x20DataType.\x20\x20Used\x20to\x20indicate\x20a\x20DataType\x20field\ 227 | \n\x20has\x20not\x20been\x20set.\n\n\x0c\n\x05\x05\0\x02\0\x01\x12\x03\ 228 | \x0c\x02\x0c\n\x0c\n\x05\x05\0\x02\0\x02\x12\x03\x0c\x0f\x10\n^\n\x04\ 229 | \x05\0\x02\x01\x12\x03\x10\x02\x0f\x1aQ\x20Data\x20types\x20that\x20all\ 230 | \x20computation\x20devices\x20are\x20expected\x20to\x20be\n\x20capable\ 231 | \x20to\x20support.\n\n\x0c\n\x05\x05\0\x02\x01\x01\x12\x03\x10\x02\n\n\ 232 | \x0c\n\x05\x05\0\x02\x01\x02\x12\x03\x10\r\x0e\n\x0b\n\x04\x05\0\x02\x02\ 233 | \x12\x03\x11\x02\x10\n\x0c\n\x05\x05\0\x02\x02\x01\x12\x03\x11\x02\x0b\n\ 234 | \x0c\n\x05\x05\0\x02\x02\x02\x12\x03\x11\x0e\x0f\n\x0b\n\x04\x05\0\x02\ 235 | \x03\x12\x03\x12\x02\x0f\n\x0c\n\x05\x05\0\x02\x03\x01\x12\x03\x12\x02\n\ 236 | \n\x0c\n\x05\x05\0\x02\x03\x02\x12\x03\x12\r\x0e\n\x0b\n\x04\x05\0\x02\ 237 | \x04\x12\x03\x13\x02\x0f\n\x0c\n\x05\x05\0\x02\x04\x01\x12\x03\x13\x02\n\ 238 | \n\x0c\n\x05\x05\0\x02\x04\x02\x12\x03\x13\r\x0e\n\x0b\n\x04\x05\0\x02\ 239 | \x05\x12\x03\x14\x02\x0f\n\x0c\n\x05\x05\0\x02\x05\x01\x12\x03\x14\x02\n\ 240 | \n\x0c\n\x05\x05\0\x02\x05\x02\x12\x03\x14\r\x0e\n\x0b\n\x04\x05\0\x02\ 241 | \x06\x12\x03\x15\x02\x0e\n\x0c\n\x05\x05\0\x02\x06\x01\x12\x03\x15\x02\t\ 242 | \n\x0c\n\x05\x05\0\x02\x06\x02\x12\x03\x15\x0c\r\n\x0b\n\x04\x05\0\x02\ 243 | \x07\x12\x03\x16\x02\x10\n\x0c\n\x05\x05\0\x02\x07\x01\x12\x03\x16\x02\ 244 | \x0b\n\x0c\n\x05\x05\0\x02\x07\x02\x12\x03\x16\x0e\x0f\n'\n\x04\x05\0\ 245 | \x02\x08\x12\x03\x17\x02\x13\"\x1a\x20Single-precision\x20complex\n\n\ 246 | \x0c\n\x05\x05\0\x02\x08\x01\x12\x03\x17\x02\x0e\n\x0c\n\x05\x05\0\x02\ 247 | \x08\x02\x12\x03\x17\x11\x12\n\x0b\n\x04\x05\0\x02\t\x12\x03\x18\x02\x0f\ 248 | \n\x0c\n\x05\x05\0\x02\t\x01\x12\x03\x18\x02\n\n\x0c\n\x05\x05\0\x02\t\ 249 | \x02\x12\x03\x18\r\x0e\n\x0b\n\x04\x05\0\x02\n\x12\x03\x19\x02\x0f\n\x0c\ 250 | \n\x05\x05\0\x02\n\x01\x12\x03\x19\x02\t\n\x0c\n\x05\x05\0\x02\n\x02\x12\ 251 | \x03\x19\x0c\x0e\n\x1d\n\x04\x05\0\x02\x0b\x12\x03\x1a\x02\x10\"\x10\x20\ 252 | Quantized\x20int8\n\n\x0c\n\x05\x05\0\x02\x0b\x01\x12\x03\x1a\x02\n\n\ 253 | \x0c\n\x05\x05\0\x02\x0b\x02\x12\x03\x1a\r\x0f\n\x1e\n\x04\x05\0\x02\x0c\ 254 | \x12\x03\x1b\x02\x11\"\x11\x20Quantized\x20uint8\n\n\x0c\n\x05\x05\0\x02\ 255 | \x0c\x01\x12\x03\x1b\x02\x0b\n\x0c\n\x05\x05\0\x02\x0c\x02\x12\x03\x1b\ 256 | \x0e\x10\n\x1e\n\x04\x05\0\x02\r\x12\x03\x1c\x02\x11\"\x11\x20Quantized\ 257 | \x20int32\n\n\x0c\n\x05\x05\0\x02\r\x01\x12\x03\x1c\x02\x0b\n\x0c\n\x05\ 258 | \x05\0\x02\r\x02\x12\x03\x1c\x0e\x10\n@\n\x04\x05\0\x02\x0e\x12\x03\x1d\ 259 | \x02\x13\"3\x20Float32\x20truncated\x20to\x2016\x20bits.\x20\x20Only\x20\ 260 | for\x20cast\x20ops.\n\n\x0c\n\x05\x05\0\x02\x0e\x01\x12\x03\x1d\x02\r\n\ 261 | \x0c\n\x05\x05\0\x02\x0e\x02\x12\x03\x1d\x10\x12\n\x1e\n\x04\x05\0\x02\ 262 | \x0f\x12\x03\x1e\x02\x11\"\x11\x20Quantized\x20int16\n\n\x0c\n\x05\x05\0\ 263 | \x02\x0f\x01\x12\x03\x1e\x02\x0b\n\x0c\n\x05\x05\0\x02\x0f\x02\x12\x03\ 264 | \x1e\x0e\x10\n\x1f\n\x04\x05\0\x02\x10\x12\x03\x1f\x02\x12\"\x12\x20Quan\ 265 | tized\x20uint16\n\n\x0c\n\x05\x05\0\x02\x10\x01\x12\x03\x1f\x02\x0c\n\ 266 | \x0c\n\x05\x05\0\x02\x10\x02\x12\x03\x1f\x0f\x11\n\x0b\n\x04\x05\0\x02\ 267 | \x11\x12\x03\x20\x02\x11\n\x0c\n\x05\x05\0\x02\x11\x01\x12\x03\x20\x02\ 268 | \x0b\n\x0c\n\x05\x05\0\x02\x11\x02\x12\x03\x20\x0e\x10\n'\n\x04\x05\0\ 269 | \x02\x12\x12\x03!\x02\x15\"\x1a\x20Double-precision\x20complex\n\n\x0c\n\ 270 | \x05\x05\0\x02\x12\x01\x12\x03!\x02\x0f\n\x0c\n\x05\x05\0\x02\x12\x02\ 271 | \x12\x03!\x12\x14\n\x0b\n\x04\x05\0\x02\x13\x12\x03\"\x02\x0f\n\x0c\n\ 272 | \x05\x05\0\x02\x13\x01\x12\x03\"\x02\t\n\x0c\n\x05\x05\0\x02\x13\x02\x12\ 273 | \x03\"\x0c\x0e\n\x0b\n\x04\x05\0\x02\x14\x12\x03#\x02\x13\n\x0c\n\x05\ 274 | \x05\0\x02\x14\x01\x12\x03#\x02\r\n\x0c\n\x05\x05\0\x02\x14\x02\x12\x03#\ 275 | \x10\x12\n\xe5\x01\n\x04\x05\0\x02\x15\x12\x03*\x02\x15\x1a\x82\x01\x20D\ 276 | o\x20not\x20use!\x20\x20These\x20are\x20only\x20for\x20parameters.\x20\ 277 | \x20Every\x20enum\x20above\n\x20should\x20have\x20a\x20corresponding\x20\ 278 | value\x20below\x20(verified\x20by\x20types_test).\n2S\x20TODO(josh11b):\ 279 | \x20DT_GENERIC_PROTO\x20=\x20??;\n\x20TODO(jeff,josh11b):\x20DT_UINT64?\ 280 | \x20\x20DT_UINT32?\n\n\x0c\n\x05\x05\0\x02\x15\x01\x12\x03*\x02\x0e\n\ 281 | \x0c\n\x05\x05\0\x02\x15\x02\x12\x03*\x11\x14\n\x0b\n\x04\x05\0\x02\x16\ 282 | \x12\x03+\x02\x16\n\x0c\n\x05\x05\0\x02\x16\x01\x12\x03+\x02\x0f\n\x0c\n\ 283 | \x05\x05\0\x02\x16\x02\x12\x03+\x12\x15\n\x0b\n\x04\x05\0\x02\x17\x12\ 284 | \x03,\x02\x15\n\x0c\n\x05\x05\0\x02\x17\x01\x12\x03,\x02\x0e\n\x0c\n\x05\ 285 | \x05\0\x02\x17\x02\x12\x03,\x11\x14\n\x0b\n\x04\x05\0\x02\x18\x12\x03-\ 286 | \x02\x15\n\x0c\n\x05\x05\0\x02\x18\x01\x12\x03-\x02\x0e\n\x0c\n\x05\x05\ 287 | \0\x02\x18\x02\x12\x03-\x11\x14\n\x0b\n\x04\x05\0\x02\x19\x12\x03.\x02\ 288 | \x15\n\x0c\n\x05\x05\0\x02\x19\x01\x12\x03.\x02\x0e\n\x0c\n\x05\x05\0\ 289 | \x02\x19\x02\x12\x03.\x11\x14\n\x0b\n\x04\x05\0\x02\x1a\x12\x03/\x02\x14\ 290 | \n\x0c\n\x05\x05\0\x02\x1a\x01\x12\x03/\x02\r\n\x0c\n\x05\x05\0\x02\x1a\ 291 | \x02\x12\x03/\x10\x13\n\x0b\n\x04\x05\0\x02\x1b\x12\x030\x02\x16\n\x0c\n\ 292 | \x05\x05\0\x02\x1b\x01\x12\x030\x02\x0f\n\x0c\n\x05\x05\0\x02\x1b\x02\ 293 | \x12\x030\x12\x15\n\x0b\n\x04\x05\0\x02\x1c\x12\x031\x02\x19\n\x0c\n\x05\ 294 | \x05\0\x02\x1c\x01\x12\x031\x02\x12\n\x0c\n\x05\x05\0\x02\x1c\x02\x12\ 295 | \x031\x15\x18\n\x0b\n\x04\x05\0\x02\x1d\x12\x032\x02\x15\n\x0c\n\x05\x05\ 296 | \0\x02\x1d\x01\x12\x032\x02\x0e\n\x0c\n\x05\x05\0\x02\x1d\x02\x12\x032\ 297 | \x11\x14\n\x0b\n\x04\x05\0\x02\x1e\x12\x033\x02\x14\n\x0c\n\x05\x05\0\ 298 | \x02\x1e\x01\x12\x033\x02\r\n\x0c\n\x05\x05\0\x02\x1e\x02\x12\x033\x10\ 299 | \x13\n\x0b\n\x04\x05\0\x02\x1f\x12\x034\x02\x15\n\x0c\n\x05\x05\0\x02\ 300 | \x1f\x01\x12\x034\x02\x0e\n\x0c\n\x05\x05\0\x02\x1f\x02\x12\x034\x11\x14\ 301 | \n\x0b\n\x04\x05\0\x02\x20\x12\x035\x02\x16\n\x0c\n\x05\x05\0\x02\x20\ 302 | \x01\x12\x035\x02\x0f\n\x0c\n\x05\x05\0\x02\x20\x02\x12\x035\x12\x15\n\ 303 | \x0b\n\x04\x05\0\x02!\x12\x036\x02\x16\n\x0c\n\x05\x05\0\x02!\x01\x12\ 304 | \x036\x02\x0f\n\x0c\n\x05\x05\0\x02!\x02\x12\x036\x12\x15\n\x0b\n\x04\ 305 | \x05\0\x02\"\x12\x037\x02\x18\n\x0c\n\x05\x05\0\x02\"\x01\x12\x037\x02\ 306 | \x11\n\x0c\n\x05\x05\0\x02\"\x02\x12\x037\x14\x17\n\x0b\n\x04\x05\0\x02#\ 307 | \x12\x038\x02\x16\n\x0c\n\x05\x05\0\x02#\x01\x12\x038\x02\x0f\n\x0c\n\ 308 | \x05\x05\0\x02#\x02\x12\x038\x12\x15\n\x0b\n\x04\x05\0\x02$\x12\x039\x02\ 309 | \x17\n\x0c\n\x05\x05\0\x02$\x01\x12\x039\x02\x10\n\x0c\n\x05\x05\0\x02$\ 310 | \x02\x12\x039\x13\x16\n\x0b\n\x04\x05\0\x02%\x12\x03:\x02\x16\n\x0c\n\ 311 | \x05\x05\0\x02%\x01\x12\x03:\x02\x0f\n\x0c\n\x05\x05\0\x02%\x02\x12\x03:\ 312 | \x12\x15\n\x0b\n\x04\x05\0\x02&\x12\x03;\x02\x1a\n\x0c\n\x05\x05\0\x02&\ 313 | \x01\x12\x03;\x02\x13\n\x0c\n\x05\x05\0\x02&\x02\x12\x03;\x16\x19\n\x0b\ 314 | \n\x04\x05\0\x02'\x12\x03<\x02\x14\n\x0c\n\x05\x05\0\x02'\x01\x12\x03<\ 315 | \x02\r\n\x0c\n\x05\x05\0\x02'\x02\x12\x03<\x10\x13\n\x0b\n\x04\x05\0\x02\ 316 | (\x12\x03=\x02\x18\n\x0c\n\x05\x05\0\x02(\x01\x12\x03=\x02\x11\n\x0c\n\ 317 | \x05\x05\0\x02(\x02\x12\x03=\x14\x17b\x06proto3\ 318 | "; 319 | 320 | static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT; 321 | 322 | fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { 323 | ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() 324 | } 325 | 326 | pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { 327 | unsafe { 328 | file_descriptor_proto_lazy.get(|| { 329 | parse_descriptor_proto() 330 | }) 331 | } 332 | } 333 | -------------------------------------------------------------------------------- /src/proto/update.sh: -------------------------------------------------------------------------------- 1 | set -e 2 | 3 | #if [ $# -ne 1 ]; then 4 | # echo "usage: $0 " >&2 5 | # exit 1 6 | #fi 7 | # 8 | #rsync --existing "$1"/tensorflow/core/framework/*.proto tensorboard/compat/proto/ 9 | #rsync --existing "$1"/tensorflow/core/protobuf/*.proto tensorboard/compat/proto/ 10 | #rsync --existing "$1"/tensorflow/core/profiler/*.proto tensorboard/compat/proto/ 11 | #rsync --existing "$1"/tensorflow/core/util/*.proto tensorboard/compat/proto/ 12 | #rsync --existing "$1"/tensorflow/python/framework/*.proto tensorboard/compat/proto/ 13 | # 14 | ## Rewrite file paths and package names. 15 | #find tensorboard/compat/proto/ -type f -name '*.proto' -exec perl -pi \ 16 | # -e 's|tensorflow/core/framework|tensorboard/compat/proto|g;' \ 17 | # -e 's|tensorflow/core/protobuf|tensorboard/compat/proto|g;' \ 18 | # -e 's|tensorflow/core/profiler|tensorboard/compat/proto|g;' \ 19 | # -e 's|tensorflow/core/util|tensorboard/compat/proto|g;' \ 20 | # -e 's|tensorflow/python/framework|tensorboard/compat/proto|g;' \ 21 | # -e 's|package tensorflow.tfprof;|package tensorboard;|g;' \ 22 | # -e 's|package tensorflow;|package tensorboard;|g;' \ 23 | # -e 's|tensorflow\.DataType|tensorboard.DataType|g;' \ 24 | # -e 's|tensorflow\.TensorShapeProto|tensorboard.TensorShapeProto|g;' \ 25 | # {} + 26 | # 27 | #echo "Protos in tensorboard/compat/proto/ updated! You can now add and commit them." 28 | 29 | find src/tensorboardrs/proto/ -type f -name '*.proto' -exec perl -pi \ 30 | -e 's|package tensorboardX;|package tensorboardrs;|g;' \ 31 | -e 's|tensorboardX/proto/|src/tensorboardrs/proto/|g;' \ 32 | -e 's|package tensorboardX.|package tensorboardrs.|g;' \ 33 | {} + 34 | -------------------------------------------------------------------------------- /src/proto/versions.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package tensorboardrs; 4 | option cc_enable_arenas = true; 5 | option java_outer_classname = "VersionsProtos"; 6 | option java_multiple_files = true; 7 | option java_package = "org.tensorflow.framework"; 8 | 9 | // Version information for a piece of serialized data 10 | // 11 | // There are different types of versions for each type of data 12 | // (GraphDef, etc.), but they all have the same common shape 13 | // described here. 14 | // 15 | // Each consumer has "consumer" and "min_producer" versions (specified 16 | // elsewhere). A consumer is allowed to consume this data if 17 | // 18 | // producer >= min_producer 19 | // consumer >= min_consumer 20 | // consumer not in bad_consumers 21 | // 22 | message VersionDef { 23 | // The version of the code that produced this data. 24 | int32 producer = 1; 25 | 26 | // Any consumer below this version is not allowed to consume this data. 27 | int32 min_consumer = 2; 28 | 29 | // Specific consumer versions which are disallowed (e.g. due to bugs). 30 | repeated int32 bad_consumers = 3; 31 | }; 32 | -------------------------------------------------------------------------------- /src/proto/versions.rs: -------------------------------------------------------------------------------- 1 | // This file is generated by rust-protobuf 2.14.0. Do not edit 2 | // @generated 3 | 4 | // https://github.com/rust-lang/rust-clippy/issues/702 5 | #![allow(unknown_lints)] 6 | #![allow(clippy::all)] 7 | 8 | #![cfg_attr(rustfmt, rustfmt_skip)] 9 | 10 | #![allow(box_pointers)] 11 | #![allow(dead_code)] 12 | #![allow(missing_docs)] 13 | #![allow(non_camel_case_types)] 14 | #![allow(non_snake_case)] 15 | #![allow(non_upper_case_globals)] 16 | #![allow(trivial_casts)] 17 | #![allow(unsafe_code)] 18 | #![allow(unused_imports)] 19 | #![allow(unused_results)] 20 | //! Generated file from `src/tensorboardrs/proto/versions.proto` 21 | 22 | use protobuf::Message as Message_imported_for_functions; 23 | use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions; 24 | 25 | /// Generated files are compatible only with the same version 26 | /// of protobuf runtime. 27 | // const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_2_14_0; 28 | 29 | #[derive(PartialEq,Clone,Default)] 30 | pub struct VersionDef { 31 | // message fields 32 | pub producer: i32, 33 | pub min_consumer: i32, 34 | pub bad_consumers: ::std::vec::Vec, 35 | // special fields 36 | pub unknown_fields: ::protobuf::UnknownFields, 37 | pub cached_size: ::protobuf::CachedSize, 38 | } 39 | 40 | impl<'a> ::std::default::Default for &'a VersionDef { 41 | fn default() -> &'a VersionDef { 42 | ::default_instance() 43 | } 44 | } 45 | 46 | impl VersionDef { 47 | pub fn new() -> VersionDef { 48 | ::std::default::Default::default() 49 | } 50 | 51 | // int32 producer = 1; 52 | 53 | 54 | pub fn get_producer(&self) -> i32 { 55 | self.producer 56 | } 57 | pub fn clear_producer(&mut self) { 58 | self.producer = 0; 59 | } 60 | 61 | // Param is passed by value, moved 62 | pub fn set_producer(&mut self, v: i32) { 63 | self.producer = v; 64 | } 65 | 66 | // int32 min_consumer = 2; 67 | 68 | 69 | pub fn get_min_consumer(&self) -> i32 { 70 | self.min_consumer 71 | } 72 | pub fn clear_min_consumer(&mut self) { 73 | self.min_consumer = 0; 74 | } 75 | 76 | // Param is passed by value, moved 77 | pub fn set_min_consumer(&mut self, v: i32) { 78 | self.min_consumer = v; 79 | } 80 | 81 | // repeated int32 bad_consumers = 3; 82 | 83 | 84 | pub fn get_bad_consumers(&self) -> &[i32] { 85 | &self.bad_consumers 86 | } 87 | pub fn clear_bad_consumers(&mut self) { 88 | self.bad_consumers.clear(); 89 | } 90 | 91 | // Param is passed by value, moved 92 | pub fn set_bad_consumers(&mut self, v: ::std::vec::Vec) { 93 | self.bad_consumers = v; 94 | } 95 | 96 | // Mutable pointer to the field. 97 | pub fn mut_bad_consumers(&mut self) -> &mut ::std::vec::Vec { 98 | &mut self.bad_consumers 99 | } 100 | 101 | // Take field 102 | pub fn take_bad_consumers(&mut self) -> ::std::vec::Vec { 103 | ::std::mem::replace(&mut self.bad_consumers, ::std::vec::Vec::new()) 104 | } 105 | } 106 | 107 | impl ::protobuf::Message for VersionDef { 108 | fn is_initialized(&self) -> bool { 109 | true 110 | } 111 | 112 | fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> { 113 | while !is.eof()? { 114 | let (field_number, wire_type) = is.read_tag_unpack()?; 115 | match field_number { 116 | 1 => { 117 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 118 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 119 | } 120 | let tmp = is.read_int32()?; 121 | self.producer = tmp; 122 | }, 123 | 2 => { 124 | if wire_type != ::protobuf::wire_format::WireTypeVarint { 125 | return ::std::result::Result::Err(::protobuf::rt::unexpected_wire_type(wire_type)); 126 | } 127 | let tmp = is.read_int32()?; 128 | self.min_consumer = tmp; 129 | }, 130 | 3 => { 131 | ::protobuf::rt::read_repeated_int32_into(wire_type, is, &mut self.bad_consumers)?; 132 | }, 133 | _ => { 134 | ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?; 135 | }, 136 | }; 137 | } 138 | ::std::result::Result::Ok(()) 139 | } 140 | 141 | // Compute sizes of nested messages 142 | #[allow(unused_variables)] 143 | fn compute_size(&self) -> u32 { 144 | let mut my_size = 0; 145 | if self.producer != 0 { 146 | my_size += ::protobuf::rt::value_size(1, self.producer, ::protobuf::wire_format::WireTypeVarint); 147 | } 148 | if self.min_consumer != 0 { 149 | my_size += ::protobuf::rt::value_size(2, self.min_consumer, ::protobuf::wire_format::WireTypeVarint); 150 | } 151 | for value in &self.bad_consumers { 152 | my_size += ::protobuf::rt::value_size(3, *value, ::protobuf::wire_format::WireTypeVarint); 153 | }; 154 | my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields()); 155 | self.cached_size.set(my_size); 156 | my_size 157 | } 158 | 159 | fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> { 160 | if self.producer != 0 { 161 | os.write_int32(1, self.producer)?; 162 | } 163 | if self.min_consumer != 0 { 164 | os.write_int32(2, self.min_consumer)?; 165 | } 166 | for v in &self.bad_consumers { 167 | os.write_int32(3, *v)?; 168 | }; 169 | os.write_unknown_fields(self.get_unknown_fields())?; 170 | ::std::result::Result::Ok(()) 171 | } 172 | 173 | fn get_cached_size(&self) -> u32 { 174 | self.cached_size.get() 175 | } 176 | 177 | fn get_unknown_fields(&self) -> &::protobuf::UnknownFields { 178 | &self.unknown_fields 179 | } 180 | 181 | fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields { 182 | &mut self.unknown_fields 183 | } 184 | 185 | fn as_any(&self) -> &dyn (::std::any::Any) { 186 | self as &dyn (::std::any::Any) 187 | } 188 | fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) { 189 | self as &mut dyn (::std::any::Any) 190 | } 191 | fn into_any(self: Box) -> ::std::boxed::Box { 192 | self 193 | } 194 | 195 | fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor { 196 | Self::descriptor_static() 197 | } 198 | 199 | fn new() -> VersionDef { 200 | VersionDef::new() 201 | } 202 | 203 | fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor { 204 | static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT; 205 | unsafe { 206 | descriptor.get(|| { 207 | let mut fields = ::std::vec::Vec::new(); 208 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( 209 | "producer", 210 | |m: &VersionDef| { &m.producer }, 211 | |m: &mut VersionDef| { &mut m.producer }, 212 | )); 213 | fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( 214 | "min_consumer", 215 | |m: &VersionDef| { &m.min_consumer }, 216 | |m: &mut VersionDef| { &mut m.min_consumer }, 217 | )); 218 | fields.push(::protobuf::reflect::accessor::make_vec_accessor::<_, ::protobuf::types::ProtobufTypeInt32>( 219 | "bad_consumers", 220 | |m: &VersionDef| { &m.bad_consumers }, 221 | |m: &mut VersionDef| { &mut m.bad_consumers }, 222 | )); 223 | ::protobuf::reflect::MessageDescriptor::new_pb_name::( 224 | "VersionDef", 225 | fields, 226 | file_descriptor_proto() 227 | ) 228 | }) 229 | } 230 | } 231 | 232 | fn default_instance() -> &'static VersionDef { 233 | static mut instance: ::protobuf::lazy::Lazy = ::protobuf::lazy::Lazy::INIT; 234 | unsafe { 235 | instance.get(VersionDef::new) 236 | } 237 | } 238 | } 239 | 240 | impl ::protobuf::Clear for VersionDef { 241 | fn clear(&mut self) { 242 | self.producer = 0; 243 | self.min_consumer = 0; 244 | self.bad_consumers.clear(); 245 | self.unknown_fields.clear(); 246 | } 247 | } 248 | 249 | impl ::std::fmt::Debug for VersionDef { 250 | fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 251 | ::protobuf::text_format::fmt(self, f) 252 | } 253 | } 254 | 255 | impl ::protobuf::reflect::ProtobufValue for VersionDef { 256 | fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef { 257 | ::protobuf::reflect::ReflectValueRef::Message(self) 258 | } 259 | } 260 | 261 | static file_descriptor_proto_data: &'static [u8] = b"\ 262 | \n&src/tensorboardrs/proto/versions.proto\x12\rtensorboardrs\"p\n\nVersi\ 263 | onDef\x12\x1a\n\x08producer\x18\x01\x20\x01(\x05R\x08producer\x12!\n\x0c\ 264 | min_consumer\x18\x02\x20\x01(\x05R\x0bminConsumer\x12#\n\rbad_consumers\ 265 | \x18\x03\x20\x03(\x05R\x0cbadConsumersB/\n\x18org.tensorflow.frameworkB\ 266 | \x0eVersionsProtosP\x01\xf8\x01\x01J\x9d\x07\n\x06\x12\x04\0\0\x1e\x02\n\ 267 | \x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x02\0\x16\n\x08\n\ 268 | \x01\x08\x12\x03\x03\0\x1f\n\t\n\x02\x08\x1f\x12\x03\x03\0\x1f\n\x08\n\ 269 | \x01\x08\x12\x03\x04\0/\n\t\n\x02\x08\x08\x12\x03\x04\0/\n\x08\n\x01\x08\ 270 | \x12\x03\x05\0\"\n\t\n\x02\x08\n\x12\x03\x05\0\"\n\x08\n\x01\x08\x12\x03\ 271 | \x06\01\n\t\n\x02\x08\x01\x12\x03\x06\01\n\xa8\x03\n\x02\x04\0\x12\x04\ 272 | \x15\0\x1e\x01\x1a\x9b\x03\x20Version\x20information\x20for\x20a\x20piec\ 273 | e\x20of\x20serialized\x20data\n\n\x20There\x20are\x20different\x20types\ 274 | \x20of\x20versions\x20for\x20each\x20type\x20of\x20data\n\x20(GraphDef,\ 275 | \x20etc.),\x20but\x20they\x20all\x20have\x20the\x20same\x20common\x20sha\ 276 | pe\n\x20described\x20here.\n\n\x20Each\x20consumer\x20has\x20\"consumer\ 277 | \"\x20and\x20\"min_producer\"\x20versions\x20(specified\n\x20elsewhere).\ 278 | \x20\x20A\x20consumer\x20is\x20allowed\x20to\x20consume\x20this\x20data\ 279 | \x20if\n\n\x20\x20\x20producer\x20>=\x20min_producer\n\x20\x20\x20consum\ 280 | er\x20>=\x20min_consumer\n\x20\x20\x20consumer\x20not\x20in\x20bad_consu\ 281 | mers\n\n\n\n\n\x03\x04\0\x01\x12\x03\x15\x08\x12\n?\n\x04\x04\0\x02\0\ 282 | \x12\x03\x17\x02\x15\x1a2\x20The\x20version\x20of\x20the\x20code\x20that\ 283 | \x20produced\x20this\x20data.\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x17\ 284 | \x02\x07\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x17\x08\x10\n\x0c\n\x05\x04\ 285 | \0\x02\0\x03\x12\x03\x17\x13\x14\nS\n\x04\x04\0\x02\x01\x12\x03\x1a\x02\ 286 | \x19\x1aF\x20Any\x20consumer\x20below\x20this\x20version\x20is\x20not\ 287 | \x20allowed\x20to\x20consume\x20this\x20data.\n\n\x0c\n\x05\x04\0\x02\ 288 | \x01\x05\x12\x03\x1a\x02\x07\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x1a\ 289 | \x08\x14\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x1a\x17\x18\nR\n\x04\x04\ 290 | \0\x02\x02\x12\x03\x1d\x02#\x1aE\x20Specific\x20consumer\x20versions\x20\ 291 | which\x20are\x20disallowed\x20(e.g.\x20due\x20to\x20bugs).\n\n\x0c\n\x05\ 292 | \x04\0\x02\x02\x04\x12\x03\x1d\x02\n\n\x0c\n\x05\x04\0\x02\x02\x05\x12\ 293 | \x03\x1d\x0b\x10\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\x1d\x11\x1e\n\x0c\ 294 | \n\x05\x04\0\x02\x02\x03\x12\x03\x1d!\"b\x06proto3\ 295 | "; 296 | 297 | static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT; 298 | 299 | fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto { 300 | ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap() 301 | } 302 | 303 | pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { 304 | unsafe { 305 | file_descriptor_proto_lazy.get(|| { 306 | parse_descriptor_proto() 307 | }) 308 | } 309 | } 310 | -------------------------------------------------------------------------------- /src/record_writer.rs: -------------------------------------------------------------------------------- 1 | use crate::masked_crc32c::masked_crc32c; 2 | use std::io::Write; 3 | 4 | pub struct RecordWriter { 5 | _writer: W, 6 | } 7 | impl RecordWriter { 8 | pub fn new(writer: W) -> RecordWriter where W: Write{ 9 | RecordWriter { 10 | _writer: writer, 11 | } 12 | } 13 | pub fn write(&mut self, data: &[u8]) -> std::io::Result<()>{ 14 | let header = data.len() as u64; 15 | let header_crc = (masked_crc32c(&(header.to_le_bytes())) as u32).to_le_bytes(); 16 | let footer_crc = (masked_crc32c(&data) as u32).to_le_bytes(); 17 | let header = header.to_le_bytes(); 18 | 19 | self._writer.write_all(&header)?; 20 | self._writer.write_all(&header_crc)?; 21 | self._writer.write_all(&data)?; 22 | self._writer.write_all(&footer_crc) 23 | } 24 | pub fn flush(&mut self) -> std::io::Result<()> { 25 | self._writer.flush() 26 | } 27 | //pub fn close() {} 28 | //pub fn closed() {} 29 | } 30 | -------------------------------------------------------------------------------- /src/summary.rs: -------------------------------------------------------------------------------- 1 | use crate::proto::summary::{Summary, Summary_Value, Summary_Image, SummaryMetadata, SummaryMetadata_PluginData, HistogramProto}; 2 | use crate::proto::layout::{Layout, Category}; 3 | use protobuf::RepeatedField; 4 | 5 | use image::{RgbImage, DynamicImage, ImageOutputFormat}; 6 | use std::io::Write; 7 | 8 | pub fn scalar(name: &str, scalar_value: f32) -> Summary { 9 | 10 | let mut value = Summary_Value::new(); 11 | value.set_tag(name.to_string()); 12 | value.set_simple_value(scalar_value); 13 | 14 | let values = RepeatedField::from(vec![value]); 15 | let mut summary = Summary::new(); 16 | summary.set_value(values); 17 | 18 | summary 19 | } 20 | 21 | pub fn histogram_raw(name: &str, 22 | min: f64, max: f64, 23 | num: f64, 24 | sum: f64, sum_squares: f64, 25 | bucket_limits: &[f64], 26 | bucket_counts: &[f64], 27 | ) -> Summary { 28 | let mut hist = HistogramProto::new(); 29 | hist.set_min(min); 30 | hist.set_max(max); 31 | hist.set_num(num); 32 | hist.set_sum(sum); 33 | hist.set_sum_squares(sum_squares); 34 | hist.set_bucket_limit(bucket_limits.to_vec()); 35 | hist.set_bucket(bucket_counts.to_vec()); 36 | 37 | let mut value = Summary_Value::new(); 38 | value.set_tag(name.to_string()); 39 | value.set_histo(hist); 40 | 41 | let values = RepeatedField::from(vec![value]); 42 | let mut summary = Summary::new(); 43 | summary.set_value(values); 44 | 45 | summary 46 | } 47 | 48 | /// dim is in CHW 49 | pub fn image(tag: &str, data: &[u8], dim: &[usize]) -> Summary { 50 | if dim.len() != 3 { 51 | panic!("format:CHW"); 52 | } 53 | if dim[0] != 3 { 54 | panic!("needs rgb"); 55 | } 56 | if data.len() != dim[0]*dim[1]*dim[2] { 57 | panic!("length of data should matches with dim."); 58 | } 59 | 60 | let mut img = RgbImage::new(dim[1] as u32, dim[2] as u32); 61 | img.clone_from_slice(data); 62 | let dimg = DynamicImage::ImageRgb8(img); 63 | let mut output_buf = Vec::::new(); 64 | dimg.write_to(&mut output_buf, ImageOutputFormat::Png).expect(""); 65 | 66 | let mut output_image = Summary_Image::new(); 67 | output_image.set_height(dim[1] as i32); 68 | output_image.set_width(dim[2] as i32); 69 | output_image.set_colorspace(3); 70 | output_image.set_encoded_image_string(output_buf); 71 | let mut value = Summary_Value::new(); 72 | value.set_tag(tag.to_string()); 73 | value.set_image(output_image); 74 | let values = RepeatedField::from(vec![value]); 75 | let mut summary = Summary::new(); 76 | summary.set_value(values); 77 | 78 | summary 79 | } 80 | 81 | pub fn custom_scalars(layout: f32) { 82 | let mut layout = Layout::new(); 83 | let value = Category::new(); 84 | let values = RepeatedField::from(vec![value]); 85 | layout.set_category(values); 86 | 87 | let mut plugin_data = SummaryMetadata_PluginData::new(); 88 | plugin_data.set_plugin_name("custom_scalars".to_string()); 89 | let mut smd = SummaryMetadata::new(); 90 | smd.set_plugin_data(plugin_data); 91 | 92 | 93 | } 94 | -------------------------------------------------------------------------------- /src/summary_writer.rs: -------------------------------------------------------------------------------- 1 | use std::path::{PathBuf, Path}; 2 | use std::time::SystemTime; 3 | use std::collections::HashMap; 4 | use protobuf::Message; 5 | use protobuf::RepeatedField; 6 | use crate::event_file_writer::EventFileWriter; 7 | use crate::proto::event::{Event, TaggedRunMetadata}; 8 | use crate::proto::summary::{Summary}; 9 | use crate::proto::graph::{GraphDef, }; 10 | use crate::proto::node_def::{NodeDef, }; 11 | use crate::proto::versions::{VersionDef, }; 12 | use crate::proto::attr_value::{AttrValue, }; 13 | use crate::proto::tensor_shape::{TensorShapeProto, }; 14 | use crate::proto::step_stats::{RunMetadata, }; 15 | use crate::summary::{scalar, image, histogram_raw}; 16 | 17 | 18 | pub struct FileWriter { 19 | writer: EventFileWriter, 20 | } 21 | impl FileWriter { 22 | pub fn new>(logdir: P) -> FileWriter { 23 | FileWriter { 24 | writer: EventFileWriter::new(logdir), 25 | } 26 | } 27 | pub fn get_logdir(&self) -> PathBuf { 28 | self.writer.get_logdir() 29 | } 30 | pub fn add_event(&mut self, event: &Event, step: usize) { 31 | let mut event = event.clone(); 32 | 33 | let mut time_full = 0.0; 34 | if let Ok(n) = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH) { 35 | time_full = n.as_secs_f64(); 36 | } 37 | event.set_wall_time(time_full); 38 | 39 | event.set_step(step as i64); 40 | 41 | self.writer.add_event(&event) 42 | } 43 | pub fn add_summary(&mut self, summary: Summary, step: usize) { 44 | let mut evn = Event::new(); 45 | evn.set_summary(summary); 46 | self.add_event(&evn, step) 47 | } 48 | pub fn add_graph(&mut self, graph: GraphDef, meta: RunMetadata) { 49 | let mut graph_vec: Vec = Vec::new(); 50 | graph.write_to_vec(&mut graph_vec).expect(""); 51 | let mut graph_evn = Event::new(); 52 | graph_evn.set_graph_def(graph_vec); 53 | self.writer.add_event(&graph_evn); 54 | 55 | let mut meta_vec: Vec = Vec::new(); 56 | meta.write_to_vec(&mut meta_vec).expect(""); 57 | let mut tagged_meta = TaggedRunMetadata::new(); 58 | tagged_meta.set_tag("profiler".to_string()); 59 | tagged_meta.set_run_metadata(meta_vec); 60 | let mut meta_evn = Event::new(); 61 | meta_evn.set_tagged_run_metadata(tagged_meta); 62 | self.writer.add_event(&meta_evn); 63 | } 64 | pub fn flush(&mut self) { 65 | self.writer.flush() 66 | } 67 | } 68 | 69 | pub struct SummaryWriter { 70 | writer: FileWriter, 71 | all_writers: HashMap, 72 | } 73 | impl SummaryWriter { 74 | pub fn new>(logdir: P) -> SummaryWriter { 75 | SummaryWriter { 76 | writer: FileWriter::new(logdir), 77 | all_writers: HashMap::new(), 78 | } 79 | } 80 | pub fn add_hparams(&mut self) {unimplemented!();} 81 | pub fn add_scalar(&mut self, tag: &str, scalar_value: f32, step: usize) { 82 | self.writer.add_summary(scalar(tag, scalar_value), step); 83 | } 84 | pub fn add_scalars(&mut self, main_tag: &str, tag_scalar: &HashMap, step: usize) { 85 | let base_logdir = self.writer.get_logdir(); 86 | for (tag, scalar_value) in tag_scalar.iter() { 87 | let fw_tag = base_logdir.join(main_tag).join(tag); 88 | if ! self.all_writers.contains_key(&fw_tag) { 89 | let new_writer = FileWriter::new(fw_tag.clone()); 90 | self.all_writers.insert(fw_tag.clone(), new_writer); 91 | } 92 | let fw = self.all_writers.get_mut(&fw_tag).expect(""); 93 | fw.add_summary(scalar(main_tag, *scalar_value), step); 94 | } 95 | } 96 | 97 | pub fn export_scalars_to_json(&self) {unimplemented!();} 98 | pub fn add_histogram(&mut self) {unimplemented!();} 99 | pub fn add_histogram_raw(&mut self, 100 | tag: &str, 101 | min: f64, max: f64, 102 | num: f64, 103 | sum: f64, sum_squares: f64, 104 | bucket_limits: &[f64], bucket_counts: &[f64], 105 | step: usize 106 | ) { 107 | if bucket_limits.len() != bucket_counts.len() { 108 | panic!("bucket_limits.len() != bucket_counts.len()"); 109 | } 110 | 111 | self.writer.add_summary(histogram_raw(tag, min, max, num, sum, sum_squares, bucket_limits, bucket_counts), step); 112 | } 113 | pub fn add_image(&mut self, tag: &str, data: &[u8], dim: &[usize], step: usize) { 114 | self.writer.add_summary(image(tag, data, dim), step); 115 | } 116 | pub fn add_images(&mut self) {unimplemented!();} 117 | pub fn add_image_with_boxes(&mut self) {unimplemented!();} 118 | pub fn add_figure(&mut self) {unimplemented!();} 119 | pub fn add_video(&mut self) {unimplemented!();} 120 | pub fn add_audio(&mut self) {unimplemented!();} 121 | pub fn add_text(&mut self) {unimplemented!();} 122 | pub fn add_onnx_graph(&mut self) {unimplemented!();} 123 | pub fn add_openvino_graph(&mut self) {unimplemented!();} 124 | pub fn add_graph(&mut self, node_list: &[NodeDef]) { 125 | let mut graph = GraphDef::new(); 126 | 127 | let nodes = RepeatedField::from(node_list.to_vec()); 128 | graph.set_node(nodes); 129 | 130 | let mut version = VersionDef::new(); 131 | version.set_producer(22); 132 | graph.set_versions(version); 133 | 134 | let stats = RunMetadata::new(); 135 | 136 | self.writer.add_graph(graph, stats); 137 | } 138 | pub fn add_embedding(&mut self) {unimplemented!();} 139 | pub fn add_pr_curve(&mut self) {unimplemented!();} 140 | pub fn add_pr_curve_raw(&mut self) {unimplemented!();} 141 | pub fn add_custom_scalars_multilinechart(&mut self) {unimplemented!();} 142 | pub fn add_custom_scalars_marginchart(&mut self) {unimplemented!();} 143 | pub fn add_custom_scalars(&mut self) {unimplemented!();} 144 | pub fn add_mesh(&mut self) {unimplemented!();} 145 | 146 | pub fn flush(&mut self) { 147 | self.writer.flush(); 148 | } 149 | } 150 | --------------------------------------------------------------------------------