1#[allow(clippy::all)]
4#[allow(clippy::pedantic)]
5#[allow(clippy::nursery)]
6#[derive(Clone, PartialEq, ::prost::Message)]
7pub struct Program {
8 #[prost(int64, tag = "1")]
9 pub version: i64,
10 #[prost(map = "string, message", tag = "2")]
13 pub functions: ::std::collections::HashMap<::prost::alloc::string::String, Function>,
14 #[prost(string, tag = "3")]
15 pub doc_string: ::prost::alloc::string::String,
16 #[prost(map = "string, message", tag = "4")]
19 pub attributes: ::std::collections::HashMap<::prost::alloc::string::String, Value>,
20}
21#[allow(clippy::all)]
23#[allow(clippy::pedantic)]
24#[allow(clippy::nursery)]
25#[derive(Clone, PartialEq, ::prost::Message)]
26pub struct Function {
27 #[prost(message, repeated, tag = "1")]
32 pub inputs: ::prost::alloc::vec::Vec<NamedValueType>,
33 #[prost(string, tag = "2")]
36 pub opset: ::prost::alloc::string::String,
37 #[prost(map = "string, message", tag = "3")]
47 pub block_specializations: ::std::collections::HashMap<
48 ::prost::alloc::string::String,
49 Block,
50 >,
51 #[prost(map = "string, message", tag = "4")]
54 pub attributes: ::std::collections::HashMap<::prost::alloc::string::String, Value>,
55}
56#[allow(clippy::all)]
58#[allow(clippy::pedantic)]
59#[allow(clippy::nursery)]
60#[derive(Clone, PartialEq, ::prost::Message)]
61pub struct Block {
62 #[prost(message, repeated, tag = "1")]
65 pub inputs: ::prost::alloc::vec::Vec<NamedValueType>,
66 #[prost(string, repeated, tag = "2")]
76 pub outputs: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
77 #[prost(message, repeated, tag = "3")]
78 pub operations: ::prost::alloc::vec::Vec<Operation>,
79 #[prost(map = "string, message", tag = "4")]
82 pub attributes: ::std::collections::HashMap<::prost::alloc::string::String, Value>,
83}
84#[allow(clippy::all)]
86#[allow(clippy::pedantic)]
87#[allow(clippy::nursery)]
88#[derive(Clone, PartialEq, ::prost::Message)]
89pub struct Argument {
90 #[prost(message, repeated, tag = "1")]
91 pub arguments: ::prost::alloc::vec::Vec<argument::Binding>,
92}
93pub mod argument {
95 #[allow(clippy::all)]
96 #[allow(clippy::pedantic)]
97 #[allow(clippy::nursery)]
98 #[derive(Clone, PartialEq, ::prost::Message)]
99 pub struct Binding {
100 #[prost(oneof = "binding::Binding", tags = "1, 2")]
101 pub binding: ::core::option::Option<binding::Binding>,
102 }
103 pub mod binding {
105 #[allow(clippy::all)]
106 #[allow(clippy::pedantic)]
107 #[allow(clippy::nursery)]
108 #[derive(Clone, PartialEq, ::prost::Oneof)]
109 pub enum Binding {
110 #[prost(string, tag = "1")]
112 Name(::prost::alloc::string::String),
113 #[prost(message, tag = "2")]
115 Value(super::super::Value),
116 }
117 }
118}
119#[allow(clippy::all)]
121#[allow(clippy::pedantic)]
122#[allow(clippy::nursery)]
123#[derive(Clone, PartialEq, ::prost::Message)]
124pub struct Operation {
125 #[prost(string, tag = "1")]
128 pub r#type: ::prost::alloc::string::String,
129 #[prost(map = "string, message", tag = "2")]
141 pub inputs: ::std::collections::HashMap<::prost::alloc::string::String, Argument>,
142 #[prost(message, repeated, tag = "3")]
147 pub outputs: ::prost::alloc::vec::Vec<NamedValueType>,
148 #[prost(message, repeated, tag = "4")]
151 pub blocks: ::prost::alloc::vec::Vec<Block>,
152 #[prost(map = "string, message", tag = "5")]
155 pub attributes: ::std::collections::HashMap<::prost::alloc::string::String, Value>,
156}
157#[allow(clippy::all)]
160#[allow(clippy::pedantic)]
161#[allow(clippy::nursery)]
162#[derive(Clone, PartialEq, ::prost::Message)]
163pub struct NamedValueType {
164 #[prost(string, tag = "1")]
166 pub name: ::prost::alloc::string::String,
167 #[prost(message, optional, tag = "2")]
169 pub r#type: ::core::option::Option<ValueType>,
170}
171#[allow(clippy::all)]
173#[allow(clippy::pedantic)]
174#[allow(clippy::nursery)]
175#[derive(Clone, PartialEq, ::prost::Message)]
176pub struct ValueType {
177 #[prost(oneof = "value_type::Type", tags = "1, 2, 3, 4, 5")]
178 pub r#type: ::core::option::Option<value_type::Type>,
179}
180pub mod value_type {
182 #[allow(clippy::all)]
183 #[allow(clippy::pedantic)]
184 #[allow(clippy::nursery)]
185 #[derive(Clone, PartialEq, ::prost::Oneof)]
186 pub enum Type {
187 #[prost(message, tag = "1")]
188 TensorType(super::TensorType),
189 #[prost(message, tag = "2")]
190 ListType(::prost::alloc::boxed::Box<super::ListType>),
191 #[prost(message, tag = "3")]
192 TupleType(super::TupleType),
193 #[prost(message, tag = "4")]
194 DictionaryType(::prost::alloc::boxed::Box<super::DictionaryType>),
195 #[prost(message, tag = "5")]
196 StateType(::prost::alloc::boxed::Box<super::StateType>),
197 }
198}
199#[allow(clippy::all)]
200#[allow(clippy::pedantic)]
201#[allow(clippy::nursery)]
202#[derive(Clone, PartialEq, ::prost::Message)]
203pub struct TensorType {
204 #[prost(enumeration = "DataType", tag = "1")]
206 pub data_type: i32,
207 #[prost(int64, tag = "2")]
210 pub rank: i64,
211 #[prost(message, repeated, tag = "3")]
213 pub dimensions: ::prost::alloc::vec::Vec<Dimension>,
214 #[prost(map = "string, message", tag = "4")]
217 pub attributes: ::std::collections::HashMap<::prost::alloc::string::String, Value>,
218}
219#[allow(clippy::all)]
220#[allow(clippy::pedantic)]
221#[allow(clippy::nursery)]
222#[derive(Clone, PartialEq, ::prost::Message)]
223pub struct TupleType {
224 #[prost(message, repeated, tag = "1")]
226 pub types: ::prost::alloc::vec::Vec<ValueType>,
227}
228#[allow(clippy::all)]
229#[allow(clippy::pedantic)]
230#[allow(clippy::nursery)]
231#[derive(Clone, PartialEq, ::prost::Message)]
232pub struct ListType {
233 #[prost(message, optional, boxed, tag = "1")]
235 pub r#type: ::core::option::Option<::prost::alloc::boxed::Box<ValueType>>,
236 #[prost(message, optional, tag = "2")]
238 pub length: ::core::option::Option<Dimension>,
239}
240#[allow(clippy::all)]
242#[allow(clippy::pedantic)]
243#[allow(clippy::nursery)]
244#[derive(Clone, PartialEq, ::prost::Message)]
245pub struct DictionaryType {
246 #[prost(message, optional, boxed, tag = "1")]
247 pub key_type: ::core::option::Option<::prost::alloc::boxed::Box<ValueType>>,
248 #[prost(message, optional, boxed, tag = "2")]
249 pub value_type: ::core::option::Option<::prost::alloc::boxed::Box<ValueType>>,
250}
251#[allow(clippy::all)]
252#[allow(clippy::pedantic)]
253#[allow(clippy::nursery)]
254#[derive(Clone, PartialEq, ::prost::Message)]
255pub struct StateType {
256 #[prost(message, optional, boxed, tag = "1")]
257 pub wrapped_type: ::core::option::Option<::prost::alloc::boxed::Box<ValueType>>,
258}
259#[allow(clippy::all)]
260#[allow(clippy::pedantic)]
261#[allow(clippy::nursery)]
262#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
263pub struct Dimension {
264 #[prost(oneof = "dimension::Dimension", tags = "1, 2")]
265 pub dimension: ::core::option::Option<dimension::Dimension>,
266}
267pub mod dimension {
269 #[allow(clippy::all)]
270 #[allow(clippy::pedantic)]
271 #[allow(clippy::nursery)]
272 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
273 pub struct ConstantDimension {
274 #[prost(uint64, tag = "1")]
275 pub size: u64,
276 }
277 #[allow(clippy::all)]
278 #[allow(clippy::pedantic)]
279 #[allow(clippy::nursery)]
280 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
281 pub struct UnknownDimension {
282 #[prost(bool, tag = "1")]
283 pub variadic: bool,
284 }
285 #[allow(clippy::all)]
286 #[allow(clippy::pedantic)]
287 #[allow(clippy::nursery)]
288 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
289 pub enum Dimension {
290 #[prost(message, tag = "1")]
291 Constant(ConstantDimension),
292 #[prost(message, tag = "2")]
293 Unknown(UnknownDimension),
294 }
295}
296#[allow(clippy::all)]
298#[allow(clippy::pedantic)]
299#[allow(clippy::nursery)]
300#[derive(Clone, PartialEq, ::prost::Message)]
301pub struct Value {
302 #[prost(string, tag = "1")]
304 pub doc_string: ::prost::alloc::string::String,
305 #[prost(message, optional, tag = "2")]
306 pub r#type: ::core::option::Option<ValueType>,
307 #[prost(oneof = "value::Value", tags = "3, 5")]
308 pub value: ::core::option::Option<value::Value>,
309}
310pub mod value {
312 #[allow(clippy::all)]
314 #[allow(clippy::pedantic)]
315 #[allow(clippy::nursery)]
316 #[derive(Clone, PartialEq, ::prost::Message)]
317 pub struct ImmediateValue {
318 #[prost(oneof = "immediate_value::Value", tags = "1, 2, 3, 4")]
319 pub value: ::core::option::Option<immediate_value::Value>,
320 }
321 pub mod immediate_value {
323 #[allow(clippy::all)]
324 #[allow(clippy::pedantic)]
325 #[allow(clippy::nursery)]
326 #[derive(Clone, PartialEq, ::prost::Oneof)]
327 pub enum Value {
328 #[prost(message, tag = "1")]
329 Tensor(super::super::TensorValue),
330 #[prost(message, tag = "2")]
331 Tuple(super::super::TupleValue),
332 #[prost(message, tag = "3")]
333 List(super::super::ListValue),
334 #[prost(message, tag = "4")]
335 Dictionary(super::super::DictionaryValue),
336 }
337 }
338 #[allow(clippy::all)]
340 #[allow(clippy::pedantic)]
341 #[allow(clippy::nursery)]
342 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
343 pub struct BlobFileValue {
344 #[prost(string, tag = "1")]
346 pub file_name: ::prost::alloc::string::String,
347 #[prost(uint64, tag = "2")]
349 pub offset: u64,
350 }
351 #[allow(clippy::all)]
352 #[allow(clippy::pedantic)]
353 #[allow(clippy::nursery)]
354 #[derive(Clone, PartialEq, ::prost::Oneof)]
355 pub enum Value {
356 #[prost(message, tag = "3")]
357 ImmediateValue(ImmediateValue),
358 #[prost(message, tag = "5")]
359 BlobFileValue(BlobFileValue),
360 }
361}
362#[allow(clippy::all)]
363#[allow(clippy::pedantic)]
364#[allow(clippy::nursery)]
365#[derive(Clone, PartialEq, ::prost::Message)]
366pub struct TensorValue {
367 #[prost(oneof = "tensor_value::Value", tags = "1, 2, 3, 4, 5, 6, 7")]
368 pub value: ::core::option::Option<tensor_value::Value>,
369}
370pub mod tensor_value {
372 #[allow(clippy::all)]
373 #[allow(clippy::pedantic)]
374 #[allow(clippy::nursery)]
375 #[derive(Clone, PartialEq, ::prost::Message)]
376 pub struct RepeatedFloats {
377 #[prost(float, repeated, tag = "1")]
378 pub values: ::prost::alloc::vec::Vec<f32>,
379 }
380 #[allow(clippy::all)]
381 #[allow(clippy::pedantic)]
382 #[allow(clippy::nursery)]
383 #[derive(Clone, PartialEq, ::prost::Message)]
384 pub struct RepeatedDoubles {
385 #[prost(double, repeated, tag = "1")]
386 pub values: ::prost::alloc::vec::Vec<f64>,
387 }
388 #[allow(clippy::all)]
389 #[allow(clippy::pedantic)]
390 #[allow(clippy::nursery)]
391 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
392 pub struct RepeatedInts {
393 #[prost(int32, repeated, tag = "1")]
394 pub values: ::prost::alloc::vec::Vec<i32>,
395 }
396 #[allow(clippy::all)]
397 #[allow(clippy::pedantic)]
398 #[allow(clippy::nursery)]
399 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
400 pub struct RepeatedLongInts {
401 #[prost(int64, repeated, tag = "1")]
402 pub values: ::prost::alloc::vec::Vec<i64>,
403 }
404 #[allow(clippy::all)]
405 #[allow(clippy::pedantic)]
406 #[allow(clippy::nursery)]
407 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
408 pub struct RepeatedBools {
409 #[prost(bool, repeated, tag = "1")]
410 pub values: ::prost::alloc::vec::Vec<bool>,
411 }
412 #[allow(clippy::all)]
413 #[allow(clippy::pedantic)]
414 #[allow(clippy::nursery)]
415 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
416 pub struct RepeatedStrings {
417 #[prost(string, repeated, tag = "1")]
418 pub values: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
419 }
420 #[allow(clippy::all)]
421 #[allow(clippy::pedantic)]
422 #[allow(clippy::nursery)]
423 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
424 pub struct RepeatedBytes {
425 #[prost(bytes = "vec", tag = "1")]
426 pub values: ::prost::alloc::vec::Vec<u8>,
427 }
428 #[allow(clippy::all)]
429 #[allow(clippy::pedantic)]
430 #[allow(clippy::nursery)]
431 #[derive(Clone, PartialEq, ::prost::Oneof)]
432 pub enum Value {
433 #[prost(message, tag = "1")]
434 Floats(RepeatedFloats),
435 #[prost(message, tag = "2")]
436 Ints(RepeatedInts),
437 #[prost(message, tag = "3")]
438 Bools(RepeatedBools),
439 #[prost(message, tag = "4")]
440 Strings(RepeatedStrings),
441 #[prost(message, tag = "5")]
442 LongInts(RepeatedLongInts),
443 #[prost(message, tag = "6")]
444 Doubles(RepeatedDoubles),
445 #[prost(message, tag = "7")]
446 Bytes(RepeatedBytes),
447 }
448}
449#[allow(clippy::all)]
450#[allow(clippy::pedantic)]
451#[allow(clippy::nursery)]
452#[derive(Clone, PartialEq, ::prost::Message)]
453pub struct TupleValue {
454 #[prost(message, repeated, tag = "1")]
456 pub values: ::prost::alloc::vec::Vec<Value>,
457}
458#[allow(clippy::all)]
459#[allow(clippy::pedantic)]
460#[allow(clippy::nursery)]
461#[derive(Clone, PartialEq, ::prost::Message)]
462pub struct ListValue {
463 #[prost(message, repeated, tag = "1")]
464 pub values: ::prost::alloc::vec::Vec<Value>,
465}
466#[allow(clippy::all)]
467#[allow(clippy::pedantic)]
468#[allow(clippy::nursery)]
469#[derive(Clone, PartialEq, ::prost::Message)]
470pub struct DictionaryValue {
471 #[prost(message, repeated, tag = "1")]
472 pub values: ::prost::alloc::vec::Vec<dictionary_value::KeyValuePair>,
473}
474pub mod dictionary_value {
476 #[allow(clippy::all)]
477 #[allow(clippy::pedantic)]
478 #[allow(clippy::nursery)]
479 #[derive(Clone, PartialEq, ::prost::Message)]
480 pub struct KeyValuePair {
481 #[prost(message, optional, tag = "1")]
482 pub key: ::core::option::Option<super::Value>,
483 #[prost(message, optional, tag = "2")]
484 pub value: ::core::option::Option<super::Value>,
485 }
486}
487#[allow(clippy::all)]
493#[allow(clippy::pedantic)]
494#[allow(clippy::nursery)]
495#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
496#[repr(i32)]
497pub enum DataType {
498 UnusedType = 0,
502 Bool = 1,
503 String = 2,
505 Float8e4m3fn = 40,
507 Float8e5m2 = 41,
508 Float16 = 10,
509 Float32 = 11,
510 Float64 = 12,
511 Bfloat16 = 13,
512 Int8 = 21,
514 Int16 = 22,
515 Int32 = 23,
516 Int64 = 24,
517 Int4 = 25,
518 Uint8 = 31,
520 Uint16 = 32,
521 Uint32 = 33,
522 Uint64 = 34,
523 Uint4 = 35,
524 Uint2 = 36,
525 Uint1 = 37,
526 Uint6 = 38,
527 Uint3 = 39,
528}
529impl DataType {
530 pub fn as_str_name(&self) -> &'static str {
535 match self {
536 Self::UnusedType => "UNUSED_TYPE",
537 Self::Bool => "BOOL",
538 Self::String => "STRING",
539 Self::Float8e4m3fn => "FLOAT8E4M3FN",
540 Self::Float8e5m2 => "FLOAT8E5M2",
541 Self::Float16 => "FLOAT16",
542 Self::Float32 => "FLOAT32",
543 Self::Float64 => "FLOAT64",
544 Self::Bfloat16 => "BFLOAT16",
545 Self::Int8 => "INT8",
546 Self::Int16 => "INT16",
547 Self::Int32 => "INT32",
548 Self::Int64 => "INT64",
549 Self::Int4 => "INT4",
550 Self::Uint8 => "UINT8",
551 Self::Uint16 => "UINT16",
552 Self::Uint32 => "UINT32",
553 Self::Uint64 => "UINT64",
554 Self::Uint4 => "UINT4",
555 Self::Uint2 => "UINT2",
556 Self::Uint1 => "UINT1",
557 Self::Uint6 => "UINT6",
558 Self::Uint3 => "UINT3",
559 }
560 }
561 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
563 match value {
564 "UNUSED_TYPE" => Some(Self::UnusedType),
565 "BOOL" => Some(Self::Bool),
566 "STRING" => Some(Self::String),
567 "FLOAT8E4M3FN" => Some(Self::Float8e4m3fn),
568 "FLOAT8E5M2" => Some(Self::Float8e5m2),
569 "FLOAT16" => Some(Self::Float16),
570 "FLOAT32" => Some(Self::Float32),
571 "FLOAT64" => Some(Self::Float64),
572 "BFLOAT16" => Some(Self::Bfloat16),
573 "INT8" => Some(Self::Int8),
574 "INT16" => Some(Self::Int16),
575 "INT32" => Some(Self::Int32),
576 "INT64" => Some(Self::Int64),
577 "INT4" => Some(Self::Int4),
578 "UINT8" => Some(Self::Uint8),
579 "UINT16" => Some(Self::Uint16),
580 "UINT32" => Some(Self::Uint32),
581 "UINT64" => Some(Self::Uint64),
582 "UINT4" => Some(Self::Uint4),
583 "UINT2" => Some(Self::Uint2),
584 "UINT1" => Some(Self::Uint1),
585 "UINT6" => Some(Self::Uint6),
586 "UINT3" => Some(Self::Uint3),
587 _ => None,
588 }
589 }
590}