tensorflow_serving_client/
named_tensor.rs1#![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)]
20use protobuf::Message as Message_imported_for_functions;
23use protobuf::ProtobufEnum as ProtobufEnum_imported_for_functions;
24
25#[derive(PartialEq,Clone,Default)]
30pub struct NamedTensorProto {
31 pub name: ::std::string::String,
33 pub tensor: ::protobuf::SingularPtrField<super::tensor::TensorProto>,
34 pub unknown_fields: ::protobuf::UnknownFields,
36 pub cached_size: ::protobuf::CachedSize,
37}
38
39impl<'a> ::std::default::Default for &'a NamedTensorProto {
40 fn default() -> &'a NamedTensorProto {
41 <NamedTensorProto as ::protobuf::Message>::default_instance()
42 }
43}
44
45impl NamedTensorProto {
46 pub fn new() -> NamedTensorProto {
47 ::std::default::Default::default()
48 }
49
50 pub fn get_name(&self) -> &str {
54 &self.name
55 }
56 pub fn clear_name(&mut self) {
57 self.name.clear();
58 }
59
60 pub fn set_name(&mut self, v: ::std::string::String) {
62 self.name = v;
63 }
64
65 pub fn mut_name(&mut self) -> &mut ::std::string::String {
68 &mut self.name
69 }
70
71 pub fn take_name(&mut self) -> ::std::string::String {
73 ::std::mem::replace(&mut self.name, ::std::string::String::new())
74 }
75
76 pub fn get_tensor(&self) -> &super::tensor::TensorProto {
80 self.tensor.as_ref().unwrap_or_else(|| super::tensor::TensorProto::default_instance())
81 }
82 pub fn clear_tensor(&mut self) {
83 self.tensor.clear();
84 }
85
86 pub fn has_tensor(&self) -> bool {
87 self.tensor.is_some()
88 }
89
90 pub fn set_tensor(&mut self, v: super::tensor::TensorProto) {
92 self.tensor = ::protobuf::SingularPtrField::some(v);
93 }
94
95 pub fn mut_tensor(&mut self) -> &mut super::tensor::TensorProto {
98 if self.tensor.is_none() {
99 self.tensor.set_default();
100 }
101 self.tensor.as_mut().unwrap()
102 }
103
104 pub fn take_tensor(&mut self) -> super::tensor::TensorProto {
106 self.tensor.take().unwrap_or_else(|| super::tensor::TensorProto::new())
107 }
108}
109
110impl ::protobuf::Message for NamedTensorProto {
111 fn is_initialized(&self) -> bool {
112 for v in &self.tensor {
113 if !v.is_initialized() {
114 return false;
115 }
116 };
117 true
118 }
119
120 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
121 while !is.eof()? {
122 let (field_number, wire_type) = is.read_tag_unpack()?;
123 match field_number {
124 1 => {
125 ::protobuf::rt::read_singular_proto3_string_into(wire_type, is, &mut self.name)?;
126 },
127 2 => {
128 ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.tensor)?;
129 },
130 _ => {
131 ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
132 },
133 };
134 }
135 ::std::result::Result::Ok(())
136 }
137
138 #[allow(unused_variables)]
140 fn compute_size(&self) -> u32 {
141 let mut my_size = 0;
142 if !self.name.is_empty() {
143 my_size += ::protobuf::rt::string_size(1, &self.name);
144 }
145 if let Some(ref v) = self.tensor.as_ref() {
146 let len = v.compute_size();
147 my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
148 }
149 my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
150 self.cached_size.set(my_size);
151 my_size
152 }
153
154 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
155 if !self.name.is_empty() {
156 os.write_string(1, &self.name)?;
157 }
158 if let Some(ref v) = self.tensor.as_ref() {
159 os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
160 os.write_raw_varint32(v.get_cached_size())?;
161 v.write_to_with_cached_sizes(os)?;
162 }
163 os.write_unknown_fields(self.get_unknown_fields())?;
164 ::std::result::Result::Ok(())
165 }
166
167 fn get_cached_size(&self) -> u32 {
168 self.cached_size.get()
169 }
170
171 fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
172 &self.unknown_fields
173 }
174
175 fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
176 &mut self.unknown_fields
177 }
178
179 fn as_any(&self) -> &dyn (::std::any::Any) {
180 self as &dyn (::std::any::Any)
181 }
182 fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
183 self as &mut dyn (::std::any::Any)
184 }
185 fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
186 self
187 }
188
189 fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
190 Self::descriptor_static()
191 }
192
193 fn new() -> NamedTensorProto {
194 NamedTensorProto::new()
195 }
196
197 fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
198 static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
199 unsafe {
200 descriptor.get(|| {
201 let mut fields = ::std::vec::Vec::new();
202 fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeString>(
203 "name",
204 |m: &NamedTensorProto| { &m.name },
205 |m: &mut NamedTensorProto| { &mut m.name },
206 ));
207 fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<super::tensor::TensorProto>>(
208 "tensor",
209 |m: &NamedTensorProto| { &m.tensor },
210 |m: &mut NamedTensorProto| { &mut m.tensor },
211 ));
212 ::protobuf::reflect::MessageDescriptor::new_pb_name::<NamedTensorProto>(
213 "NamedTensorProto",
214 fields,
215 file_descriptor_proto()
216 )
217 })
218 }
219 }
220
221 fn default_instance() -> &'static NamedTensorProto {
222 static mut instance: ::protobuf::lazy::Lazy<NamedTensorProto> = ::protobuf::lazy::Lazy::INIT;
223 unsafe {
224 instance.get(NamedTensorProto::new)
225 }
226 }
227}
228
229impl ::protobuf::Clear for NamedTensorProto {
230 fn clear(&mut self) {
231 self.name.clear();
232 self.tensor.clear();
233 self.unknown_fields.clear();
234 }
235}
236
237impl ::std::fmt::Debug for NamedTensorProto {
238 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
239 ::protobuf::text_format::fmt(self, f)
240 }
241}
242
243impl ::protobuf::reflect::ProtobufValue for NamedTensorProto {
244 fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
245 ::protobuf::reflect::ReflectValueRef::Message(self)
246 }
247}
248
249static file_descriptor_proto_data: &'static [u8] = b"\
250 \n+tensorflow/core/protobuf/named_tensor.proto\x12\ntensorflow\x1a&tenso\
251 rflow/core/framework/tensor.proto\"W\n\x10NamedTensorProto\x12\x12\n\x04\
252 name\x18\x01\x20\x01(\tR\x04name\x12/\n\x06tensor\x18\x02\x20\x01(\x0b2\
253 \x17.tensorflow.TensorProtoR\x06tensorB|\n\x18org.tensorflow.frameworkB\
254 \x11NamedTensorProtosP\x01ZHgithub.com/tensorflow/tensorflow/tensorflow/\
255 go/core/core_protos_go_proto\xf8\x01\x01J\xff\x04\n\x06\x12\x04\0\0\x18\
256 \x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x02\0\x13\n\
257 \t\n\x02\x03\0\x12\x03\x04\00\n\x08\n\x01\x08\x12\x03\x06\0\x1f\n\t\n\
258 \x02\x08\x1f\x12\x03\x06\0\x1f\n\x08\n\x01\x08\x12\x03\x07\02\n\t\n\x02\
259 \x08\x08\x12\x03\x07\02\n\x08\n\x01\x08\x12\x03\x08\0\"\n\t\n\x02\x08\n\
260 \x12\x03\x08\0\"\n\x08\n\x01\x08\x12\x03\t\01\n\t\n\x02\x08\x01\x12\x03\
261 \t\01\n\x08\n\x01\x08\x12\x03\n\0_\n\t\n\x02\x08\x0b\x12\x03\n\0_\n6\n\
262 \x02\x04\0\x12\x04\r\0\x18\x01\x1a*\x20A\x20pair\x20of\x20tensor\x20name\
263 \x20and\x20tensor\x20values.\n\n\n\n\x03\x04\0\x01\x12\x03\r\x08\x18\n\"\
264 \n\x04\x04\0\x02\0\x12\x03\x0f\x02\x12\x1a\x15\x20Name\x20of\x20the\x20t\
265 ensor.\n\n\x0c\n\x05\x04\0\x02\0\x05\x12\x03\x0f\x02\x08\n\x0c\n\x05\x04\
266 \0\x02\0\x01\x12\x03\x0f\t\r\n\x0c\n\x05\x04\0\x02\0\x03\x12\x03\x0f\x10\
267 \x11\n\xb0\x02\n\x04\x04\0\x02\x01\x12\x03\x17\x02\x19\x1a\xa2\x02\x20Th\
268 e\x20client\x20can\x20populate\x20a\x20TensorProto\x20using\x20a\x20tens\
269 orflow::Tensor`,\x20or\n\x20directly\x20using\x20the\x20protobuf\x20fiel\
270 d\x20accessors.\n\n\x20The\x20client\x20specifies\x20whether\x20the\x20r\
271 eturned\x20tensor\x20values\x20should\x20be\n\x20filled\x20tensor\x20fie\
272 lds\x20(float_val,\x20int_val,\x20etc.)\x20or\x20encoded\x20in\x20a\n\
273 \x20compact\x20form\x20in\x20tensor.tensor_content.\n\n\x0c\n\x05\x04\0\
274 \x02\x01\x06\x12\x03\x17\x02\r\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x17\
275 \x0e\x14\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x17\x17\x18b\x06proto3\
276";
277
278static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
279
280fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
281 ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
282}
283
284pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
285 unsafe {
286 file_descriptor_proto_lazy.get(|| {
287 parse_descriptor_proto()
288 })
289 }
290}