tensorflow_serving_client/
tensor_description.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 TensorDescription {
31 pub dtype: super::types::DataType,
33 pub shape: ::protobuf::SingularPtrField<super::tensor_shape::TensorShapeProto>,
34 pub allocation_description: ::protobuf::SingularPtrField<super::allocation_description::AllocationDescription>,
35 pub unknown_fields: ::protobuf::UnknownFields,
37 pub cached_size: ::protobuf::CachedSize,
38}
39
40impl<'a> ::std::default::Default for &'a TensorDescription {
41 fn default() -> &'a TensorDescription {
42 <TensorDescription as ::protobuf::Message>::default_instance()
43 }
44}
45
46impl TensorDescription {
47 pub fn new() -> TensorDescription {
48 ::std::default::Default::default()
49 }
50
51 pub fn get_dtype(&self) -> super::types::DataType {
55 self.dtype
56 }
57 pub fn clear_dtype(&mut self) {
58 self.dtype = super::types::DataType::DT_INVALID;
59 }
60
61 pub fn set_dtype(&mut self, v: super::types::DataType) {
63 self.dtype = v;
64 }
65
66 pub fn get_shape(&self) -> &super::tensor_shape::TensorShapeProto {
70 self.shape.as_ref().unwrap_or_else(|| super::tensor_shape::TensorShapeProto::default_instance())
71 }
72 pub fn clear_shape(&mut self) {
73 self.shape.clear();
74 }
75
76 pub fn has_shape(&self) -> bool {
77 self.shape.is_some()
78 }
79
80 pub fn set_shape(&mut self, v: super::tensor_shape::TensorShapeProto) {
82 self.shape = ::protobuf::SingularPtrField::some(v);
83 }
84
85 pub fn mut_shape(&mut self) -> &mut super::tensor_shape::TensorShapeProto {
88 if self.shape.is_none() {
89 self.shape.set_default();
90 }
91 self.shape.as_mut().unwrap()
92 }
93
94 pub fn take_shape(&mut self) -> super::tensor_shape::TensorShapeProto {
96 self.shape.take().unwrap_or_else(|| super::tensor_shape::TensorShapeProto::new())
97 }
98
99 pub fn get_allocation_description(&self) -> &super::allocation_description::AllocationDescription {
103 self.allocation_description.as_ref().unwrap_or_else(|| super::allocation_description::AllocationDescription::default_instance())
104 }
105 pub fn clear_allocation_description(&mut self) {
106 self.allocation_description.clear();
107 }
108
109 pub fn has_allocation_description(&self) -> bool {
110 self.allocation_description.is_some()
111 }
112
113 pub fn set_allocation_description(&mut self, v: super::allocation_description::AllocationDescription) {
115 self.allocation_description = ::protobuf::SingularPtrField::some(v);
116 }
117
118 pub fn mut_allocation_description(&mut self) -> &mut super::allocation_description::AllocationDescription {
121 if self.allocation_description.is_none() {
122 self.allocation_description.set_default();
123 }
124 self.allocation_description.as_mut().unwrap()
125 }
126
127 pub fn take_allocation_description(&mut self) -> super::allocation_description::AllocationDescription {
129 self.allocation_description.take().unwrap_or_else(|| super::allocation_description::AllocationDescription::new())
130 }
131}
132
133impl ::protobuf::Message for TensorDescription {
134 fn is_initialized(&self) -> bool {
135 for v in &self.shape {
136 if !v.is_initialized() {
137 return false;
138 }
139 };
140 for v in &self.allocation_description {
141 if !v.is_initialized() {
142 return false;
143 }
144 };
145 true
146 }
147
148 fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::ProtobufResult<()> {
149 while !is.eof()? {
150 let (field_number, wire_type) = is.read_tag_unpack()?;
151 match field_number {
152 1 => {
153 ::protobuf::rt::read_proto3_enum_with_unknown_fields_into(wire_type, is, &mut self.dtype, 1, &mut self.unknown_fields)?
154 },
155 2 => {
156 ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.shape)?;
157 },
158 4 => {
159 ::protobuf::rt::read_singular_message_into(wire_type, is, &mut self.allocation_description)?;
160 },
161 _ => {
162 ::protobuf::rt::read_unknown_or_skip_group(field_number, wire_type, is, self.mut_unknown_fields())?;
163 },
164 };
165 }
166 ::std::result::Result::Ok(())
167 }
168
169 #[allow(unused_variables)]
171 fn compute_size(&self) -> u32 {
172 let mut my_size = 0;
173 if self.dtype != super::types::DataType::DT_INVALID {
174 my_size += ::protobuf::rt::enum_size(1, self.dtype);
175 }
176 if let Some(ref v) = self.shape.as_ref() {
177 let len = v.compute_size();
178 my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
179 }
180 if let Some(ref v) = self.allocation_description.as_ref() {
181 let len = v.compute_size();
182 my_size += 1 + ::protobuf::rt::compute_raw_varint32_size(len) + len;
183 }
184 my_size += ::protobuf::rt::unknown_fields_size(self.get_unknown_fields());
185 self.cached_size.set(my_size);
186 my_size
187 }
188
189 fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::ProtobufResult<()> {
190 if self.dtype != super::types::DataType::DT_INVALID {
191 os.write_enum(1, self.dtype.value())?;
192 }
193 if let Some(ref v) = self.shape.as_ref() {
194 os.write_tag(2, ::protobuf::wire_format::WireTypeLengthDelimited)?;
195 os.write_raw_varint32(v.get_cached_size())?;
196 v.write_to_with_cached_sizes(os)?;
197 }
198 if let Some(ref v) = self.allocation_description.as_ref() {
199 os.write_tag(4, ::protobuf::wire_format::WireTypeLengthDelimited)?;
200 os.write_raw_varint32(v.get_cached_size())?;
201 v.write_to_with_cached_sizes(os)?;
202 }
203 os.write_unknown_fields(self.get_unknown_fields())?;
204 ::std::result::Result::Ok(())
205 }
206
207 fn get_cached_size(&self) -> u32 {
208 self.cached_size.get()
209 }
210
211 fn get_unknown_fields(&self) -> &::protobuf::UnknownFields {
212 &self.unknown_fields
213 }
214
215 fn mut_unknown_fields(&mut self) -> &mut ::protobuf::UnknownFields {
216 &mut self.unknown_fields
217 }
218
219 fn as_any(&self) -> &dyn (::std::any::Any) {
220 self as &dyn (::std::any::Any)
221 }
222 fn as_any_mut(&mut self) -> &mut dyn (::std::any::Any) {
223 self as &mut dyn (::std::any::Any)
224 }
225 fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {
226 self
227 }
228
229 fn descriptor(&self) -> &'static ::protobuf::reflect::MessageDescriptor {
230 Self::descriptor_static()
231 }
232
233 fn new() -> TensorDescription {
234 TensorDescription::new()
235 }
236
237 fn descriptor_static() -> &'static ::protobuf::reflect::MessageDescriptor {
238 static mut descriptor: ::protobuf::lazy::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::lazy::Lazy::INIT;
239 unsafe {
240 descriptor.get(|| {
241 let mut fields = ::std::vec::Vec::new();
242 fields.push(::protobuf::reflect::accessor::make_simple_field_accessor::<_, ::protobuf::types::ProtobufTypeEnum<super::types::DataType>>(
243 "dtype",
244 |m: &TensorDescription| { &m.dtype },
245 |m: &mut TensorDescription| { &mut m.dtype },
246 ));
247 fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<super::tensor_shape::TensorShapeProto>>(
248 "shape",
249 |m: &TensorDescription| { &m.shape },
250 |m: &mut TensorDescription| { &mut m.shape },
251 ));
252 fields.push(::protobuf::reflect::accessor::make_singular_ptr_field_accessor::<_, ::protobuf::types::ProtobufTypeMessage<super::allocation_description::AllocationDescription>>(
253 "allocation_description",
254 |m: &TensorDescription| { &m.allocation_description },
255 |m: &mut TensorDescription| { &mut m.allocation_description },
256 ));
257 ::protobuf::reflect::MessageDescriptor::new_pb_name::<TensorDescription>(
258 "TensorDescription",
259 fields,
260 file_descriptor_proto()
261 )
262 })
263 }
264 }
265
266 fn default_instance() -> &'static TensorDescription {
267 static mut instance: ::protobuf::lazy::Lazy<TensorDescription> = ::protobuf::lazy::Lazy::INIT;
268 unsafe {
269 instance.get(TensorDescription::new)
270 }
271 }
272}
273
274impl ::protobuf::Clear for TensorDescription {
275 fn clear(&mut self) {
276 self.dtype = super::types::DataType::DT_INVALID;
277 self.shape.clear();
278 self.allocation_description.clear();
279 self.unknown_fields.clear();
280 }
281}
282
283impl ::std::fmt::Debug for TensorDescription {
284 fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
285 ::protobuf::text_format::fmt(self, f)
286 }
287}
288
289impl ::protobuf::reflect::ProtobufValue for TensorDescription {
290 fn as_ref(&self) -> ::protobuf::reflect::ReflectValueRef {
291 ::protobuf::reflect::ReflectValueRef::Message(self)
292 }
293}
294
295static file_descriptor_proto_data: &'static [u8] = b"\
296 \n2tensorflow/core/framework/tensor_description.proto\x12\ntensorflow\
297 \x1a6tensorflow/core/framework/allocation_description.proto\x1a,tensorfl\
298 ow/core/framework/tensor_shape.proto\x1a%tensorflow/core/framework/types\
299 .proto\"\xcd\x01\n\x11TensorDescription\x12*\n\x05dtype\x18\x01\x20\x01(\
300 \x0e2\x14.tensorflow.DataTypeR\x05dtype\x122\n\x05shape\x18\x02\x20\x01(\
301 \x0b2\x1c.tensorflow.TensorShapeProtoR\x05shape\x12X\n\x16allocation_des\
302 cription\x18\x04\x20\x01(\x0b2!.tensorflow.AllocationDescriptionR\x15all\
303 ocationDescriptionB\x93\x01\n\x18org.tensorflow.frameworkB\x17TensorDesc\
304 riptionProtosP\x01ZYgithub.com/tensorflow/tensorflow/tensorflow/go/core/\
305 framework/tensor_description_go_proto\xf8\x01\x01J\xd9\x03\n\x06\x12\x04\
306 \0\0\x17\x01\n\x08\n\x01\x0c\x12\x03\0\0\x12\n\x08\n\x01\x02\x12\x03\x02\
307 \0\x13\n\t\n\x02\x03\0\x12\x03\x04\0@\n\t\n\x02\x03\x01\x12\x03\x05\06\n\
308 \t\n\x02\x03\x02\x12\x03\x06\0/\n\x08\n\x01\x08\x12\x03\x08\0\x1f\n\t\n\
309 \x02\x08\x1f\x12\x03\x08\0\x1f\n\x08\n\x01\x08\x12\x03\t\08\n\t\n\x02\
310 \x08\x08\x12\x03\t\08\n\x08\n\x01\x08\x12\x03\n\0\"\n\t\n\x02\x08\n\x12\
311 \x03\n\0\"\n\x08\n\x01\x08\x12\x03\x0b\01\n\t\n\x02\x08\x01\x12\x03\x0b\
312 \01\n\x08\n\x01\x08\x12\x03\x0c\0p\n\t\n\x02\x08\x0b\x12\x03\x0c\0p\n\n\
313 \n\x02\x04\0\x12\x04\x0e\0\x17\x01\n\n\n\x03\x04\0\x01\x12\x03\x0e\x08\
314 \x19\n+\n\x04\x04\0\x02\0\x12\x03\x10\x02\x15\x1a\x1e\x20Data\x20type\
315 \x20of\x20tensor\x20elements\n\n\x0c\n\x05\x04\0\x02\0\x06\x12\x03\x10\
316 \x02\n\n\x0c\n\x05\x04\0\x02\0\x01\x12\x03\x10\x0b\x10\n\x0c\n\x05\x04\0\
317 \x02\0\x03\x12\x03\x10\x13\x14\n#\n\x04\x04\0\x02\x01\x12\x03\x13\x02\
318 \x1d\x1a\x16\x20Shape\x20of\x20the\x20tensor.\n\n\x0c\n\x05\x04\0\x02\
319 \x01\x06\x12\x03\x13\x02\x12\n\x0c\n\x05\x04\0\x02\x01\x01\x12\x03\x13\
320 \x13\x18\n\x0c\n\x05\x04\0\x02\x01\x03\x12\x03\x13\x1b\x1c\nI\n\x04\x04\
321 \0\x02\x02\x12\x03\x16\x023\x1a<\x20Information\x20about\x20the\x20size\
322 \x20and\x20allocator\x20used\x20for\x20the\x20data\n\n\x0c\n\x05\x04\0\
323 \x02\x02\x06\x12\x03\x16\x02\x17\n\x0c\n\x05\x04\0\x02\x02\x01\x12\x03\
324 \x16\x18.\n\x0c\n\x05\x04\0\x02\x02\x03\x12\x03\x1612b\x06proto3\
325";
326
327static mut file_descriptor_proto_lazy: ::protobuf::lazy::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::lazy::Lazy::INIT;
328
329fn parse_descriptor_proto() -> ::protobuf::descriptor::FileDescriptorProto {
330 ::protobuf::parse_from_bytes(file_descriptor_proto_data).unwrap()
331}
332
333pub fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
334 unsafe {
335 file_descriptor_proto_lazy.get(|| {
336 parse_descriptor_proto()
337 })
338 }
339}