coreml_proto/proto/core_ml.specification.rs
1// This file is @generated by prost-build.
2///
3/// The 64-bit integer feature type.
4#[allow(clippy::all)]
5#[allow(clippy::pedantic)]
6#[allow(clippy::nursery)]
7#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
8pub struct Int64FeatureType {}
9///
10/// The double-precision floating point number feature type.
11#[allow(clippy::all)]
12#[allow(clippy::pedantic)]
13#[allow(clippy::nursery)]
14#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
15pub struct DoubleFeatureType {}
16///
17/// The string feature type.
18#[allow(clippy::all)]
19#[allow(clippy::pedantic)]
20#[allow(clippy::nursery)]
21#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
22pub struct StringFeatureType {}
23#[allow(clippy::all)]
24#[allow(clippy::pedantic)]
25#[allow(clippy::nursery)]
26#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
27pub struct SizeRange {
28 #[prost(uint64, tag = "1")]
29 pub lower_bound: u64,
30 /// negative value means unbound otherwise upperbound is included in range
31 #[prost(int64, tag = "2")]
32 pub upper_bound: i64,
33}
34///
35/// The image feature type.
36#[allow(clippy::all)]
37#[allow(clippy::pedantic)]
38#[allow(clippy::nursery)]
39#[derive(Clone, PartialEq, ::prost::Message)]
40pub struct ImageFeatureType {
41 #[prost(int64, tag = "1")]
42 pub width: i64,
43 #[prost(int64, tag = "2")]
44 pub height: i64,
45 #[prost(enumeration = "image_feature_type::ColorSpace", tag = "3")]
46 pub color_space: i32,
47 #[prost(oneof = "image_feature_type::SizeFlexibility", tags = "21, 31")]
48 pub size_flexibility: ::core::option::Option<image_feature_type::SizeFlexibility>,
49}
50/// Nested message and enum types in `ImageFeatureType`.
51pub mod image_feature_type {
52 #[allow(clippy::all)]
53 #[allow(clippy::pedantic)]
54 #[allow(clippy::nursery)]
55 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
56 pub struct ImageSize {
57 #[prost(uint64, tag = "1")]
58 pub width: u64,
59 #[prost(uint64, tag = "2")]
60 pub height: u64,
61 }
62 #[allow(clippy::all)]
63 #[allow(clippy::pedantic)]
64 #[allow(clippy::nursery)]
65 #[derive(Clone, PartialEq, ::prost::Message)]
66 pub struct EnumeratedImageSizes {
67 #[prost(message, repeated, tag = "1")]
68 pub sizes: ::prost::alloc::vec::Vec<ImageSize>,
69 }
70 #[allow(clippy::all)]
71 #[allow(clippy::pedantic)]
72 #[allow(clippy::nursery)]
73 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
74 pub struct ImageSizeRange {
75 #[prost(message, optional, tag = "1")]
76 pub width_range: ::core::option::Option<super::SizeRange>,
77 #[prost(message, optional, tag = "2")]
78 pub height_range: ::core::option::Option<super::SizeRange>,
79 }
80 /// Assumes raw (decompressed) format
81 #[allow(clippy::all)]
82 #[allow(clippy::pedantic)]
83 #[allow(clippy::nursery)]
84 #[derive(
85 Clone,
86 Copy,
87 Debug,
88 PartialEq,
89 Eq,
90 Hash,
91 PartialOrd,
92 Ord,
93 ::prost::Enumeration
94 )]
95 #[repr(i32)]
96 pub enum ColorSpace {
97 InvalidColorSpace = 0,
98 /// 8 bits per pixel
99 Grayscale = 10,
100 /// 32 bits per pixel: RGBA with A channel ignored
101 Rgb = 20,
102 /// 32 bits per pixel: BGRA with A channel ignored
103 Bgr = 30,
104 /// 16 bits float per pixel
105 GrayscaleFloat16 = 40,
106 }
107 impl ColorSpace {
108 /// String value of the enum field names used in the ProtoBuf definition.
109 ///
110 /// The values are not transformed in any way and thus are considered stable
111 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
112 pub fn as_str_name(&self) -> &'static str {
113 match self {
114 Self::InvalidColorSpace => "INVALID_COLOR_SPACE",
115 Self::Grayscale => "GRAYSCALE",
116 Self::Rgb => "RGB",
117 Self::Bgr => "BGR",
118 Self::GrayscaleFloat16 => "GRAYSCALE_FLOAT16",
119 }
120 }
121 /// Creates an enum from field names used in the ProtoBuf definition.
122 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
123 match value {
124 "INVALID_COLOR_SPACE" => Some(Self::InvalidColorSpace),
125 "GRAYSCALE" => Some(Self::Grayscale),
126 "RGB" => Some(Self::Rgb),
127 "BGR" => Some(Self::Bgr),
128 "GRAYSCALE_FLOAT16" => Some(Self::GrayscaleFloat16),
129 _ => None,
130 }
131 }
132 }
133 #[allow(clippy::all)]
134 #[allow(clippy::pedantic)]
135 #[allow(clippy::nursery)]
136 #[derive(Clone, PartialEq, ::prost::Oneof)]
137 pub enum SizeFlexibility {
138 #[prost(message, tag = "21")]
139 EnumeratedSizes(EnumeratedImageSizes),
140 #[prost(message, tag = "31")]
141 ImageSizeRange(ImageSizeRange),
142 }
143}
144///
145/// The array feature type.
146#[allow(clippy::all)]
147#[allow(clippy::pedantic)]
148#[allow(clippy::nursery)]
149#[derive(Clone, PartialEq, ::prost::Message)]
150pub struct ArrayFeatureType {
151 #[prost(int64, repeated, tag = "1")]
152 pub shape: ::prost::alloc::vec::Vec<i64>,
153 #[prost(enumeration = "array_feature_type::ArrayDataType", tag = "2")]
154 pub data_type: i32,
155 #[prost(oneof = "array_feature_type::ShapeFlexibility", tags = "21, 31")]
156 pub shape_flexibility: ::core::option::Option<array_feature_type::ShapeFlexibility>,
157 #[prost(oneof = "array_feature_type::DefaultOptionalValue", tags = "41, 51, 61")]
158 pub default_optional_value: ::core::option::Option<
159 array_feature_type::DefaultOptionalValue,
160 >,
161}
162/// Nested message and enum types in `ArrayFeatureType`.
163pub mod array_feature_type {
164 #[allow(clippy::all)]
165 #[allow(clippy::pedantic)]
166 #[allow(clippy::nursery)]
167 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
168 pub struct Shape {
169 #[prost(int64, repeated, tag = "1")]
170 pub shape: ::prost::alloc::vec::Vec<i64>,
171 }
172 #[allow(clippy::all)]
173 #[allow(clippy::pedantic)]
174 #[allow(clippy::nursery)]
175 #[derive(Clone, PartialEq, ::prost::Message)]
176 pub struct EnumeratedShapes {
177 #[prost(message, repeated, tag = "1")]
178 pub shapes: ::prost::alloc::vec::Vec<Shape>,
179 }
180 #[allow(clippy::all)]
181 #[allow(clippy::pedantic)]
182 #[allow(clippy::nursery)]
183 #[derive(Clone, PartialEq, ::prost::Message)]
184 pub struct ShapeRange {
185 /// sizeRanges.size() must be length 1 or 3
186 /// sizeRanges\[d\] specifies the allowed range for dimension d
187 #[prost(message, repeated, tag = "1")]
188 pub size_ranges: ::prost::alloc::vec::Vec<super::SizeRange>,
189 }
190 #[allow(clippy::all)]
191 #[allow(clippy::pedantic)]
192 #[allow(clippy::nursery)]
193 #[derive(
194 Clone,
195 Copy,
196 Debug,
197 PartialEq,
198 Eq,
199 Hash,
200 PartialOrd,
201 Ord,
202 ::prost::Enumeration
203 )]
204 #[repr(i32)]
205 pub enum ArrayDataType {
206 InvalidArrayDataType = 0,
207 /// 0x10000 | 32
208 Float32 = 65568,
209 /// 0x10000 | 64
210 Double = 65600,
211 /// 0x20000 | 32
212 Int32 = 131104,
213 /// 0x20000 | 8
214 Int8 = 131080,
215 /// 0x10000 | 16
216 Float16 = 65552,
217 }
218 impl ArrayDataType {
219 /// String value of the enum field names used in the ProtoBuf definition.
220 ///
221 /// The values are not transformed in any way and thus are considered stable
222 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
223 pub fn as_str_name(&self) -> &'static str {
224 match self {
225 Self::InvalidArrayDataType => "INVALID_ARRAY_DATA_TYPE",
226 Self::Float32 => "FLOAT32",
227 Self::Double => "DOUBLE",
228 Self::Int32 => "INT32",
229 Self::Int8 => "INT8",
230 Self::Float16 => "FLOAT16",
231 }
232 }
233 /// Creates an enum from field names used in the ProtoBuf definition.
234 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
235 match value {
236 "INVALID_ARRAY_DATA_TYPE" => Some(Self::InvalidArrayDataType),
237 "FLOAT32" => Some(Self::Float32),
238 "DOUBLE" => Some(Self::Double),
239 "INT32" => Some(Self::Int32),
240 "INT8" => Some(Self::Int8),
241 "FLOAT16" => Some(Self::Float16),
242 _ => None,
243 }
244 }
245 }
246 #[allow(clippy::all)]
247 #[allow(clippy::pedantic)]
248 #[allow(clippy::nursery)]
249 #[derive(Clone, PartialEq, ::prost::Oneof)]
250 pub enum ShapeFlexibility {
251 #[prost(message, tag = "21")]
252 EnumeratedShapes(EnumeratedShapes),
253 #[prost(message, tag = "31")]
254 ShapeRange(ShapeRange),
255 }
256 #[allow(clippy::all)]
257 #[allow(clippy::pedantic)]
258 #[allow(clippy::nursery)]
259 #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
260 pub enum DefaultOptionalValue {
261 #[prost(int32, tag = "41")]
262 IntDefaultValue(i32),
263 #[prost(float, tag = "51")]
264 FloatDefaultValue(f32),
265 #[prost(double, tag = "61")]
266 DoubleDefaultValue(f64),
267 }
268}
269///
270/// The dictionary feature type.
271#[allow(clippy::all)]
272#[allow(clippy::pedantic)]
273#[allow(clippy::nursery)]
274#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
275pub struct DictionaryFeatureType {
276 ///
277 /// Key/value type tags, with the following restrictions:
278 /// - ``keyType`` must be a hashable type
279 /// - ``valueType`` is assumed to be a ``double``
280 #[prost(oneof = "dictionary_feature_type::KeyType", tags = "1, 2")]
281 pub key_type: ::core::option::Option<dictionary_feature_type::KeyType>,
282}
283/// Nested message and enum types in `DictionaryFeatureType`.
284pub mod dictionary_feature_type {
285 ///
286 /// Key/value type tags, with the following restrictions:
287 /// - ``keyType`` must be a hashable type
288 /// - ``valueType`` is assumed to be a ``double``
289 #[allow(clippy::all)]
290 #[allow(clippy::pedantic)]
291 #[allow(clippy::nursery)]
292 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
293 pub enum KeyType {
294 #[prost(message, tag = "1")]
295 Int64KeyType(super::Int64FeatureType),
296 #[prost(message, tag = "2")]
297 StringKeyType(super::StringFeatureType),
298 }
299}
300///
301/// The Sequence feature type.
302#[allow(clippy::all)]
303#[allow(clippy::pedantic)]
304#[allow(clippy::nursery)]
305#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
306pub struct SequenceFeatureType {
307 /// Range of allowed size/length/count of sequence
308 #[prost(message, optional, tag = "101")]
309 pub size_range: ::core::option::Option<SizeRange>,
310 ///
311 /// Currently only categorical int64 and String sequences are supported
312 #[prost(oneof = "sequence_feature_type::Type", tags = "1, 3")]
313 pub r#type: ::core::option::Option<sequence_feature_type::Type>,
314}
315/// Nested message and enum types in `SequenceFeatureType`.
316pub mod sequence_feature_type {
317 ///
318 /// Currently only categorical int64 and String sequences are supported
319 #[allow(clippy::all)]
320 #[allow(clippy::pedantic)]
321 #[allow(clippy::nursery)]
322 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
323 pub enum Type {
324 #[prost(message, tag = "1")]
325 Int64Type(super::Int64FeatureType),
326 #[prost(message, tag = "3")]
327 StringType(super::StringFeatureType),
328 }
329}
330#[allow(clippy::all)]
331#[allow(clippy::pedantic)]
332#[allow(clippy::nursery)]
333#[derive(Clone, PartialEq, ::prost::Message)]
334pub struct StateFeatureType {
335 #[prost(oneof = "state_feature_type::Type", tags = "1")]
336 pub r#type: ::core::option::Option<state_feature_type::Type>,
337}
338/// Nested message and enum types in `StateFeatureType`.
339pub mod state_feature_type {
340 #[allow(clippy::all)]
341 #[allow(clippy::pedantic)]
342 #[allow(clippy::nursery)]
343 #[derive(Clone, PartialEq, ::prost::Oneof)]
344 pub enum Type {
345 #[prost(message, tag = "1")]
346 ArrayType(super::ArrayFeatureType),
347 }
348}
349///
350/// A feature, which may be optional.
351#[allow(clippy::all)]
352#[allow(clippy::pedantic)]
353#[allow(clippy::nursery)]
354#[derive(Clone, PartialEq, ::prost::Message)]
355pub struct FeatureType {
356 #[prost(bool, tag = "1000")]
357 pub is_optional: bool,
358 #[prost(oneof = "feature_type::Type", tags = "1, 2, 3, 4, 5, 6, 7, 8")]
359 pub r#type: ::core::option::Option<feature_type::Type>,
360}
361/// Nested message and enum types in `FeatureType`.
362pub mod feature_type {
363 #[allow(clippy::all)]
364 #[allow(clippy::pedantic)]
365 #[allow(clippy::nursery)]
366 #[derive(Clone, PartialEq, ::prost::Oneof)]
367 pub enum Type {
368 #[prost(message, tag = "1")]
369 Int64Type(super::Int64FeatureType),
370 #[prost(message, tag = "2")]
371 DoubleType(super::DoubleFeatureType),
372 #[prost(message, tag = "3")]
373 StringType(super::StringFeatureType),
374 #[prost(message, tag = "4")]
375 ImageType(super::ImageFeatureType),
376 #[prost(message, tag = "5")]
377 MultiArrayType(super::ArrayFeatureType),
378 #[prost(message, tag = "6")]
379 DictionaryType(super::DictionaryFeatureType),
380 #[prost(message, tag = "7")]
381 SequenceType(super::SequenceFeatureType),
382 #[prost(message, tag = "8")]
383 StateType(super::StateFeatureType),
384 }
385}
386///
387/// A mapping from a string
388/// to a 64-bit integer.
389#[allow(clippy::all)]
390#[allow(clippy::pedantic)]
391#[allow(clippy::nursery)]
392#[derive(Clone, PartialEq, ::prost::Message)]
393pub struct StringToInt64Map {
394 #[prost(map = "string, int64", tag = "1")]
395 pub map: ::std::collections::HashMap<::prost::alloc::string::String, i64>,
396}
397///
398/// A mapping from a 64-bit integer
399/// to a string.
400#[allow(clippy::all)]
401#[allow(clippy::pedantic)]
402#[allow(clippy::nursery)]
403#[derive(Clone, PartialEq, ::prost::Message)]
404pub struct Int64ToStringMap {
405 #[prost(map = "int64, string", tag = "1")]
406 pub map: ::std::collections::HashMap<i64, ::prost::alloc::string::String>,
407}
408///
409/// A mapping from a string
410/// to a double-precision floating point number.
411#[allow(clippy::all)]
412#[allow(clippy::pedantic)]
413#[allow(clippy::nursery)]
414#[derive(Clone, PartialEq, ::prost::Message)]
415pub struct StringToDoubleMap {
416 #[prost(map = "string, double", tag = "1")]
417 pub map: ::std::collections::HashMap<::prost::alloc::string::String, f64>,
418}
419///
420/// A mapping from a 64-bit integer
421/// to a double-precision floating point number.
422#[allow(clippy::all)]
423#[allow(clippy::pedantic)]
424#[allow(clippy::nursery)]
425#[derive(Clone, PartialEq, ::prost::Message)]
426pub struct Int64ToDoubleMap {
427 #[prost(map = "int64, double", tag = "1")]
428 pub map: ::std::collections::HashMap<i64, f64>,
429}
430///
431/// A vector of strings.
432#[allow(clippy::all)]
433#[allow(clippy::pedantic)]
434#[allow(clippy::nursery)]
435#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
436pub struct StringVector {
437 #[prost(string, repeated, tag = "1")]
438 pub vector: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
439}
440///
441/// A vector of 64-bit integers.
442#[allow(clippy::all)]
443#[allow(clippy::pedantic)]
444#[allow(clippy::nursery)]
445#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
446pub struct Int64Vector {
447 #[prost(int64, repeated, tag = "1")]
448 pub vector: ::prost::alloc::vec::Vec<i64>,
449}
450///
451/// A vector of floating point numbers.
452#[allow(clippy::all)]
453#[allow(clippy::pedantic)]
454#[allow(clippy::nursery)]
455#[derive(Clone, PartialEq, ::prost::Message)]
456pub struct FloatVector {
457 #[prost(float, repeated, tag = "1")]
458 pub vector: ::prost::alloc::vec::Vec<f32>,
459}
460///
461/// A vector of double-precision floating point numbers.
462#[allow(clippy::all)]
463#[allow(clippy::pedantic)]
464#[allow(clippy::nursery)]
465#[derive(Clone, PartialEq, ::prost::Message)]
466pub struct DoubleVector {
467 #[prost(double, repeated, tag = "1")]
468 pub vector: ::prost::alloc::vec::Vec<f64>,
469}
470///
471/// A range of int64 values
472#[allow(clippy::all)]
473#[allow(clippy::pedantic)]
474#[allow(clippy::nursery)]
475#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
476pub struct Int64Range {
477 #[prost(int64, tag = "1")]
478 pub min_value: i64,
479 #[prost(int64, tag = "2")]
480 pub max_value: i64,
481}
482///
483/// A set of int64 values
484#[allow(clippy::all)]
485#[allow(clippy::pedantic)]
486#[allow(clippy::nursery)]
487#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
488pub struct Int64Set {
489 #[prost(int64, repeated, tag = "1")]
490 pub values: ::prost::alloc::vec::Vec<i64>,
491}
492///
493/// A range of double values
494#[allow(clippy::all)]
495#[allow(clippy::pedantic)]
496#[allow(clippy::nursery)]
497#[derive(Clone, Copy, PartialEq, ::prost::Message)]
498pub struct DoubleRange {
499 #[prost(double, tag = "1")]
500 pub min_value: f64,
501 #[prost(double, tag = "2")]
502 pub max_value: f64,
503}
504/// *
505/// Precision/Recall curve.
506///
507/// The syntax comprises two tables, one to look up the confidence value threshold
508/// for a given precision, and the other for a given recall.
509///
510/// Example:
511/// ----------------------+----+----+----+----+----+----+----+----+----
512/// precisionValues | .1 | .2 | .3 | .4 | .5 | .6 | .7 |
513/// precisionConfidence | .0 | .0 | .0 | .0 | .1 | .3 | .4 |
514/// ----------------------+----+----+----+----+----+----+----+----+----
515///
516/// ----------------------+----+----+----+----+----+----+----+----+----
517/// recallValues | .1 | .2 | .3 | .4 | .5 | .6 | .7 | .8 | .9
518/// recallConfidence | .7 | .6 | .5 | .4 | .3 | .3 | .2 | .1 | .0
519/// ----------------------+----+----+----+----+----+----+----+----+----
520///
521/// The application expects that, when it filters out samples with
522/// confidence threshold = 0.1, it gets precision = 0.5. Likewise,
523/// with threshold = 0.2 it gets recall = 0.7.
524///
525/// The table must have only valid values; do not use `NaN`, `+/- INF`,
526/// or negative values. The application is responsible for inter/extrapolating
527/// approprate confidence threshold based on the application's specific need.
528#[allow(clippy::all)]
529#[allow(clippy::pedantic)]
530#[allow(clippy::nursery)]
531#[derive(Clone, PartialEq, ::prost::Message)]
532pub struct PrecisionRecallCurve {
533 #[prost(message, optional, tag = "1")]
534 pub precision_values: ::core::option::Option<FloatVector>,
535 #[prost(message, optional, tag = "2")]
536 pub precision_confidence_thresholds: ::core::option::Option<FloatVector>,
537 #[prost(message, optional, tag = "3")]
538 pub recall_values: ::core::option::Option<FloatVector>,
539 #[prost(message, optional, tag = "4")]
540 pub recall_confidence_thresholds: ::core::option::Option<FloatVector>,
541}
542///
543/// A transformer that replaces missing values with a default value,
544/// such as a statistically-derived value.
545///
546/// If ``ReplaceValue`` is set, then missing values of that type are
547/// replaced with the corresponding value.
548///
549/// For example: if ``replaceDoubleValue`` is set to ``NaN``
550/// and a single ``NaN`` double value is provided as input,
551/// then it is replaced by ``imputedDoubleValue``. However
552/// if the input is an array of doubles, then any instances
553/// of ``NaN`` in the array is replaced with the corresponding
554/// value in ``imputedDoubleArray``.
555#[allow(clippy::all)]
556#[allow(clippy::pedantic)]
557#[allow(clippy::nursery)]
558#[derive(Clone, PartialEq, ::prost::Message)]
559pub struct Imputer {
560 #[prost(oneof = "imputer::ImputedValue", tags = "1, 2, 3, 4, 5, 6, 7")]
561 pub imputed_value: ::core::option::Option<imputer::ImputedValue>,
562 #[prost(oneof = "imputer::ReplaceValue", tags = "11, 12, 13")]
563 pub replace_value: ::core::option::Option<imputer::ReplaceValue>,
564}
565/// Nested message and enum types in `Imputer`.
566pub mod imputer {
567 #[allow(clippy::all)]
568 #[allow(clippy::pedantic)]
569 #[allow(clippy::nursery)]
570 #[derive(Clone, PartialEq, ::prost::Oneof)]
571 pub enum ImputedValue {
572 #[prost(double, tag = "1")]
573 ImputedDoubleValue(f64),
574 #[prost(int64, tag = "2")]
575 ImputedInt64Value(i64),
576 #[prost(string, tag = "3")]
577 ImputedStringValue(::prost::alloc::string::String),
578 #[prost(message, tag = "4")]
579 ImputedDoubleArray(super::DoubleVector),
580 #[prost(message, tag = "5")]
581 ImputedInt64Array(super::Int64Vector),
582 #[prost(message, tag = "6")]
583 ImputedStringDictionary(super::StringToDoubleMap),
584 #[prost(message, tag = "7")]
585 ImputedInt64Dictionary(super::Int64ToDoubleMap),
586 }
587 #[allow(clippy::all)]
588 #[allow(clippy::pedantic)]
589 #[allow(clippy::nursery)]
590 #[derive(Clone, PartialEq, ::prost::Oneof)]
591 pub enum ReplaceValue {
592 #[prost(double, tag = "11")]
593 ReplaceDoubleValue(f64),
594 #[prost(int64, tag = "12")]
595 ReplaceInt64Value(i64),
596 #[prost(string, tag = "13")]
597 ReplaceStringValue(::prost::alloc::string::String),
598 }
599}
600///
601/// Int64 parameter,
602/// consisting of a default int64 value, and allowed range or set of values
603/// value is unbounded if AllowedValues is not set.
604#[allow(clippy::all)]
605#[allow(clippy::pedantic)]
606#[allow(clippy::nursery)]
607#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
608pub struct Int64Parameter {
609 #[prost(int64, tag = "1")]
610 pub default_value: i64,
611 #[prost(oneof = "int64_parameter::AllowedValues", tags = "10, 11")]
612 pub allowed_values: ::core::option::Option<int64_parameter::AllowedValues>,
613}
614/// Nested message and enum types in `Int64Parameter`.
615pub mod int64_parameter {
616 #[allow(clippy::all)]
617 #[allow(clippy::pedantic)]
618 #[allow(clippy::nursery)]
619 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
620 pub enum AllowedValues {
621 #[prost(message, tag = "10")]
622 Range(super::Int64Range),
623 #[prost(message, tag = "11")]
624 Set(super::Int64Set),
625 }
626}
627///
628/// Double parameter,
629/// consisting of a default double value, and allowed range of values
630/// value is unbounded if AllowedValues is not set.
631#[allow(clippy::all)]
632#[allow(clippy::pedantic)]
633#[allow(clippy::nursery)]
634#[derive(Clone, Copy, PartialEq, ::prost::Message)]
635pub struct DoubleParameter {
636 #[prost(double, tag = "1")]
637 pub default_value: f64,
638 #[prost(oneof = "double_parameter::AllowedValues", tags = "10")]
639 pub allowed_values: ::core::option::Option<double_parameter::AllowedValues>,
640}
641/// Nested message and enum types in `DoubleParameter`.
642pub mod double_parameter {
643 #[allow(clippy::all)]
644 #[allow(clippy::pedantic)]
645 #[allow(clippy::nursery)]
646 #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
647 pub enum AllowedValues {
648 #[prost(message, tag = "10")]
649 Range(super::DoubleRange),
650 }
651}
652///
653/// String parameter,
654/// A default string value must be provided
655#[allow(clippy::all)]
656#[allow(clippy::pedantic)]
657#[allow(clippy::nursery)]
658#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
659pub struct StringParameter {
660 #[prost(string, tag = "1")]
661 pub default_value: ::prost::alloc::string::String,
662}
663///
664/// String parameter,
665/// A default bool value must be provided
666#[allow(clippy::all)]
667#[allow(clippy::pedantic)]
668#[allow(clippy::nursery)]
669#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
670pub struct BoolParameter {
671 #[prost(bool, tag = "1")]
672 pub default_value: bool,
673}
674///
675/// A neural network.
676#[allow(clippy::all)]
677#[allow(clippy::pedantic)]
678#[allow(clippy::nursery)]
679#[derive(Clone, PartialEq, ::prost::Message)]
680pub struct NeuralNetwork {
681 #[prost(message, repeated, tag = "1")]
682 pub layers: ::prost::alloc::vec::Vec<NeuralNetworkLayer>,
683 #[prost(message, repeated, tag = "2")]
684 pub preprocessing: ::prost::alloc::vec::Vec<NeuralNetworkPreprocessing>,
685 /// use this enum value to determine the input tensor shapes to the neural network, for multiarray inputs
686 #[prost(enumeration = "NeuralNetworkMultiArrayShapeMapping", tag = "5")]
687 pub array_input_shape_mapping: i32,
688 /// use this enum value to determine the input tensor shapes to the neural network, for image inputs
689 #[prost(enumeration = "NeuralNetworkImageShapeMapping", tag = "6")]
690 pub image_input_shape_mapping: i32,
691 #[prost(message, optional, tag = "10")]
692 pub update_params: ::core::option::Option<NetworkUpdateParameters>,
693}
694///
695/// A neural network preprocessor that
696/// performs a scalar multiplication of an image
697/// followed by addition of scalar biases to the channels.
698///
699/// Input: X
700/// An image in BGR or RGB format with shape ``\[3, H, W\]``
701/// or in grayscale format with shape ``\[1, H, W\]``.
702/// Output: Y
703/// An image with format and shape corresponding to the input.
704///
705/// If the input image is in BGR format:
706///
707/// .. code::
708///
709/// Y\[0, :, :\] = channelScale * X\[0, :, :\] + blueBias
710/// Y\[1, :, :\] = channelScale * X\[1, :, :\] + greenBias
711/// Y\[2, :, :\] = channelScale * X\[2, :, :\] + redBias
712///
713/// If the input image is in RGB format:
714///
715/// .. code::
716///
717/// Y\[0, :, :\] = channelScale * X\[0, :, :\] + redBias
718/// Y\[1, :, :\] = channelScale * X\[1, :, :\] + greenBias
719/// Y\[2, :, :\] = channelScale * X\[2, :, :\] + blueBias
720///
721/// If the input image is in grayscale format:
722///
723/// .. code::
724///
725/// Y\[0, :, :\] = channelScale * X\[0, :, :\] + grayBias
726#[allow(clippy::all)]
727#[allow(clippy::pedantic)]
728#[allow(clippy::nursery)]
729#[derive(Clone, Copy, PartialEq, ::prost::Message)]
730pub struct NeuralNetworkImageScaler {
731 /// Scalar to be multiplied.
732 #[prost(float, tag = "10")]
733 pub channel_scale: f32,
734 /// Scalar blue bias to be added.
735 #[prost(float, tag = "20")]
736 pub blue_bias: f32,
737 /// Scalar green bias to be added.
738 #[prost(float, tag = "21")]
739 pub green_bias: f32,
740 /// Scalar red bias to be added.
741 #[prost(float, tag = "22")]
742 pub red_bias: f32,
743 /// Scalar bias to be added for grayscale images.
744 #[prost(float, tag = "30")]
745 pub gray_bias: f32,
746}
747///
748/// A neural network preprocessor that
749/// subtracts the provided mean image from the input image.
750/// The mean image is subtracted from the input named
751/// ``NeuralNetworkPreprocessing.featureName``.
752#[allow(clippy::all)]
753#[allow(clippy::pedantic)]
754#[allow(clippy::nursery)]
755#[derive(Clone, PartialEq, ::prost::Message)]
756pub struct NeuralNetworkMeanImage {
757 ///
758 /// Mean image stored as a flattened array of floats,
759 /// representing shape \[Channel,Height,Width\].
760 #[prost(float, repeated, tag = "1")]
761 pub mean_image: ::prost::alloc::vec::Vec<f32>,
762}
763/// Preprocessing parameters for image inputs.
764#[allow(clippy::all)]
765#[allow(clippy::pedantic)]
766#[allow(clippy::nursery)]
767#[derive(Clone, PartialEq, ::prost::Message)]
768pub struct NeuralNetworkPreprocessing {
769 /// must be equal to the input name to which the preprocessing is applied
770 #[prost(string, tag = "1")]
771 pub feature_name: ::prost::alloc::string::String,
772 #[prost(oneof = "neural_network_preprocessing::Preprocessor", tags = "10, 11")]
773 pub preprocessor: ::core::option::Option<neural_network_preprocessing::Preprocessor>,
774}
775/// Nested message and enum types in `NeuralNetworkPreprocessing`.
776pub mod neural_network_preprocessing {
777 #[allow(clippy::all)]
778 #[allow(clippy::pedantic)]
779 #[allow(clippy::nursery)]
780 #[derive(Clone, PartialEq, ::prost::Oneof)]
781 pub enum Preprocessor {
782 #[prost(message, tag = "10")]
783 Scaler(super::NeuralNetworkImageScaler),
784 #[prost(message, tag = "11")]
785 MeanImage(super::NeuralNetworkMeanImage),
786 }
787}
788///
789/// A rectified linear unit (ReLU) activation function.
790///
791/// This function has the following formula:
792///
793/// .. math::
794/// f(x) = \text{max}(0, x)
795#[allow(clippy::all)]
796#[allow(clippy::pedantic)]
797#[allow(clippy::nursery)]
798#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
799pub struct ActivationReLu {}
800///
801/// A leaky rectified linear unit (ReLU) activation function.
802///
803/// This function has the following formula:
804///
805/// .. math::
806/// f(x) = \begin{cases}
807/// x & \text{if } x \geq 0 \\
808/// \alpha x & \text{if } x < 0
809/// \end{cases}
810#[allow(clippy::all)]
811#[allow(clippy::pedantic)]
812#[allow(clippy::nursery)]
813#[derive(Clone, Copy, PartialEq, ::prost::Message)]
814pub struct ActivationLeakyReLu {
815 /// negative slope value for leakyReLU
816 #[prost(float, tag = "1")]
817 pub alpha: f32,
818}
819///
820/// A hyperbolic tangent activation function.
821///
822/// This function has the following formula:
823///
824/// .. math::
825/// f(x) = \dfrac{1 - e^{-2x}}{1 + e^{-2x}}
826#[allow(clippy::all)]
827#[allow(clippy::pedantic)]
828#[allow(clippy::nursery)]
829#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
830pub struct ActivationTanh {}
831///
832/// A scaled hyperbolic tangent activation function.
833///
834/// This function has the following formula:
835///
836/// .. math::
837/// f(x) = \alpha \tanh(\beta x)
838#[allow(clippy::all)]
839#[allow(clippy::pedantic)]
840#[allow(clippy::nursery)]
841#[derive(Clone, Copy, PartialEq, ::prost::Message)]
842pub struct ActivationScaledTanh {
843 #[prost(float, tag = "1")]
844 pub alpha: f32,
845 #[prost(float, tag = "2")]
846 pub beta: f32,
847}
848///
849/// A sigmoid activation function.
850///
851/// This function has the following formula:
852///
853/// .. math::
854/// f(x) = \dfrac{1}{1 + e^{-x}}
855#[allow(clippy::all)]
856#[allow(clippy::pedantic)]
857#[allow(clippy::nursery)]
858#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
859pub struct ActivationSigmoid {}
860///
861/// A linear activation function.
862///
863/// This function has the following formula:
864///
865/// .. math::
866/// f(x) = \alpha x + \beta
867#[allow(clippy::all)]
868#[allow(clippy::pedantic)]
869#[allow(clippy::nursery)]
870#[derive(Clone, Copy, PartialEq, ::prost::Message)]
871pub struct ActivationLinear {
872 #[prost(float, tag = "1")]
873 pub alpha: f32,
874 #[prost(float, tag = "2")]
875 pub beta: f32,
876}
877///
878/// A hard sigmoid activation function.
879///
880/// This function has the following formula:
881///
882/// .. math::
883/// f(x) = \text{min}(\text{max}(\alpha x + \beta, 0), 1)
884#[allow(clippy::all)]
885#[allow(clippy::pedantic)]
886#[allow(clippy::nursery)]
887#[derive(Clone, Copy, PartialEq, ::prost::Message)]
888pub struct ActivationSigmoidHard {
889 #[prost(float, tag = "1")]
890 pub alpha: f32,
891 #[prost(float, tag = "2")]
892 pub beta: f32,
893}
894///
895/// A parameterized rectified linear unit (PReLU) activation function.
896/// Input must be at least rank 3. Axis = -3 is denoted by "C", or channels.
897/// "alpha" parameter can be a vector of length C.
898///
899/// This function has the following formula:
900///
901/// .. math::
902/// f(x_i) = \begin{cases}
903/// x_i & \text{if } x_i \geq 0 \\
904/// \alpha_i x_i & \text{if } x_i < 0
905/// \end{cases} \;,\;i=1,...,C
906#[allow(clippy::all)]
907#[allow(clippy::pedantic)]
908#[allow(clippy::nursery)]
909#[derive(Clone, PartialEq, ::prost::Message)]
910pub struct ActivationPReLu {
911 /// parameter of length C or 1.
912 /// If length is 1, same value is used for all channels
913 #[prost(message, optional, tag = "1")]
914 pub alpha: ::core::option::Option<WeightParams>,
915}
916///
917/// An exponential linear unit (ELU) activation function.
918///
919/// This function has the following formula:
920///
921/// .. math::
922/// f(x) = \begin{cases}
923/// x & \text{if } x \geq 0 \\
924/// \alpha (e^x - 1) & \text{if } x < 0
925/// \end{cases}
926#[allow(clippy::all)]
927#[allow(clippy::pedantic)]
928#[allow(clippy::nursery)]
929#[derive(Clone, Copy, PartialEq, ::prost::Message)]
930pub struct ActivationElu {
931 #[prost(float, tag = "1")]
932 pub alpha: f32,
933}
934///
935/// A thresholded rectified linear unit (ReLU) activation function.
936///
937/// This function has the following formula:
938///
939/// .. math::
940/// f(x) = \begin{cases}
941/// x & \text{if } x \geq \alpha \\
942/// 0 & \text{if } x < \alpha
943/// \end{cases}
944#[allow(clippy::all)]
945#[allow(clippy::pedantic)]
946#[allow(clippy::nursery)]
947#[derive(Clone, Copy, PartialEq, ::prost::Message)]
948pub struct ActivationThresholdedReLu {
949 #[prost(float, tag = "1")]
950 pub alpha: f32,
951}
952///
953/// A softsign activation function.
954///
955/// This function has the following formula:
956///
957/// .. math::
958/// f(x) = \dfrac{x}{1 + |x|}
959#[allow(clippy::all)]
960#[allow(clippy::pedantic)]
961#[allow(clippy::nursery)]
962#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
963pub struct ActivationSoftsign {}
964///
965/// A softplus activation function.
966///
967/// This function has the following formula:
968///
969/// .. math::
970/// f(x) = \text{log}(1 + e^x)
971#[allow(clippy::all)]
972#[allow(clippy::pedantic)]
973#[allow(clippy::nursery)]
974#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
975pub struct ActivationSoftplus {}
976///
977/// A parametric softplus activation function.
978/// Input must be at least rank 3. axis = -3 is denoted by "C", or channels.
979/// "alpha"/"beta" parameter can be a vector of length C.
980///
981/// This function has the following formula:
982///
983/// .. math::
984/// f(x_i) = \alpha_i \text{log}(1 + e^{\beta_i x_i}) \;,\;i=1,...,C
985#[allow(clippy::all)]
986#[allow(clippy::pedantic)]
987#[allow(clippy::nursery)]
988#[derive(Clone, PartialEq, ::prost::Message)]
989pub struct ActivationParametricSoftplus {
990 /// If length is 1, same value is used for all channels
991 ///
992 /// parameter of length C or 1
993 #[prost(message, optional, tag = "1")]
994 pub alpha: ::core::option::Option<WeightParams>,
995 /// parameter of length C or 1
996 #[prost(message, optional, tag = "2")]
997 pub beta: ::core::option::Option<WeightParams>,
998}
999#[allow(clippy::all)]
1000#[allow(clippy::pedantic)]
1001#[allow(clippy::nursery)]
1002#[derive(Clone, PartialEq, ::prost::Message)]
1003pub struct ActivationParams {
1004 #[prost(
1005 oneof = "activation_params::NonlinearityType",
1006 tags = "5, 10, 15, 20, 25, 30, 31, 40, 41, 50, 60, 70, 71"
1007 )]
1008 pub nonlinearity_type: ::core::option::Option<activation_params::NonlinearityType>,
1009}
1010/// Nested message and enum types in `ActivationParams`.
1011pub mod activation_params {
1012 #[allow(clippy::all)]
1013 #[allow(clippy::pedantic)]
1014 #[allow(clippy::nursery)]
1015 #[derive(Clone, PartialEq, ::prost::Oneof)]
1016 pub enum NonlinearityType {
1017 #[prost(message, tag = "5")]
1018 Linear(super::ActivationLinear),
1019 #[prost(message, tag = "10")]
1020 ReLu(super::ActivationReLu),
1021 #[prost(message, tag = "15")]
1022 LeakyReLu(super::ActivationLeakyReLu),
1023 #[prost(message, tag = "20")]
1024 ThresholdedReLu(super::ActivationThresholdedReLu),
1025 #[prost(message, tag = "25")]
1026 PReLu(super::ActivationPReLu),
1027 #[prost(message, tag = "30")]
1028 Tanh(super::ActivationTanh),
1029 #[prost(message, tag = "31")]
1030 ScaledTanh(super::ActivationScaledTanh),
1031 #[prost(message, tag = "40")]
1032 Sigmoid(super::ActivationSigmoid),
1033 #[prost(message, tag = "41")]
1034 SigmoidHard(super::ActivationSigmoidHard),
1035 #[prost(message, tag = "50")]
1036 Elu(super::ActivationElu),
1037 #[prost(message, tag = "60")]
1038 Softsign(super::ActivationSoftsign),
1039 #[prost(message, tag = "70")]
1040 Softplus(super::ActivationSoftplus),
1041 #[prost(message, tag = "71")]
1042 ParametricSoftplus(super::ActivationParametricSoftplus),
1043 }
1044}
1045///
1046/// Representation of the intermediate tensors
1047#[allow(clippy::all)]
1048#[allow(clippy::pedantic)]
1049#[allow(clippy::nursery)]
1050#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
1051pub struct Tensor {
1052 /// Number of dimensions in the tensor shape
1053 #[prost(uint32, tag = "1")]
1054 pub rank: u32,
1055 /// actual value of the tensor shape.
1056 /// must be of length "rank". Can contain -1s for unknown dimensions.
1057 #[prost(int64, repeated, tag = "2")]
1058 pub dim_value: ::prost::alloc::vec::Vec<i64>,
1059}
1060///
1061/// A single neural network layer.
1062#[allow(clippy::all)]
1063#[allow(clippy::pedantic)]
1064#[allow(clippy::nursery)]
1065#[derive(Clone, PartialEq, ::prost::Message)]
1066pub struct NeuralNetworkLayer {
1067 /// descriptive name of the layer
1068 #[prost(string, tag = "1")]
1069 pub name: ::prost::alloc::string::String,
1070 #[prost(string, repeated, tag = "2")]
1071 pub input: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1072 #[prost(string, repeated, tag = "3")]
1073 pub output: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
1074 /// must be the same length as the "input" field
1075 #[prost(message, repeated, tag = "4")]
1076 pub input_tensor: ::prost::alloc::vec::Vec<Tensor>,
1077 /// must be the same length as the "output" field
1078 #[prost(message, repeated, tag = "5")]
1079 pub output_tensor: ::prost::alloc::vec::Vec<Tensor>,
1080 /// Must be set to true to mark the layer as updatable.
1081 /// If true, the weightParams in the layer's properties must also be set to updatable
1082 /// If false, the value of the isUpdatable parameter within the layer's weights are ignored
1083 #[prost(bool, tag = "10")]
1084 pub is_updatable: bool,
1085 #[prost(
1086 oneof = "neural_network_layer::Layer",
1087 tags = "100, 120, 130, 140, 150, 160, 165, 170, 175, 180, 190, 200, 210, 211, 212, 220, 230, 231, 240, 245, 250, 260, 261, 270, 280, 290, 300, 301, 310, 320, 330, 340, 345, 350, 400, 410, 420, 430, 500, 600, 605, 615, 620, 625, 635, 640, 660, 665, 670, 680, 685, 700, 710, 715, 720, 730, 735, 740, 750, 755, 760, 770, 775, 780, 790, 795, 815, 820, 825, 827, 830, 832, 840, 845, 850, 855, 865, 870, 875, 880, 885, 890, 895, 900, 905, 920, 925, 930, 935, 940, 945, 950, 952, 954, 960, 965, 975, 980, 985, 995, 1000, 1005, 1015, 1020, 1025, 1040, 1045, 1065, 1070, 1080, 1085, 1090, 1100, 1105, 1110, 1120, 1125, 1130, 1135, 1140, 1145, 1150, 1155, 1170, 1175, 1180, 1190, 1195, 1200, 1210, 1215, 1220, 1230, 1250, 1255, 1260, 1265, 1270, 1275, 1280, 1285, 1290, 1295, 1313, 1315, 1320, 1325, 1330, 1350, 1400, 1450, 1455, 1460, 1461, 1465, 1466, 1470, 1471"
1088 )]
1089 pub layer: ::core::option::Option<neural_network_layer::Layer>,
1090}
1091/// Nested message and enum types in `NeuralNetworkLayer`.
1092pub mod neural_network_layer {
1093 #[allow(clippy::all)]
1094 #[allow(clippy::pedantic)]
1095 #[allow(clippy::nursery)]
1096 #[derive(Clone, PartialEq, ::prost::Oneof)]
1097 pub enum Layer {
1098 /// Start at 100 here
1099 #[prost(message, tag = "100")]
1100 Convolution(super::ConvolutionLayerParams),
1101 #[prost(message, tag = "120")]
1102 Pooling(super::PoolingLayerParams),
1103 #[prost(message, tag = "130")]
1104 Activation(super::ActivationParams),
1105 #[prost(message, tag = "140")]
1106 InnerProduct(super::InnerProductLayerParams),
1107 #[prost(message, tag = "150")]
1108 Embedding(super::EmbeddingLayerParams),
1109 /// Normalization-related Layers
1110 #[prost(message, tag = "160")]
1111 Batchnorm(super::BatchnormLayerParams),
1112 #[prost(message, tag = "165")]
1113 Mvn(super::MeanVarianceNormalizeLayerParams),
1114 #[prost(message, tag = "170")]
1115 L2normalize(super::L2NormalizeLayerParams),
1116 #[prost(message, tag = "175")]
1117 Softmax(super::SoftmaxLayerParams),
1118 #[prost(message, tag = "180")]
1119 Lrn(super::LrnLayerParams),
1120 #[prost(message, tag = "190")]
1121 Crop(super::CropLayerParams),
1122 #[prost(message, tag = "200")]
1123 Padding(super::PaddingLayerParams),
1124 #[prost(message, tag = "210")]
1125 Upsample(super::UpsampleLayerParams),
1126 #[prost(message, tag = "211")]
1127 ResizeBilinear(super::ResizeBilinearLayerParams),
1128 #[prost(message, tag = "212")]
1129 CropResize(super::CropResizeLayerParams),
1130 #[prost(message, tag = "220")]
1131 Unary(super::UnaryFunctionLayerParams),
1132 /// Element-wise Operations
1133 #[prost(message, tag = "230")]
1134 Add(super::AddLayerParams),
1135 #[prost(message, tag = "231")]
1136 Multiply(super::MultiplyLayerParams),
1137 #[prost(message, tag = "240")]
1138 Average(super::AverageLayerParams),
1139 #[prost(message, tag = "245")]
1140 Scale(super::ScaleLayerParams),
1141 #[prost(message, tag = "250")]
1142 Bias(super::BiasLayerParams),
1143 #[prost(message, tag = "260")]
1144 Max(super::MaxLayerParams),
1145 #[prost(message, tag = "261")]
1146 Min(super::MinLayerParams),
1147 #[prost(message, tag = "270")]
1148 Dot(super::DotProductLayerParams),
1149 #[prost(message, tag = "280")]
1150 Reduce(super::ReduceLayerParams),
1151 #[prost(message, tag = "290")]
1152 LoadConstant(super::LoadConstantLayerParams),
1153 /// Data Reorganization
1154 #[prost(message, tag = "300")]
1155 Reshape(super::ReshapeLayerParams),
1156 #[prost(message, tag = "301")]
1157 Flatten(super::FlattenLayerParams),
1158 #[prost(message, tag = "310")]
1159 Permute(super::PermuteLayerParams),
1160 #[prost(message, tag = "320")]
1161 Concat(super::ConcatLayerParams),
1162 #[prost(message, tag = "330")]
1163 Split(super::SplitLayerParams),
1164 #[prost(message, tag = "340")]
1165 SequenceRepeat(super::SequenceRepeatLayerParams),
1166 #[prost(message, tag = "345")]
1167 ReorganizeData(super::ReorganizeDataLayerParams),
1168 #[prost(message, tag = "350")]
1169 Slice(super::SliceLayerParams),
1170 /// Recurrent Layers
1171 #[prost(message, tag = "400")]
1172 SimpleRecurrent(super::SimpleRecurrentLayerParams),
1173 #[prost(message, tag = "410")]
1174 Gru(super::GruLayerParams),
1175 #[prost(message, tag = "420")]
1176 UniDirectionalLstm(super::UniDirectionalLstmLayerParams),
1177 #[prost(message, tag = "430")]
1178 BiDirectionalLstm(super::BiDirectionalLstmLayerParams),
1179 /// Custom (user-implemented) Layer
1180 #[prost(message, tag = "500")]
1181 Custom(super::CustomLayerParams),
1182 /// Control Flow related Layers
1183 #[prost(message, tag = "600")]
1184 Copy(super::CopyLayerParams),
1185 #[prost(message, tag = "605")]
1186 Branch(super::BranchLayerParams),
1187 #[prost(message, tag = "615")]
1188 Loop(super::LoopLayerParams),
1189 #[prost(message, tag = "620")]
1190 LoopBreak(super::LoopBreakLayerParams),
1191 #[prost(message, tag = "625")]
1192 LoopContinue(super::LoopContinueLayerParams),
1193 #[prost(message, tag = "635")]
1194 RangeStatic(super::RangeStaticLayerParams),
1195 #[prost(message, tag = "640")]
1196 RangeDynamic(super::RangeDynamicLayerParams),
1197 /// Element-wise Unary Layers
1198 #[prost(message, tag = "660")]
1199 Clip(super::ClipLayerParams),
1200 #[prost(message, tag = "665")]
1201 Ceil(super::CeilLayerParams),
1202 #[prost(message, tag = "670")]
1203 Floor(super::FloorLayerParams),
1204 #[prost(message, tag = "680")]
1205 Sign(super::SignLayerParams),
1206 #[prost(message, tag = "685")]
1207 Round(super::RoundLayerParams),
1208 #[prost(message, tag = "700")]
1209 Exp2(super::Exp2LayerParams),
1210 #[prost(message, tag = "710")]
1211 Sin(super::SinLayerParams),
1212 #[prost(message, tag = "715")]
1213 Cos(super::CosLayerParams),
1214 #[prost(message, tag = "720")]
1215 Tan(super::TanLayerParams),
1216 #[prost(message, tag = "730")]
1217 Asin(super::AsinLayerParams),
1218 #[prost(message, tag = "735")]
1219 Acos(super::AcosLayerParams),
1220 #[prost(message, tag = "740")]
1221 Atan(super::AtanLayerParams),
1222 #[prost(message, tag = "750")]
1223 Sinh(super::SinhLayerParams),
1224 #[prost(message, tag = "755")]
1225 Cosh(super::CoshLayerParams),
1226 #[prost(message, tag = "760")]
1227 Tanh(super::TanhLayerParams),
1228 #[prost(message, tag = "770")]
1229 Asinh(super::AsinhLayerParams),
1230 #[prost(message, tag = "775")]
1231 Acosh(super::AcoshLayerParams),
1232 #[prost(message, tag = "780")]
1233 Atanh(super::AtanhLayerParams),
1234 #[prost(message, tag = "790")]
1235 Erf(super::ErfLayerParams),
1236 #[prost(message, tag = "795")]
1237 Gelu(super::GeluLayerParams),
1238 /// Element-wise Binary with Broadcasting Support
1239 #[prost(message, tag = "815")]
1240 Equal(super::EqualLayerParams),
1241 #[prost(message, tag = "820")]
1242 NotEqual(super::NotEqualLayerParams),
1243 #[prost(message, tag = "825")]
1244 LessThan(super::LessThanLayerParams),
1245 #[prost(message, tag = "827")]
1246 LessEqual(super::LessEqualLayerParams),
1247 #[prost(message, tag = "830")]
1248 GreaterThan(super::GreaterThanLayerParams),
1249 #[prost(message, tag = "832")]
1250 GreaterEqual(super::GreaterEqualLayerParams),
1251 #[prost(message, tag = "840")]
1252 LogicalOr(super::LogicalOrLayerParams),
1253 #[prost(message, tag = "845")]
1254 LogicalXor(super::LogicalXorLayerParams),
1255 #[prost(message, tag = "850")]
1256 LogicalNot(super::LogicalNotLayerParams),
1257 #[prost(message, tag = "855")]
1258 LogicalAnd(super::LogicalAndLayerParams),
1259 #[prost(message, tag = "865")]
1260 ModBroadcastable(super::ModBroadcastableLayerParams),
1261 #[prost(message, tag = "870")]
1262 MinBroadcastable(super::MinBroadcastableLayerParams),
1263 #[prost(message, tag = "875")]
1264 MaxBroadcastable(super::MaxBroadcastableLayerParams),
1265 #[prost(message, tag = "880")]
1266 AddBroadcastable(super::AddBroadcastableLayerParams),
1267 #[prost(message, tag = "885")]
1268 PowBroadcastable(super::PowBroadcastableLayerParams),
1269 #[prost(message, tag = "890")]
1270 DivideBroadcastable(super::DivideBroadcastableLayerParams),
1271 #[prost(message, tag = "895")]
1272 FloorDivBroadcastable(super::FloorDivBroadcastableLayerParams),
1273 #[prost(message, tag = "900")]
1274 MultiplyBroadcastable(super::MultiplyBroadcastableLayerParams),
1275 #[prost(message, tag = "905")]
1276 SubtractBroadcastable(super::SubtractBroadcastableLayerParams),
1277 /// Tensor Manipulations
1278 #[prost(message, tag = "920")]
1279 Tile(super::TileLayerParams),
1280 #[prost(message, tag = "925")]
1281 Stack(super::StackLayerParams),
1282 #[prost(message, tag = "930")]
1283 Gather(super::GatherLayerParams),
1284 #[prost(message, tag = "935")]
1285 Scatter(super::ScatterLayerParams),
1286 #[prost(message, tag = "940")]
1287 GatherNd(super::GatherNdLayerParams),
1288 #[prost(message, tag = "945")]
1289 ScatterNd(super::ScatterNdLayerParams),
1290 #[prost(message, tag = "950")]
1291 SoftmaxNd(super::SoftmaxNdLayerParams),
1292 #[prost(message, tag = "952")]
1293 GatherAlongAxis(super::GatherAlongAxisLayerParams),
1294 #[prost(message, tag = "954")]
1295 ScatterAlongAxis(super::ScatterAlongAxisLayerParams),
1296 #[prost(message, tag = "960")]
1297 Reverse(super::ReverseLayerParams),
1298 #[prost(message, tag = "965")]
1299 ReverseSeq(super::ReverseSeqLayerParams),
1300 #[prost(message, tag = "975")]
1301 SplitNd(super::SplitNdLayerParams),
1302 #[prost(message, tag = "980")]
1303 ConcatNd(super::ConcatNdLayerParams),
1304 #[prost(message, tag = "985")]
1305 Transpose(super::TransposeLayerParams),
1306 #[prost(message, tag = "995")]
1307 SliceStatic(super::SliceStaticLayerParams),
1308 #[prost(message, tag = "1000")]
1309 SliceDynamic(super::SliceDynamicLayerParams),
1310 #[prost(message, tag = "1005")]
1311 SlidingWindows(super::SlidingWindowsLayerParams),
1312 #[prost(message, tag = "1015")]
1313 TopK(super::TopKLayerParams),
1314 #[prost(message, tag = "1020")]
1315 ArgMin(super::ArgMinLayerParams),
1316 #[prost(message, tag = "1025")]
1317 ArgMax(super::ArgMaxLayerParams),
1318 #[prost(message, tag = "1040")]
1319 EmbeddingNd(super::EmbeddingNdLayerParams),
1320 #[prost(message, tag = "1045")]
1321 BatchedMatmul(super::BatchedMatMulLayerParams),
1322 /// Tensor Allocation / Reshape-related Operations
1323 #[prost(message, tag = "1065")]
1324 GetShape(super::GetShapeLayerParams),
1325 #[prost(message, tag = "1070")]
1326 LoadConstantNd(super::LoadConstantNdLayerParams),
1327 #[prost(message, tag = "1080")]
1328 FillLike(super::FillLikeLayerParams),
1329 #[prost(message, tag = "1085")]
1330 FillStatic(super::FillStaticLayerParams),
1331 #[prost(message, tag = "1090")]
1332 FillDynamic(super::FillDynamicLayerParams),
1333 #[prost(message, tag = "1100")]
1334 BroadcastToLike(super::BroadcastToLikeLayerParams),
1335 #[prost(message, tag = "1105")]
1336 BroadcastToStatic(super::BroadcastToStaticLayerParams),
1337 #[prost(message, tag = "1110")]
1338 BroadcastToDynamic(super::BroadcastToDynamicLayerParams),
1339 #[prost(message, tag = "1120")]
1340 Squeeze(super::SqueezeLayerParams),
1341 #[prost(message, tag = "1125")]
1342 ExpandDims(super::ExpandDimsLayerParams),
1343 #[prost(message, tag = "1130")]
1344 FlattenTo2D(super::FlattenTo2DLayerParams),
1345 #[prost(message, tag = "1135")]
1346 ReshapeLike(super::ReshapeLikeLayerParams),
1347 #[prost(message, tag = "1140")]
1348 ReshapeStatic(super::ReshapeStaticLayerParams),
1349 #[prost(message, tag = "1145")]
1350 ReshapeDynamic(super::ReshapeDynamicLayerParams),
1351 #[prost(message, tag = "1150")]
1352 RankPreservingReshape(super::RankPreservingReshapeLayerParams),
1353 #[prost(message, tag = "1155")]
1354 ConstantPad(super::ConstantPaddingLayerParams),
1355 /// Random Distributions
1356 #[prost(message, tag = "1170")]
1357 RandomNormalLike(super::RandomNormalLikeLayerParams),
1358 #[prost(message, tag = "1175")]
1359 RandomNormalStatic(super::RandomNormalStaticLayerParams),
1360 #[prost(message, tag = "1180")]
1361 RandomNormalDynamic(super::RandomNormalDynamicLayerParams),
1362 #[prost(message, tag = "1190")]
1363 RandomUniformLike(super::RandomUniformLikeLayerParams),
1364 #[prost(message, tag = "1195")]
1365 RandomUniformStatic(super::RandomUniformStaticLayerParams),
1366 #[prost(message, tag = "1200")]
1367 RandomUniformDynamic(super::RandomUniformDynamicLayerParams),
1368 #[prost(message, tag = "1210")]
1369 RandomBernoulliLike(super::RandomBernoulliLikeLayerParams),
1370 #[prost(message, tag = "1215")]
1371 RandomBernoulliStatic(super::RandomBernoulliStaticLayerParams),
1372 #[prost(message, tag = "1220")]
1373 RandomBernoulliDynamic(super::RandomBernoulliDynamicLayerParams),
1374 #[prost(message, tag = "1230")]
1375 CategoricalDistribution(super::CategoricalDistributionLayerParams),
1376 /// Reduction-related Layers:
1377 #[prost(message, tag = "1250")]
1378 ReduceL1(super::ReduceL1LayerParams),
1379 #[prost(message, tag = "1255")]
1380 ReduceL2(super::ReduceL2LayerParams),
1381 #[prost(message, tag = "1260")]
1382 ReduceMax(super::ReduceMaxLayerParams),
1383 #[prost(message, tag = "1265")]
1384 ReduceMin(super::ReduceMinLayerParams),
1385 #[prost(message, tag = "1270")]
1386 ReduceSum(super::ReduceSumLayerParams),
1387 #[prost(message, tag = "1275")]
1388 ReduceProd(super::ReduceProdLayerParams),
1389 #[prost(message, tag = "1280")]
1390 ReduceMean(super::ReduceMeanLayerParams),
1391 #[prost(message, tag = "1285")]
1392 ReduceLogSum(super::ReduceLogSumLayerParams),
1393 #[prost(message, tag = "1290")]
1394 ReduceSumSquare(super::ReduceSumSquareLayerParams),
1395 #[prost(message, tag = "1295")]
1396 ReduceLogSumExp(super::ReduceLogSumExpLayerParams),
1397 /// Masking / Selection Layers
1398 #[prost(message, tag = "1313")]
1399 WhereNonZero(super::WhereNonZeroLayerParams),
1400 #[prost(message, tag = "1315")]
1401 MatrixBandPart(super::MatrixBandPartLayerParams),
1402 #[prost(message, tag = "1320")]
1403 LowerTriangular(super::LowerTriangularLayerParams),
1404 #[prost(message, tag = "1325")]
1405 UpperTriangular(super::UpperTriangularLayerParams),
1406 #[prost(message, tag = "1330")]
1407 WhereBroadcastable(super::WhereBroadcastableLayerParams),
1408 /// Normalization Layers
1409 #[prost(message, tag = "1350")]
1410 LayerNormalization(super::LayerNormalizationLayerParams),
1411 #[prost(message, tag = "1400")]
1412 NonMaximumSuppression(super::NonMaximumSuppressionLayerParams),
1413 /// Following layers are available only after Core ML Specification
1414 /// version >= 5 (iOS >= 14, macOS >= 11.0)
1415 #[prost(message, tag = "1450")]
1416 OneHot(super::OneHotLayerParams),
1417 #[prost(message, tag = "1455")]
1418 CumSum(super::CumSumLayerParams),
1419 #[prost(message, tag = "1460")]
1420 ClampedReLu(super::ClampedReLuLayerParams),
1421 #[prost(message, tag = "1461")]
1422 ArgSort(super::ArgSortLayerParams),
1423 #[prost(message, tag = "1465")]
1424 Pooling3d(super::Pooling3DLayerParams),
1425 #[prost(message, tag = "1466")]
1426 GlobalPooling3d(super::GlobalPooling3DLayerParams),
1427 #[prost(message, tag = "1470")]
1428 SliceBySize(super::SliceBySizeLayerParams),
1429 #[prost(message, tag = "1471")]
1430 Convolution3d(super::Convolution3DLayerParams),
1431 }
1432}
1433///
1434/// Branching Layer
1435///
1436/// A layer that provides the functionality of branching or an If-Else block.
1437///
1438/// Must have 1 input. There are no outputs as the execution is transferred to either the
1439/// if or the else branch based on the value of the input.
1440///
1441/// Input is the condition predicate. Must be a scalar (length 1 tensor).
1442///
1443#[allow(clippy::all)]
1444#[allow(clippy::pedantic)]
1445#[allow(clippy::nursery)]
1446#[derive(Clone, PartialEq, ::prost::Message)]
1447pub struct BranchLayerParams {
1448 ///
1449 /// execute this graph if the absolute value of the input Tensor is greater than 1e-6
1450 /// This must be present.
1451 #[prost(message, optional, tag = "1")]
1452 pub if_branch: ::core::option::Option<NeuralNetwork>,
1453 ///
1454 /// execute this graph if the absolute value of the input Tensor is less than 1e-6
1455 /// This is optional.
1456 #[prost(message, optional, tag = "2")]
1457 pub else_branch: ::core::option::Option<NeuralNetwork>,
1458}
1459///
1460/// Loop Layer
1461///
1462/// A layer that provides the functionality of a "for" loop or a "while" loop.
1463///
1464/// There are either no inputs or 1 input. When an input is present, it corresponds to the maximum loop count,
1465/// in that case the value of the "maxLoopIterations" field is ignored. Input must be a scalar.
1466/// (For description below, maxLoopIterations is assumed to be the value of the input, when its present)
1467///
1468/// No outputs are produced. Blobs produced by the condition or the body network are visible in the scope of the overall network.
1469///
1470/// "conditionNetwork" must produce a tensor with the name specified in the "conditionVar" field.
1471///
1472/// There are 3 possible cases for determining the termination condition:
1473///
1474/// Case 1:
1475///
1476/// If there is no "conditionNetwork", in this case the layer corresponds to a pure for loop, which is run "maxLoopIterations" number of times.
1477/// Equivalent pseudo-code:
1478///
1479/// for loopIterator = 0 : maxLoopIterations
1480/// bodyNetwork()
1481///
1482///
1483/// Case 2:
1484///
1485/// "conditionNetwork" is present, and "maxLoopIterations" is 0 and there is no input,
1486/// in this case the layer corresponds to a while loop. Equivalent pseudo-code:
1487///
1488/// conditionVar = conditionNetwork()
1489/// while conditionVar:
1490/// bodyNetwork()
1491/// conditionVar = conditionNetwork()
1492///
1493///
1494/// Case 3:
1495///
1496/// "conditionNetwork" is provided, and "maxLoopIterations" is positive or there is an input,
1497/// in this case the layer corresponds to a while loop with a joint condition. Equivalent pseudo-code:
1498///
1499/// loopIterator = 0
1500/// conditionVar = conditionNetwork()
1501/// while (conditionVar and loopIterator < maxLoopIterations):
1502/// bodyNetwork()
1503/// loopIterator = loopIterator + 1
1504/// conditionVar = conditionNetwork()
1505///
1506#[allow(clippy::all)]
1507#[allow(clippy::pedantic)]
1508#[allow(clippy::nursery)]
1509#[derive(Clone, PartialEq, ::prost::Message)]
1510pub struct LoopLayerParams {
1511 ///
1512 /// maximum number of iterations. Ignored if input is present.
1513 #[prost(uint64, tag = "1")]
1514 pub max_loop_iterations: u64,
1515 ///
1516 /// This field provides the name of the tensor which is produced by the conditionNetwork
1517 /// and whose value is checked to start/continue/terminate the loop. Value close to 0.0f is treated as False.
1518 /// This field is optional.
1519 /// Must be a non empty string if and only if "conditionNetwork" is present.
1520 #[prost(string, tag = "2")]
1521 pub condition_var: ::prost::alloc::string::String,
1522 ///
1523 /// Must generate a tensor with the name provided in the "conditionVar" field.
1524 /// This field is optional.
1525 /// Must be present if and only if "conditionVar" field is a non empty string.
1526 #[prost(message, optional, tag = "3")]
1527 pub condition_network: ::core::option::Option<NeuralNetwork>,
1528 ///
1529 /// Body of the loop.
1530 /// This field must be present.
1531 #[prost(message, optional, tag = "4")]
1532 pub body_network: ::core::option::Option<NeuralNetwork>,
1533}
1534///
1535/// Loop break Layer
1536///
1537/// Terminate the loop that has this layer.
1538/// If present, it should always reside in the "bodyNetwork" of the loop layer
1539///
1540/// No inputs/outputs
1541///
1542#[allow(clippy::all)]
1543#[allow(clippy::pedantic)]
1544#[allow(clippy::nursery)]
1545#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1546pub struct LoopBreakLayerParams {}
1547///
1548/// Loop Continue Layer
1549///
1550/// Stop the current loop iteration and continue on the next iteration.
1551/// If present, it should always reside in the "bodyNetwork" of the loop layer
1552///
1553/// No inputs/outputs
1554///
1555#[allow(clippy::all)]
1556#[allow(clippy::pedantic)]
1557#[allow(clippy::nursery)]
1558#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1559pub struct LoopContinueLayerParams {}
1560///
1561/// Copy Layer
1562///
1563/// A layer that copies its input tensor to the output tensor.
1564/// Must have 1 input and 1 output, with distinct names.
1565/// This is the only layer that is allowed to re-generate an output that is already present in the neural network prior to this layer,
1566/// in which case it will overwrite the output tensor.
1567///
1568#[allow(clippy::all)]
1569#[allow(clippy::pedantic)]
1570#[allow(clippy::nursery)]
1571#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1572pub struct CopyLayerParams {}
1573///
1574/// GreaterThan Layer
1575///
1576/// Either 1 or 2 inputs.
1577/// Produces 1 output.
1578/// Perform elementwise greater than operation.
1579///
1580/// Output is 1.0f if the condition is true otherwise 0.0f.
1581///
1582/// .. code::
1583///
1584/// y = x1 > x2
1585/// or
1586/// y = x1 > alpha, if only one input is provided
1587///
1588/// Broadcasting is supported.
1589///
1590#[allow(clippy::all)]
1591#[allow(clippy::pedantic)]
1592#[allow(clippy::nursery)]
1593#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1594pub struct GreaterThanLayerParams {
1595 ///
1596 /// Compare to the scalar value provided here if there is 1 input
1597 #[prost(float, tag = "2")]
1598 pub alpha: f32,
1599}
1600///
1601/// GreaterEqual Layer
1602///
1603/// Either 1 or 2 inputs.
1604/// Produces 1 output.
1605/// Perform elementwise greater equal operation.
1606///
1607/// Output is 1.0f if the condition is true otherwise 0.0f.
1608///
1609/// .. code::
1610///
1611/// y = x1 >= x2
1612/// or
1613/// y = x1 >= alpha, if only one input is provided
1614///
1615/// Broadcasting is supported.
1616///
1617#[allow(clippy::all)]
1618#[allow(clippy::pedantic)]
1619#[allow(clippy::nursery)]
1620#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1621pub struct GreaterEqualLayerParams {
1622 ///
1623 /// Compare to the scalar value provided here if there is 1 input
1624 #[prost(float, tag = "2")]
1625 pub alpha: f32,
1626}
1627///
1628/// LessThan Layer
1629///
1630/// Either 1 or 2 inputs.
1631/// Produces 1 output.
1632/// Perform elementwise less than operation.
1633///
1634/// Output is 1.0f if the condition is true otherwise 0.0f.
1635///
1636/// .. code::
1637///
1638/// y = x1 < x2
1639/// or
1640/// y = x1 < alpha, if only one input is provided
1641///
1642/// Broadcasting is supported.
1643///
1644#[allow(clippy::all)]
1645#[allow(clippy::pedantic)]
1646#[allow(clippy::nursery)]
1647#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1648pub struct LessThanLayerParams {
1649 ///
1650 /// Compare to the scalar value provided here if there is 1 input
1651 #[prost(float, tag = "2")]
1652 pub alpha: f32,
1653}
1654///
1655/// LessEqual Layer
1656///
1657/// Either 1 or 2 inputs.
1658/// Produces 1 output.
1659/// Perform elementwise less equal operation.
1660///
1661/// Output is 1.0f if the condition is true otherwise 0.0f.
1662///
1663/// .. code::
1664///
1665/// y = x1 <= x2
1666/// or
1667/// y = x1 <= alpha, if only one input is provided
1668///
1669/// Broadcasting is supported.
1670///
1671#[allow(clippy::all)]
1672#[allow(clippy::pedantic)]
1673#[allow(clippy::nursery)]
1674#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1675pub struct LessEqualLayerParams {
1676 ///
1677 /// Compare to the scalar value provided here if there is 1 input
1678 #[prost(float, tag = "2")]
1679 pub alpha: f32,
1680}
1681///
1682/// Equal Layer
1683///
1684/// Either 1 or 2 inputs.
1685/// Produces 1 output.
1686/// Perform elementwise equal operation.
1687///
1688/// Output is 1.0f if the condition is true otherwise 0.0f.
1689///
1690/// .. code::
1691///
1692/// y = x1 == x2
1693/// or
1694/// y = x1 == alpha, if only one input is provided
1695///
1696/// Broadcasting is supported.
1697///
1698#[allow(clippy::all)]
1699#[allow(clippy::pedantic)]
1700#[allow(clippy::nursery)]
1701#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1702pub struct EqualLayerParams {
1703 ///
1704 /// Compare to the scalar value provided here if there is 1 input
1705 #[prost(float, tag = "1")]
1706 pub alpha: f32,
1707}
1708///
1709/// NotEqual Layer
1710///
1711/// Either 1 or 2 inputs.
1712/// Produces 1 output.
1713/// Perform elementwise not equal operation.
1714///
1715/// Output is 1.0f if the condition is true otherwise 0.0f.
1716///
1717/// .. code::
1718///
1719/// y = x1 != x2
1720/// or
1721/// y = x1 != alpha, if only one input is provided
1722///
1723/// Broadcasting is supported.
1724///
1725#[allow(clippy::all)]
1726#[allow(clippy::pedantic)]
1727#[allow(clippy::nursery)]
1728#[derive(Clone, Copy, PartialEq, ::prost::Message)]
1729pub struct NotEqualLayerParams {
1730 ///
1731 /// Compare to the scalar value provided here if there is 1 input
1732 #[prost(float, tag = "1")]
1733 pub alpha: f32,
1734}
1735///
1736/// LogicalAnd Layer
1737///
1738/// Must have 2 inputs, produces 1 output.
1739/// Perform elementwise logical AND operation.
1740///
1741/// Input is considered False if equal to 0.0f otherwise True.
1742/// Output is 1.0f if the condition is true otherwise 0.0f.
1743///
1744/// .. code::
1745///
1746/// y = AND(x1, x2)
1747///
1748/// Broadcasting is supported.
1749///
1750#[allow(clippy::all)]
1751#[allow(clippy::pedantic)]
1752#[allow(clippy::nursery)]
1753#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1754pub struct LogicalAndLayerParams {}
1755///
1756/// LogicalOr Layer
1757///
1758/// Must have 2 inputs, produces 1 output.
1759/// Perform elementwise logical OR operation.
1760///
1761/// Input is considered False if equal to 0.0f otherwise True.
1762/// Output is 1.0f if the condition is true otherwise 0.0f.
1763///
1764/// .. code::
1765///
1766/// y = OR(x1, x2)
1767///
1768/// Broadcasting is supported.
1769///
1770#[allow(clippy::all)]
1771#[allow(clippy::pedantic)]
1772#[allow(clippy::nursery)]
1773#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1774pub struct LogicalOrLayerParams {}
1775///
1776/// LogicalXor Layer
1777///
1778/// Must have 2 inputs, produces 1 output.
1779/// Perform elementwise logical XOR operation.
1780///
1781/// Input is considered False if equal to 0.0f otherwise True.
1782/// Output is 1.0f if the condition is true otherwise 0.0f.
1783///
1784/// .. code::
1785///
1786/// y = XOR(x1, x2)
1787///
1788/// Broadcasting is supported.
1789///
1790#[allow(clippy::all)]
1791#[allow(clippy::pedantic)]
1792#[allow(clippy::nursery)]
1793#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1794pub struct LogicalXorLayerParams {}
1795///
1796/// LogicalNot Layer
1797///
1798/// Must have 1 input, produces 1 output.
1799/// Perform elementwise logical NOT operation.
1800///
1801/// Input is considered False if equal to 0.0f otherwise True.
1802/// Output is 1.0f if the condition is true otherwise 0.0f.
1803///
1804/// .. code::
1805///
1806/// y = NOT(x)
1807///
1808///
1809#[allow(clippy::all)]
1810#[allow(clippy::pedantic)]
1811#[allow(clippy::nursery)]
1812#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1813pub struct LogicalNotLayerParams {}
1814///
1815/// Specifies the amount of spatial border to be either padded or cropped.
1816///
1817/// For padding:
1818///
1819/// .. code::
1820///
1821/// H_out = borderAmounts\[0\].startEdgeSize + H_in + borderAmounts\[0\].endEdgeSize
1822/// W_out = borderAmounts\[1\].startEdgeSize + W_in + borderAmounts\[1\].endEdgeSize
1823///
1824/// topPaddingAmount == Height startEdgeSize
1825/// bottomPaddingAmount == Height endEdgeSize
1826/// leftPaddingAmount == Width startEdgeSize
1827/// rightPaddingAmount == Width endEdgeSize
1828///
1829/// For cropping:
1830///
1831/// .. code::
1832///
1833/// H_out = (-borderAmounts\[0\].startEdgeSize) + H_in + (-borderAmounts\[0\].endEdgeSize)
1834/// W_out = (-borderAmounts\[1\].startEdgeSize) + W_in + (-borderAmounts\[1\].endEdgeSize)
1835///
1836/// topCropAmount == Height startEdgeSize
1837/// bottomCropAmount == Height endEdgeSize
1838/// leftCropAmount == Width startEdgeSize
1839/// rightCropAmount == Width endEdgeSize
1840#[allow(clippy::all)]
1841#[allow(clippy::pedantic)]
1842#[allow(clippy::nursery)]
1843#[derive(Clone, PartialEq, ::prost::Message)]
1844pub struct BorderAmounts {
1845 ///
1846 /// The border amounts.
1847 /// This must be length 2 in the order ``\[H, W\]``.
1848 #[prost(message, repeated, tag = "10")]
1849 pub border_amounts: ::prost::alloc::vec::Vec<border_amounts::EdgeSizes>,
1850}
1851/// Nested message and enum types in `BorderAmounts`.
1852pub mod border_amounts {
1853 #[allow(clippy::all)]
1854 #[allow(clippy::pedantic)]
1855 #[allow(clippy::nursery)]
1856 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1857 pub struct EdgeSizes {
1858 ///
1859 /// The amount to be padded or cropped from the beginning.
1860 #[prost(uint64, tag = "1")]
1861 pub start_edge_size: u64,
1862 ///
1863 /// The amount to be padded or cropped from the end.
1864 #[prost(uint64, tag = "2")]
1865 pub end_edge_size: u64,
1866 }
1867}
1868///
1869/// Specifies the type of padding to be used with Convolution/Deconvolution and Pooling layers.
1870/// After padding, input spatial shape: ``\[H_in, W_in\]``, gets modified to the
1871/// output spatial shape ``\[H_out, W_out\]``.
1872///
1873/// .. code::
1874///
1875/// topPaddingAmount == Height startEdgeSize == borderAmounts\[0\].startEdgeSize
1876/// bottomPaddingAmount == Height endEdgeSize == borderAmounts\[0\].endEdgeSize
1877/// leftPaddingAmount == Width startEdgeSize == borderAmounts\[1\].startEdgeSize
1878/// rightPaddingAmount == Width endEdgeSize == borderAmounts\[1\].endEdgeSize
1879///
1880/// With Convolution or Pooling:
1881///
1882/// .. code::
1883///
1884/// H_out = int_division_round_down((H_in + topPaddingAmount + bottomPaddingAmount - KernelSize\[0\]),stride\[0\]) + 1
1885///
1886/// which is same as:
1887///
1888/// .. code::
1889///
1890/// H_out = int_division_round_up((H_in + topPaddingAmount + bottomPaddingAmount - KernelSize\[0\] + 1),stride\[0\])
1891///
1892/// With Deconvolution:
1893///
1894/// .. code::
1895///
1896/// H_out = (H_in-1) * stride\[0\] + kernelSize\[0\] - (topPaddingAmount + bottomPaddingAmount)
1897///
1898///
1899/// The equivalent expressions hold true for ``W_out`` as well.
1900///
1901///
1902/// By default, the values of ``paddingAmounts`` are set to ``0``,
1903/// which results in a "true" valid padding.
1904/// If non-zero values are provided for ``paddingAmounts``,
1905/// "valid" convolution/pooling is performed within the spatially expanded input.
1906///
1907#[allow(clippy::all)]
1908#[allow(clippy::pedantic)]
1909#[allow(clippy::nursery)]
1910#[derive(Clone, PartialEq, ::prost::Message)]
1911pub struct ValidPadding {
1912 #[prost(message, optional, tag = "1")]
1913 pub padding_amounts: ::core::option::Option<BorderAmounts>,
1914}
1915///
1916/// Specifies the type of padding to be used with Convolution/Deconvolution and pooling layers.
1917/// After padding, input spatial shape: ``\[H_in, W_in\]``, gets modified to the
1918/// output spatial shape ``\[H_out, W_out\]``.
1919/// With Convolution or pooling:
1920///
1921/// .. code::
1922///
1923/// H_out = int_division_round_up(H_in,stride\[0\])
1924/// W_out = int_division_round_up(W_in,stride\[1\])
1925///
1926/// This is achieved by using the following padding amounts:
1927///
1928/// .. code::
1929///
1930/// totalPaddingHeight = max(0,(H_out-1) * stride\[0\] + KernelSize\[0\] - Hin)
1931/// totalPaddingWidth = max(0,(W_out-1) * stride\[1\] + KernelSize\[1\] - Win)
1932///
1933/// There are two modes of asymmetry:
1934/// ``BOTTOM_RIGHT_HEAVY``, and ``TOP_LEFT_HEAVY``.
1935///
1936/// If the mode is ``BOTTOM_RIGHT_HEAVY``:
1937///
1938/// .. code::
1939///
1940/// topPaddingAmount = floor(totalPaddingHeight / 2)
1941/// bottomPaddingAmount = totalPaddingHeight - topPaddingAmount
1942/// leftPaddingAmount = floor(totalPaddingWidth / 2)
1943/// rightPaddingAmount = totalPaddingWidth - leftPaddingAmount
1944///
1945/// If the mode is ``TOP_LEFT_HEAVY``:
1946///
1947/// .. code::
1948///
1949/// bottomPaddingAmount = floor(totalPaddingHeight / 2)
1950/// topPaddingAmount = totalPaddingHeight - bottomPaddingAmount
1951/// rightPaddingAmount = floor(totalPaddingWidth / 2)
1952/// leftPaddingAmount = totalPaddingWidth - rightPaddingAmount
1953///
1954///
1955/// With Deconvolution:
1956///
1957/// .. code::
1958///
1959/// H_out = H_in * stride\[0\]
1960/// W_out = W_in * stride\[1\]
1961#[allow(clippy::all)]
1962#[allow(clippy::pedantic)]
1963#[allow(clippy::nursery)]
1964#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
1965pub struct SamePadding {
1966 #[prost(enumeration = "same_padding::SamePaddingMode", tag = "1")]
1967 pub asymmetry_mode: i32,
1968}
1969/// Nested message and enum types in `SamePadding`.
1970pub mod same_padding {
1971 #[allow(clippy::all)]
1972 #[allow(clippy::pedantic)]
1973 #[allow(clippy::nursery)]
1974 #[derive(
1975 Clone,
1976 Copy,
1977 Debug,
1978 PartialEq,
1979 Eq,
1980 Hash,
1981 PartialOrd,
1982 Ord,
1983 ::prost::Enumeration
1984 )]
1985 #[repr(i32)]
1986 pub enum SamePaddingMode {
1987 BottomRightHeavy = 0,
1988 TopLeftHeavy = 1,
1989 }
1990 impl SamePaddingMode {
1991 /// String value of the enum field names used in the ProtoBuf definition.
1992 ///
1993 /// The values are not transformed in any way and thus are considered stable
1994 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
1995 pub fn as_str_name(&self) -> &'static str {
1996 match self {
1997 Self::BottomRightHeavy => "BOTTOM_RIGHT_HEAVY",
1998 Self::TopLeftHeavy => "TOP_LEFT_HEAVY",
1999 }
2000 }
2001 /// Creates an enum from field names used in the ProtoBuf definition.
2002 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2003 match value {
2004 "BOTTOM_RIGHT_HEAVY" => Some(Self::BottomRightHeavy),
2005 "TOP_LEFT_HEAVY" => Some(Self::TopLeftHeavy),
2006 _ => None,
2007 }
2008 }
2009 }
2010}
2011///
2012/// Specifies how grid points are sampled from an interval.
2013/// Without the loss of generality, assume the interval to be \[0, X-1\] from which N points are to be sampled.
2014/// Here X may correspond to an input image's height or width.
2015/// All the methods can be expressed in terms of numpy's linspace function, along with the constraint that grid points have to lie in the interval \[0, X-1\].
2016/// Note: numpy.linspace(start = start, end = end, num = N, endpoint = True) corresponds to sampling
2017/// N points uniformly from the interval \[start, end\], endpoints included.
2018/// The methods vary in how the ``start`` and ``end`` values are computed.
2019#[allow(clippy::all)]
2020#[allow(clippy::pedantic)]
2021#[allow(clippy::nursery)]
2022#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
2023pub struct SamplingMode {
2024 #[prost(enumeration = "sampling_mode::Method", tag = "1")]
2025 pub sampling_method: i32,
2026}
2027/// Nested message and enum types in `SamplingMode`.
2028pub mod sampling_mode {
2029 #[allow(clippy::all)]
2030 #[allow(clippy::pedantic)]
2031 #[allow(clippy::nursery)]
2032 #[derive(
2033 Clone,
2034 Copy,
2035 Debug,
2036 PartialEq,
2037 Eq,
2038 Hash,
2039 PartialOrd,
2040 Ord,
2041 ::prost::Enumeration
2042 )]
2043 #[repr(i32)]
2044 pub enum Method {
2045 ///
2046 /// start = 0, end = X-1
2047 /// grid points = numpy.linspace(start, end)
2048 StrictAlignEndpointsMode = 0,
2049 ///
2050 /// if N == 1: start = end = (X-1)/2
2051 /// otherwise, start = 0, end = X-1
2052 /// grid points = numpy.linspace(start, end)
2053 AlignEndpointsMode = 1,
2054 ///
2055 /// start = 0, end = X - X/N
2056 /// grid points = min(X-1, numpy.linspace(start, end))
2057 /// This is same as the mode used in the upsample layer in this specification, when used with bilinear interpolation. In that case N/X = upsample ratio.
2058 UpsampleMode = 2,
2059 ///
2060 /// spacing = max(1, X-1)/N
2061 /// start = 0.5 * spacing
2062 /// end = start + (N-1) * spacing
2063 /// grid points = min(X-1, numpy.linspace(start, end))
2064 RoiAlignMode = 3,
2065 }
2066 impl Method {
2067 /// String value of the enum field names used in the ProtoBuf definition.
2068 ///
2069 /// The values are not transformed in any way and thus are considered stable
2070 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
2071 pub fn as_str_name(&self) -> &'static str {
2072 match self {
2073 Self::StrictAlignEndpointsMode => "STRICT_ALIGN_ENDPOINTS_MODE",
2074 Self::AlignEndpointsMode => "ALIGN_ENDPOINTS_MODE",
2075 Self::UpsampleMode => "UPSAMPLE_MODE",
2076 Self::RoiAlignMode => "ROI_ALIGN_MODE",
2077 }
2078 }
2079 /// Creates an enum from field names used in the ProtoBuf definition.
2080 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2081 match value {
2082 "STRICT_ALIGN_ENDPOINTS_MODE" => Some(Self::StrictAlignEndpointsMode),
2083 "ALIGN_ENDPOINTS_MODE" => Some(Self::AlignEndpointsMode),
2084 "UPSAMPLE_MODE" => Some(Self::UpsampleMode),
2085 "ROI_ALIGN_MODE" => Some(Self::RoiAlignMode),
2086 _ => None,
2087 }
2088 }
2089 }
2090}
2091///
2092/// Specifies the convention used to specify four bounding box coordinates for an image of size (Height, Width).
2093/// The (0,0) coordinate corresponds to the top-left corner of the image.
2094#[allow(clippy::all)]
2095#[allow(clippy::pedantic)]
2096#[allow(clippy::nursery)]
2097#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
2098pub struct BoxCoordinatesMode {
2099 #[prost(enumeration = "box_coordinates_mode::Coordinates", tag = "1")]
2100 pub box_mode: i32,
2101}
2102/// Nested message and enum types in `BoxCoordinatesMode`.
2103pub mod box_coordinates_mode {
2104 #[allow(clippy::all)]
2105 #[allow(clippy::pedantic)]
2106 #[allow(clippy::nursery)]
2107 #[derive(
2108 Clone,
2109 Copy,
2110 Debug,
2111 PartialEq,
2112 Eq,
2113 Hash,
2114 PartialOrd,
2115 Ord,
2116 ::prost::Enumeration
2117 )]
2118 #[repr(i32)]
2119 pub enum Coordinates {
2120 ///
2121 /// \[h_start, w_start, h_end, w_end\]
2122 CornersHeightFirst = 0,
2123 ///
2124 /// \[w_start, h_start, w_end, h_end\]
2125 CornersWidthFirst = 1,
2126 ///
2127 /// \[h_center, w_center, box_height, box_width\]
2128 CenterSizeHeightFirst = 2,
2129 ///
2130 /// \[w_center, h_center, box_width, box_height\]
2131 CenterSizeWidthFirst = 3,
2132 }
2133 impl Coordinates {
2134 /// String value of the enum field names used in the ProtoBuf definition.
2135 ///
2136 /// The values are not transformed in any way and thus are considered stable
2137 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
2138 pub fn as_str_name(&self) -> &'static str {
2139 match self {
2140 Self::CornersHeightFirst => "CORNERS_HEIGHT_FIRST",
2141 Self::CornersWidthFirst => "CORNERS_WIDTH_FIRST",
2142 Self::CenterSizeHeightFirst => "CENTER_SIZE_HEIGHT_FIRST",
2143 Self::CenterSizeWidthFirst => "CENTER_SIZE_WIDTH_FIRST",
2144 }
2145 }
2146 /// Creates an enum from field names used in the ProtoBuf definition.
2147 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2148 match value {
2149 "CORNERS_HEIGHT_FIRST" => Some(Self::CornersHeightFirst),
2150 "CORNERS_WIDTH_FIRST" => Some(Self::CornersWidthFirst),
2151 "CENTER_SIZE_HEIGHT_FIRST" => Some(Self::CenterSizeHeightFirst),
2152 "CENTER_SIZE_WIDTH_FIRST" => Some(Self::CenterSizeWidthFirst),
2153 _ => None,
2154 }
2155 }
2156 }
2157}
2158///
2159/// Weights for layer parameters.
2160/// Weights are stored as repeated floating point numbers
2161/// using row-major ordering
2162/// and can represent 1-, 2-, 3-, or 4-dimensional data.
2163#[allow(clippy::all)]
2164#[allow(clippy::pedantic)]
2165#[allow(clippy::nursery)]
2166#[derive(Clone, PartialEq, ::prost::Message)]
2167pub struct WeightParams {
2168 ///
2169 /// Values specified in single / float / FP32 precision.
2170 #[prost(float, repeated, tag = "1")]
2171 pub float_value: ::prost::alloc::vec::Vec<f32>,
2172 ///
2173 /// Values in 16-bit half precision floating point.
2174 #[prost(bytes = "vec", tag = "2")]
2175 pub float16_value: ::prost::alloc::vec::Vec<u8>,
2176 ///
2177 /// Raw value specification for quantized lower precisions.
2178 ///
2179 /// This field is interpreted as uintN, where N is the number of bits in quantization.
2180 /// E.g. if n=8, the field is interpreted as an array of UINT8.
2181 /// Use this field for quantized parameters unless specifically noted to use
2182 /// int8RawValue.
2183 #[prost(bytes = "vec", tag = "30")]
2184 pub raw_value: ::prost::alloc::vec::Vec<u8>,
2185 ///
2186 /// Field to be used if int8DynamicQuantize is set in the parent layer.
2187 /// Cannot be set if rawValue is also set.
2188 /// The values in this field are interpreted as INT8.
2189 ///
2190 /// If this field is set, following conditions must hold true:
2191 /// * QuantizationType == LinearQuantizationParams, such that
2192 /// * size of the "scale" field is 1 and "bias" field is empty in "LinearQuantizationParams"
2193 #[prost(bytes = "vec", tag = "31")]
2194 pub int8_raw_value: ::prost::alloc::vec::Vec<u8>,
2195 ///
2196 /// Quantization related parameters.
2197 #[prost(message, optional, tag = "40")]
2198 pub quantization: ::core::option::Option<QuantizationParams>,
2199 #[prost(bool, tag = "50")]
2200 pub is_updatable: bool,
2201}
2202///
2203/// Quantization parameters.
2204#[allow(clippy::all)]
2205#[allow(clippy::pedantic)]
2206#[allow(clippy::nursery)]
2207#[derive(Clone, PartialEq, ::prost::Message)]
2208pub struct QuantizationParams {
2209 #[prost(uint64, tag = "1")]
2210 pub number_of_bits: u64,
2211 #[prost(oneof = "quantization_params::QuantizationType", tags = "101, 102")]
2212 pub quantization_type: ::core::option::Option<quantization_params::QuantizationType>,
2213}
2214/// Nested message and enum types in `QuantizationParams`.
2215pub mod quantization_params {
2216 #[allow(clippy::all)]
2217 #[allow(clippy::pedantic)]
2218 #[allow(clippy::nursery)]
2219 #[derive(Clone, PartialEq, ::prost::Oneof)]
2220 pub enum QuantizationType {
2221 #[prost(message, tag = "101")]
2222 LinearQuantization(super::LinearQuantizationParams),
2223 #[prost(message, tag = "102")]
2224 LookupTableQuantization(super::LookUpTableQuantizationParams),
2225 }
2226}
2227#[allow(clippy::all)]
2228#[allow(clippy::pedantic)]
2229#[allow(clippy::nursery)]
2230#[derive(Clone, PartialEq, ::prost::Message)]
2231pub struct LinearQuantizationParams {
2232 ///
2233 /// Stores scale and bias values corresponding to the quantized weights.
2234 /// Must be an array of 1 element, or an array of C elements, where C
2235 /// is number of output channels. For recurrent layers it is equal to
2236 /// the output vector size.
2237 ///
2238 /// Relationship between quantized weights, unquantized weights, scale and bias:
2239 ///
2240 /// W_unquantized = W_quantized * scale + bias
2241 ///
2242 #[prost(float, repeated, tag = "1")]
2243 pub scale: ::prost::alloc::vec::Vec<f32>,
2244 #[prost(float, repeated, tag = "2")]
2245 pub bias: ::prost::alloc::vec::Vec<f32>,
2246}
2247#[allow(clippy::all)]
2248#[allow(clippy::pedantic)]
2249#[allow(clippy::nursery)]
2250#[derive(Clone, PartialEq, ::prost::Message)]
2251pub struct LookUpTableQuantizationParams {
2252 /// Stores look-up table quantization values. Must be an array of
2253 /// (2^numberOfBits) Elements.
2254 #[prost(float, repeated, tag = "1")]
2255 pub float_value: ::prost::alloc::vec::Vec<f32>,
2256}
2257///
2258/// A layer that performs spatial convolution or deconvolution.
2259///
2260/// .. code::
2261///
2262/// y = ConvolutionLayer(x)
2263///
2264/// Requires 1 or 2 inputs and produces 1 output.
2265///
2266/// Input
2267/// First Input:
2268/// A blob with rank greater than or equal to 4.
2269/// Rank 4 blob represents \[Batch, channels, height, width\].
2270/// For ranks greater than 4, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
2271///
2272/// From Core ML specification version 4 onwards (iOS >= 13, macOS >= 10.15).
2273/// convolution layer can have 2 inputs, in which case the second input is
2274/// the blob representing the weights. This is allowed when "isDeconvolution" = False.
2275/// The weight blob should have shape
2276/// ``\[outputChannels, kernelChannels, kernelHeight, kernelWidth\]``,
2277/// where kernelChannels == inputChannels / nGroups.
2278///
2279/// Output
2280/// Rank is same as the input. e.g.: for rank 4 input, output shape is \[B, C_out, H_out, W_out\]
2281///
2282///
2283/// If ``dilationFactor`` is not 1, effective kernel size is
2284/// modified as follows:
2285///
2286/// .. code::
2287///
2288/// KernelSize\[0\] <-- (kernelSize\[0\]-1) * dilationFactor\[0\] + 1
2289/// KernelSize\[1\] <-- (kernelSize\[1\]-1) * dilationFactor\[1\] + 1
2290///
2291/// Type of padding can be ``valid`` or ``same``. Output spatial dimensions depend on the
2292/// the type of padding. For details, refer to the descriptions of the messages "ValidPadding"
2293/// and "SamePadding". Padded values are all zeros.
2294///
2295/// For Deconvolution, ``ConvolutionPaddingType`` (``valid`` or ``same``) is ignored when ``outputShape`` is set.
2296///
2297///
2298#[allow(clippy::all)]
2299#[allow(clippy::pedantic)]
2300#[allow(clippy::nursery)]
2301#[derive(Clone, PartialEq, ::prost::Message)]
2302pub struct ConvolutionLayerParams {
2303 ///
2304 /// The number of kernels.
2305 /// Same as ``C_out`` used in the layer description.
2306 #[prost(uint64, tag = "1")]
2307 pub output_channels: u64,
2308 ///
2309 /// Channel dimension of the kernels.
2310 /// Must be equal to ``inputChannels / nGroups``, if isDeconvolution == False
2311 /// Must be equal to ``inputChannels``, if isDeconvolution == True
2312 #[prost(uint64, tag = "2")]
2313 pub kernel_channels: u64,
2314 ///
2315 /// Group convolution, i.e. weight reuse along channel axis.
2316 /// Input and kernels are divided into g groups
2317 /// and convolution / deconvolution is applied within the groups independently.
2318 /// If not set or 0, it is set to the default value 1.
2319 #[prost(uint64, tag = "10")]
2320 pub n_groups: u64,
2321 ///
2322 /// Must be length 2 in the order ``\[H, W\]``.
2323 /// If not set, default value ``\[3, 3\]`` is used.
2324 #[prost(uint64, repeated, tag = "20")]
2325 pub kernel_size: ::prost::alloc::vec::Vec<u64>,
2326 ///
2327 /// Must be length 2 in the order ``\[H, W\]``.
2328 /// If not set, default value ``\[1, 1\]`` is used.
2329 #[prost(uint64, repeated, tag = "30")]
2330 pub stride: ::prost::alloc::vec::Vec<u64>,
2331 ///
2332 /// Must be length 2 in order ``\[H, W\]``.
2333 /// If not set, default value ``\[1, 1\]`` is used.
2334 /// It is ignored if ``isDeconvolution == true``.
2335 #[prost(uint64, repeated, tag = "40")]
2336 pub dilation_factor: ::prost::alloc::vec::Vec<u64>,
2337 ///
2338 /// Flag to specify whether it is a deconvolution layer.
2339 #[prost(bool, tag = "60")]
2340 pub is_deconvolution: bool,
2341 ///
2342 /// Flag to specify whether a bias is to be added or not.
2343 #[prost(bool, tag = "70")]
2344 pub has_bias: bool,
2345 ///
2346 /// Weights associated with this layer.
2347 /// If convolution (``isDeconvolution == false``), weights have the shape
2348 /// ``\[outputChannels, kernelChannels, kernelHeight, kernelWidth\]``, where kernelChannels == inputChannels / nGroups
2349 /// If deconvolution (``isDeconvolution == true``) weights have the shape
2350 /// ``\[kernelChannels, outputChannels / nGroups, kernelHeight, kernelWidth\]``, where kernelChannels == inputChannels
2351 #[prost(message, optional, tag = "90")]
2352 pub weights: ::core::option::Option<WeightParams>,
2353 /// Must be of size \[outputChannels\].
2354 #[prost(message, optional, tag = "91")]
2355 pub bias: ::core::option::Option<WeightParams>,
2356 ///
2357 /// The output shape, which has length 2 ``\[H_out, W_out\]``.
2358 /// This is used only for deconvolution (``isDeconvolution == true``).
2359 /// If not set, the deconvolution output shape is calculated
2360 /// based on ``ConvolutionPaddingType``.
2361 #[prost(uint64, repeated, tag = "100")]
2362 pub output_shape: ::prost::alloc::vec::Vec<u64>,
2363 ///
2364 /// The type of padding.
2365 #[prost(oneof = "convolution_layer_params::ConvolutionPaddingType", tags = "50, 51")]
2366 pub convolution_padding_type: ::core::option::Option<
2367 convolution_layer_params::ConvolutionPaddingType,
2368 >,
2369}
2370/// Nested message and enum types in `ConvolutionLayerParams`.
2371pub mod convolution_layer_params {
2372 ///
2373 /// The type of padding.
2374 #[allow(clippy::all)]
2375 #[allow(clippy::pedantic)]
2376 #[allow(clippy::nursery)]
2377 #[derive(Clone, PartialEq, ::prost::Oneof)]
2378 pub enum ConvolutionPaddingType {
2379 #[prost(message, tag = "50")]
2380 Valid(super::ValidPadding),
2381 #[prost(message, tag = "51")]
2382 Same(super::SamePadding),
2383 }
2384}
2385///
2386/// A layer that performs a 3-dimensional convolution.
2387///
2388/// .. code::
2389///
2390/// y = Convolution3DLayer(x)
2391///
2392/// Input
2393/// A blob of rank 5.
2394/// The input blob's shape should be ``\[batch, channels, depth, height, width\]``.
2395///
2396/// Fields
2397/// The bias field, if set, should have shape of ``\[channelsOut\]``.
2398///
2399/// Output
2400/// A blob of rank 5.
2401/// The output blob's shape is ``\[batch, channelsOut, depthOut, heightOut, widthOut\]``.
2402///
2403/// Type of padding can be ``custom``, ``valid``, or ``same``. Padded values are all zeros.
2404/// Output spatial dimensions depend on the the type of padding. For details, refer to the
2405/// descriptions of the ``PaddingType`` field of this ``Convolution3DLayerParams`` message.
2406///
2407/// Example
2408/// For example, given an input of size ``\[1, 3, 3, 8, 8\]``, a stride of 2 in each dimension,
2409/// a kernel of 3 in each dimension, 2 output channels, and ``same`` padding, this layer will
2410/// compute the total padding applied in the depth, height, and width dimensions to be 2, 1, and 1,
2411/// respectively. The depth padding is even and will be applied equally to both sides of the depth
2412/// dimension. Since the height and width padding values are odd, they'll be applied to the
2413/// bottom/right of the height/width dimensions. Thus, the padding applied to the input will be
2414/// ``\[1, 1, 0, 1, 0, 1\]`` (front, back, top, bottom, left, right). Finally, the output produced
2415/// will have size ``\[1, 2, 2, 4, 4\]``.
2416///
2417#[allow(clippy::all)]
2418#[allow(clippy::pedantic)]
2419#[allow(clippy::nursery)]
2420#[derive(Clone, PartialEq, ::prost::Message)]
2421pub struct Convolution3DLayerParams {
2422 ///
2423 /// The number of channels in the output (channelsOut). Must be a positive integer.
2424 #[prost(int32, tag = "1")]
2425 pub output_channels: i32,
2426 ///
2427 /// The number of channels in the input (channels). Must be a positive integer.
2428 #[prost(int32, tag = "2")]
2429 pub input_channels: i32,
2430 ///
2431 /// Group convolution, i.e., weight reuse along the channel axis.
2432 /// It must evenly divide both the number of input and output channels and be at most the number
2433 /// of input channels (a depthwise convolution).
2434 /// Input and kernels are divided into g groups and convolution is applied within the groups
2435 /// independently.
2436 #[prost(int32, tag = "10")]
2437 pub n_groups: i32,
2438 /// Depth of the convolution kernel. Must be a positive integer.
2439 #[prost(int32, tag = "20")]
2440 pub kernel_depth: i32,
2441 /// Height of the convolution kernel. Must be a positive integer.
2442 #[prost(int32, tag = "21")]
2443 pub kernel_height: i32,
2444 /// Width of the convolution kernel. Must be a positive integer.
2445 #[prost(int32, tag = "22")]
2446 pub kernel_width: i32,
2447 /// Stride along the depth direction. Must be a positive integer.
2448 #[prost(int32, tag = "31")]
2449 pub stride_depth: i32,
2450 /// Stride along the height direction. Must be a positive integer.
2451 #[prost(int32, tag = "32")]
2452 pub stride_height: i32,
2453 /// Stride along the width direction. Must be a positive integer.
2454 #[prost(int32, tag = "33")]
2455 pub stride_width: i32,
2456 /// Dilation along the depth direction. Must be a positive integer.
2457 #[prost(int32, tag = "40")]
2458 pub dilation_depth: i32,
2459 /// Dilation along the height direction. Must be a positive integer.
2460 #[prost(int32, tag = "41")]
2461 pub dilation_height: i32,
2462 /// Dilation along the width direction. Must be a positive integer.
2463 #[prost(int32, tag = "42")]
2464 pub dilation_width: i32,
2465 ///
2466 /// Flag to specify whether a bias is to be added or not.
2467 /// If false, then no bias is added.
2468 #[prost(bool, tag = "50")]
2469 pub has_bias: bool,
2470 ///
2471 /// Weights associated with this layer.
2472 /// Weights have the shape
2473 /// if deconvolution == False
2474 /// ``\[outputChannels, kernelChannels, kernelDepth, kernelHeight, kernelWidth\]``, where
2475 /// kernelChannels == inputChannels / nGroups
2476 /// else if deconvolution == True
2477 /// ``\[outputChannels / nGroups, kernelChannels, kernelDepth, kernelHeight, kernelWidth\]``, where
2478 #[prost(message, optional, tag = "60")]
2479 pub weights: ::core::option::Option<WeightParams>,
2480 ///
2481 /// Must be of size ``\[outputChannels\]``.
2482 #[prost(message, optional, tag = "61")]
2483 pub bias: ::core::option::Option<WeightParams>,
2484 #[prost(enumeration = "convolution3_d_layer_params::PaddingType", tag = "70")]
2485 pub padding_type: i32,
2486 /// Padding before the input in the depth direction. Must be zero or a positive integer.
2487 /// Used when the `PaddingType` is `CustomPadding`, otherwise ignored by other padding types.
2488 #[prost(int32, tag = "80")]
2489 pub custom_padding_front: i32,
2490 /// Padding after the input in the depth direction. Must be zero or a positive integer.
2491 /// Used when the `PaddingType` is `CustomPadding`, otherwise ignored by other padding types.
2492 #[prost(int32, tag = "81")]
2493 pub custom_padding_back: i32,
2494 /// Padding before the input in the height direction. Must be zero or a positive integer.
2495 /// Used when the `PaddingType` is `CustomPadding`, otherwise ignored by other padding types.
2496 #[prost(int32, tag = "82")]
2497 pub custom_padding_top: i32,
2498 /// Padding after the input in the height direction. Must be zero or a positive integer.
2499 /// Used when the `PaddingType` is `CustomPadding`, otherwise ignored by other padding types.
2500 #[prost(int32, tag = "83")]
2501 pub custom_padding_bottom: i32,
2502 /// Padding before the input in the width direction. Must be zero or a positive integer.
2503 /// Used when the `PaddingType` is `CustomPadding`, otherwise ignored by other padding types.
2504 #[prost(int32, tag = "84")]
2505 pub custom_padding_left: i32,
2506 /// Padding after the input in the width direction. Must be zero or a positive integer.
2507 /// Used when the `PaddingType` is `CustomPadding`, otherwise ignored by other padding types.
2508 #[prost(int32, tag = "85")]
2509 pub custom_padding_right: i32,
2510 /// Flag to specify if this is Convolution Transpose or not.
2511 #[prost(bool, tag = "86")]
2512 pub is_deconvolution: bool,
2513 ///
2514 /// The output shape, which has length 3 ``\[D_out, H_out, W_out\]``.
2515 /// This is used only for deconvolution (``isDeconvolution == true``).
2516 /// If not set, the deconvolution output shape is calculated
2517 /// based on ``PaddingType``.
2518 #[prost(uint64, repeated, tag = "87")]
2519 pub output_shape: ::prost::alloc::vec::Vec<u64>,
2520}
2521/// Nested message and enum types in `Convolution3DLayerParams`.
2522pub mod convolution3_d_layer_params {
2523 ///
2524 /// The type of padding.
2525 /// All padding types pad the input shape with zeros.
2526 /// CUSTOM padding will add the custom padding values specified below to their respective
2527 /// dimensions, e.g., `customPaddingFront` number of zeros will be added to one side of the
2528 /// input's depth dimension and `customPaddingBack` number of zeros will be added to the other
2529 /// side of the input's depth dimension.
2530 /// VALID padding adds no padding to any dimension. In this case, the last convolution along
2531 /// each dimension will be dropped if the input dimension and the kernel size, stride, and
2532 /// dilation do not match.
2533 /// SAME padding adds enough padding to each dimension such that the output of the convolution
2534 /// has size ``Ceiling(inputShape / stride)``. Padding is added evenly to both sides of each
2535 /// dimension unless the total padding to add is odd, in which case it is added to the
2536 /// back/bottom/right side of the respective dimension. For example, if the total padding needed
2537 /// in the depth dimension is 3, 1 zero will be added to the front side of the depth dimension
2538 /// and 2 zeros will be added to the back side.
2539 #[allow(clippy::all)]
2540 #[allow(clippy::pedantic)]
2541 #[allow(clippy::nursery)]
2542 #[derive(
2543 Clone,
2544 Copy,
2545 Debug,
2546 PartialEq,
2547 Eq,
2548 Hash,
2549 PartialOrd,
2550 Ord,
2551 ::prost::Enumeration
2552 )]
2553 #[repr(i32)]
2554 pub enum PaddingType {
2555 Custom = 0,
2556 Valid = 1,
2557 Same = 2,
2558 }
2559 impl PaddingType {
2560 /// String value of the enum field names used in the ProtoBuf definition.
2561 ///
2562 /// The values are not transformed in any way and thus are considered stable
2563 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
2564 pub fn as_str_name(&self) -> &'static str {
2565 match self {
2566 Self::Custom => "CUSTOM",
2567 Self::Valid => "VALID",
2568 Self::Same => "SAME",
2569 }
2570 }
2571 /// Creates an enum from field names used in the ProtoBuf definition.
2572 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2573 match value {
2574 "CUSTOM" => Some(Self::Custom),
2575 "VALID" => Some(Self::Valid),
2576 "SAME" => Some(Self::Same),
2577 _ => None,
2578 }
2579 }
2580 }
2581}
2582///
2583/// A layer that performs a matrix-vector or matrix-matrix product.
2584/// This is equivalent to a fully-connected, or dense layer.
2585/// The weight parameters correspond to a matrix of dimensions (inputChannels, outputChannels) i.e. (C_in, C_out)
2586///
2587/// .. code::
2588///
2589/// y = InnerProductLayer(x)
2590///
2591/// Requires 1 input and produces 1 output.
2592///
2593/// Input
2594/// Input can have rank 1 to rank 5. This is how it is reshaped in to the matrix (for rank > 1):
2595/// rank 1 (x1) : in this case, the layer corresponds to a matrix-vector product. x1 must be equal to C_in
2596/// rank 2 (x1, x2): x2 must be equal to C_in
2597/// rank 3 (x1, x2, x3) --> (x1 * x2, x3). x3 must be equal to C_in
2598/// rank 4 (x1, x2, x3, x4) ---> (x1, x2 * x3 * x4). x2 * x3 * x4 must be equal to C_in
2599/// rank 5 (x1, x2, x3, x4, x5) ---> (x1 * x2, x3 * x4 * x5). x3 * x4 * x5 must be equal to C_in
2600///
2601/// Output
2602/// Output rank is same as the input rank
2603/// rank 1: (C_out)
2604/// rank 2: (x1, C_out)
2605/// rank 3: (x1, x2, C_out)
2606/// rank 4: (x1, C_out, 1, 1)
2607/// rank 5: (x1, x2, C_out, 1, 1)
2608///
2609#[allow(clippy::all)]
2610#[allow(clippy::pedantic)]
2611#[allow(clippy::nursery)]
2612#[derive(Clone, PartialEq, ::prost::Message)]
2613pub struct InnerProductLayerParams {
2614 /// Input size: C_in.
2615 #[prost(uint64, tag = "1")]
2616 pub input_channels: u64,
2617 /// Output size: C_out.
2618 #[prost(uint64, tag = "2")]
2619 pub output_channels: u64,
2620 /// Whether a bias is added or not.
2621 #[prost(bool, tag = "10")]
2622 pub has_bias: bool,
2623 /// Weight matrix \[C_out, C_in\].
2624 #[prost(message, optional, tag = "20")]
2625 pub weights: ::core::option::Option<WeightParams>,
2626 /// Bias vector \[C_out\].
2627 #[prost(message, optional, tag = "21")]
2628 pub bias: ::core::option::Option<WeightParams>,
2629 ///
2630 /// If set, this layer, at runtime, quantizes the floating point input blob to int8 before applying an
2631 /// inner product using INT8 weight matrix parameters, as provided in weights->int8RawValue. The
2632 /// result is then dequantized.
2633 /// Requires:
2634 /// * hasBias == false
2635 /// * QuantizationType == LinearQuantizationParams, such that
2636 /// * size of the "scale" field is 1 and "bias" field is empty in "LinearQuantizationParams"
2637 /// * numberOfBits == 8
2638 /// * weights->rawValue_size to be empty
2639 #[prost(bool, tag = "22")]
2640 pub int8_dynamic_quantize: bool,
2641}
2642///
2643/// A layer that performs a matrix lookup and optionally adds a bias.
2644/// The weights matrix is stored with dimensions \[outputChannels, inputDim\].
2645///
2646/// .. code::
2647///
2648/// y = EmbeddingLayer(x)
2649///
2650/// Requires 1 input and produces 1 output.
2651///
2652/// Input
2653/// Input values must be in the range ``\[0, inputDim - 1\]``.
2654///
2655/// Input must have rank equal to 4 or 5, such that the last 3 dimensions are all 1.
2656/// rank 4: shape (x1, 1, 1, 1). x1 is effectively the batch/sequence length.
2657/// rank 5: shape (x1, x2 , 1, 1, 1). x1 * x2 is effectively the combined batch/sequence length.
2658///
2659/// Output
2660/// Output rank is same as the input rank. Please see input description above.
2661/// rank 4: shape (x1, outputChannels, 1, 1)
2662/// rank 5: shape (x1, x2, outputChannels, 1, 1)
2663///
2664#[allow(clippy::all)]
2665#[allow(clippy::pedantic)]
2666#[allow(clippy::nursery)]
2667#[derive(Clone, PartialEq, ::prost::Message)]
2668pub struct EmbeddingLayerParams {
2669 /// Size of the input dictionary.
2670 #[prost(uint64, tag = "1")]
2671 pub input_dim: u64,
2672 /// Size of the output vectors.
2673 #[prost(uint64, tag = "2")]
2674 pub output_channels: u64,
2675 /// Whether a bias is added or not.
2676 #[prost(bool, tag = "10")]
2677 pub has_bias: bool,
2678 /// 2-D weights of dimensions \[outputChannels, inputDim\].
2679 #[prost(message, optional, tag = "20")]
2680 pub weights: ::core::option::Option<WeightParams>,
2681 /// Bias of size \[outputChannels\].
2682 #[prost(message, optional, tag = "21")]
2683 pub bias: ::core::option::Option<WeightParams>,
2684}
2685///
2686/// A layer that performs a matrix lookup and optionally adds a bias.
2687/// The weights matrix is stored with dimensions \[embeddingSize, vocabSize\].
2688///
2689/// .. code::
2690///
2691/// y = EmbeddingNDLayer(x)
2692///
2693/// Requires 1 input and produces 1 output.
2694///
2695/// Input
2696/// Input values must be in the range ``\[0, vocabSize - 1\]``.
2697/// Input must have rank at least 2. The last dimension must always be 1.
2698/// rank 2: shape (x1, 1). x1 is the batch/sequence length.
2699/// rank 3: shape (x1, x2, 1). x1 * x2 is effectively the combined batch/sequence length.
2700/// rank 4: shape (x1, x2, x3, 1). x1 * x2 * x2 is effectively the combined batch/sequence length.
2701/// rank 5: shape (x1, x2 , x3, x4, 1). x1 * x2 * x3 * x4 is effectively the combined batch/sequence length.
2702///
2703/// Output
2704/// Output rank is same as the input rank. Please see input description above.
2705/// rank 2: shape (x1, embeddingSize)
2706/// rank 3: shape (x1, x2, embeddingSize)
2707/// rank 4: shape (x1, x2, x3, embeddingSize)
2708/// rank 5: shape (x1, x2, x3, x4, embeddingSize)
2709///
2710#[allow(clippy::all)]
2711#[allow(clippy::pedantic)]
2712#[allow(clippy::nursery)]
2713#[derive(Clone, PartialEq, ::prost::Message)]
2714pub struct EmbeddingNdLayerParams {
2715 /// Size of the input dictionary.
2716 #[prost(uint64, tag = "1")]
2717 pub vocab_size: u64,
2718 /// Size of the output vectors.
2719 #[prost(uint64, tag = "2")]
2720 pub embedding_size: u64,
2721 /// Whether a bias is added or not.
2722 #[prost(bool, tag = "3")]
2723 pub has_bias: bool,
2724 /// 2-D weights of dimensions \[embeddingSize, vocabSize\].
2725 #[prost(message, optional, tag = "20")]
2726 pub weights: ::core::option::Option<WeightParams>,
2727 /// Bias of size \[embeddingSize\].
2728 #[prost(message, optional, tag = "21")]
2729 pub bias: ::core::option::Option<WeightParams>,
2730}
2731///
2732/// A layer that performs batch normalization,
2733/// which is performed along axis = -3,
2734/// and repeated along the other axes, if present.
2735///
2736/// .. code::
2737///
2738/// y = BatchnormLayer(x)
2739///
2740/// Requires 1 input and produces 1 output.
2741///
2742/// This operation is described by the following formula:
2743///
2744/// .. math::
2745/// y_i = \gamma_i \dfrac{ (x_i - \mu_i)}{\sqrt{\sigma_i^2 + \epsilon}} + \beta_i \;,\;i=1,....,C
2746///
2747/// Input
2748/// A blob with rank greater than equal to 3.
2749/// Example: Rank 4 blob represents \[Batch, channels, height, width\]
2750/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
2751///
2752/// Output
2753/// A blob with the same shape as the input.
2754#[allow(clippy::all)]
2755#[allow(clippy::pedantic)]
2756#[allow(clippy::nursery)]
2757#[derive(Clone, PartialEq, ::prost::Message)]
2758pub struct BatchnormLayerParams {
2759 /// Size of the channel dimension in the input.
2760 #[prost(uint64, tag = "1")]
2761 pub channels: u64,
2762 ///
2763 /// If ``computeMeanVar == true``,
2764 /// the mean and variance are calculated from either
2765 /// the single input instance, if ``instanceNormalization == true``,
2766 /// or the whole batch, if ``instanceNormalization = false``.
2767 /// and the values provided in parameters "mean" and "variance" are ignored.
2768 #[prost(bool, tag = "5")]
2769 pub compute_mean_var: bool,
2770 #[prost(bool, tag = "6")]
2771 pub instance_normalization: bool,
2772 ///
2773 /// A small constant to avoid division by 0 while normalizing by variance.
2774 /// Defaults to ``1e-5`` if not set or set to ``0``.
2775 #[prost(float, tag = "10")]
2776 pub epsilon: f32,
2777 /// Parameter of length \[channels\]
2778 #[prost(message, optional, tag = "15")]
2779 pub gamma: ::core::option::Option<WeightParams>,
2780 /// Parameter of length \[channels\]
2781 #[prost(message, optional, tag = "16")]
2782 pub beta: ::core::option::Option<WeightParams>,
2783 /// Parameter of length \[channels\]
2784 #[prost(message, optional, tag = "17")]
2785 pub mean: ::core::option::Option<WeightParams>,
2786 /// Parameter of length \[channels\]
2787 #[prost(message, optional, tag = "18")]
2788 pub variance: ::core::option::Option<WeightParams>,
2789}
2790///
2791/// A spatial pooling layer.
2792///
2793/// .. code::
2794///
2795/// y = PoolingLayer(x)
2796///
2797/// Requires 1 input and produces 1 output.
2798///
2799/// Input
2800/// A blob with rank greater than equal to 4.
2801/// Rank 4 blob represents \[Batch, channels, height, width\]
2802/// For ranks greater than 4, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
2803///
2804/// Output
2805/// Rank is same as the input. e.g.: for rank 4 input, output shape is \[B, C, H_out, W_out\]
2806///
2807/// Padding options are similar to ``ConvolutionLayerParams``
2808/// with the additional option of ``ValidCompletePadding`` (``includeLastPixel``),
2809/// which ensures that the last application of the kernel
2810/// always includes the last pixel of the input image, if there is padding.
2811///
2812/// .. code::
2813///
2814/// H_out = ceil(float(H_in + 2 * paddingAmounts\[0\] - kernelSize\[0\])/float(Stride\[0\])) + 1
2815/// if (paddingAmounts\[0\] > 0 or paddingAmounts\[1\] > 0)
2816/// if ((H_out - 1) * Stride >= H_in + paddingAmounts\[0\]) {
2817/// H_out = H_out - 1
2818/// }
2819/// }
2820///
2821/// The equivalent expressions hold true for ``W_out`` as well.
2822/// Only symmetric padding is supported with this option.
2823#[allow(clippy::all)]
2824#[allow(clippy::pedantic)]
2825#[allow(clippy::nursery)]
2826#[derive(Clone, PartialEq, ::prost::Message)]
2827pub struct PoolingLayerParams {
2828 /// Type of pooling operation.
2829 #[prost(enumeration = "pooling_layer_params::PoolingType", tag = "1")]
2830 pub r#type: i32,
2831 ///
2832 /// Must be length 2 in the order ``\[H, W\]``.
2833 /// If not set, default value ``\[3, 3\]`` is used.
2834 #[prost(uint64, repeated, tag = "10")]
2835 pub kernel_size: ::prost::alloc::vec::Vec<u64>,
2836 ///
2837 /// Must be length 2 in the order ``\[H, W\]``.
2838 /// If not set, default value ``\[1, 1\]`` is used.
2839 #[prost(uint64, repeated, tag = "20")]
2840 pub stride: ::prost::alloc::vec::Vec<u64>,
2841 ///
2842 /// If true, padded values are excluded from the count (denominator)
2843 /// when computing average pooling.
2844 #[prost(bool, tag = "50")]
2845 pub avg_pool_exclude_padding: bool,
2846 ///
2847 /// If true, global pooling is performed.
2848 /// Kernel size is inferred from the input data spatial dimensions.
2849 #[prost(bool, tag = "60")]
2850 pub global_pooling: bool,
2851 #[prost(oneof = "pooling_layer_params::PoolingPaddingType", tags = "30, 31, 32")]
2852 pub pooling_padding_type: ::core::option::Option<
2853 pooling_layer_params::PoolingPaddingType,
2854 >,
2855}
2856/// Nested message and enum types in `PoolingLayerParams`.
2857pub mod pooling_layer_params {
2858 #[allow(clippy::all)]
2859 #[allow(clippy::pedantic)]
2860 #[allow(clippy::nursery)]
2861 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
2862 pub struct ValidCompletePadding {
2863 ///
2864 /// Must be length 2 in order ``\[H, W\]``.
2865 /// If not set, value ``\[0, 0\]`` is used.
2866 #[prost(uint64, repeated, tag = "10")]
2867 pub padding_amounts: ::prost::alloc::vec::Vec<u64>,
2868 }
2869 #[allow(clippy::all)]
2870 #[allow(clippy::pedantic)]
2871 #[allow(clippy::nursery)]
2872 #[derive(
2873 Clone,
2874 Copy,
2875 Debug,
2876 PartialEq,
2877 Eq,
2878 Hash,
2879 PartialOrd,
2880 Ord,
2881 ::prost::Enumeration
2882 )]
2883 #[repr(i32)]
2884 pub enum PoolingType {
2885 Max = 0,
2886 Average = 1,
2887 L2 = 2,
2888 }
2889 impl PoolingType {
2890 /// String value of the enum field names used in the ProtoBuf definition.
2891 ///
2892 /// The values are not transformed in any way and thus are considered stable
2893 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
2894 pub fn as_str_name(&self) -> &'static str {
2895 match self {
2896 Self::Max => "MAX",
2897 Self::Average => "AVERAGE",
2898 Self::L2 => "L2",
2899 }
2900 }
2901 /// Creates an enum from field names used in the ProtoBuf definition.
2902 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
2903 match value {
2904 "MAX" => Some(Self::Max),
2905 "AVERAGE" => Some(Self::Average),
2906 "L2" => Some(Self::L2),
2907 _ => None,
2908 }
2909 }
2910 }
2911 #[allow(clippy::all)]
2912 #[allow(clippy::pedantic)]
2913 #[allow(clippy::nursery)]
2914 #[derive(Clone, PartialEq, ::prost::Oneof)]
2915 pub enum PoolingPaddingType {
2916 #[prost(message, tag = "30")]
2917 Valid(super::ValidPadding),
2918 #[prost(message, tag = "31")]
2919 Same(super::SamePadding),
2920 #[prost(message, tag = "32")]
2921 IncludeLastPixel(ValidCompletePadding),
2922 }
2923}
2924///
2925/// A layer to pool three spatial dimensions
2926///
2927/// Input
2928/// A blob with rank equal to 5, representing \[Batch, channels, depth, height, width\].
2929///
2930/// Output
2931/// Rank is same as the input: A blob with rank equal to 5, representing \[Batch, channels, depth, height, width\].
2932///
2933/// Requires 1 input and produces 1 output.
2934///
2935/// For example, given an input of shape (1,1,2,3,3):
2936/// +----+----+----+
2937/// / | 10 | 11 | 12 |
2938/// / +----+----+----+
2939/// / | 13 | 14 | 15 |
2940/// / +----+----+----+
2941/// / | 16 | 17 | 18 |
2942/// / +----+----+----+
2943/// +----+----+----+ /
2944/// | 1 | 2 | 3 | /
2945/// +----+----+----+ /
2946/// | 4 | 5 | 6 | /
2947/// +----+----+----+ /
2948/// | 7 | 8 | 9 | /
2949/// +----+----+----+
2950///
2951/// And applying MAX pooling using:
2952/// Kernel: 2x2x2
2953/// Stride: 1x1x1
2954/// Valid Padding
2955/// We expect to get an output with shape: (1,1,1,2,2) and value:
2956/// +----+----+
2957/// | 14 | 15 |
2958/// +----+----+
2959/// | 17 | 18 |
2960/// +----+----+
2961#[allow(clippy::all)]
2962#[allow(clippy::pedantic)]
2963#[allow(clippy::nursery)]
2964#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
2965pub struct Pooling3DLayerParams {
2966 /// Whether to use Max or Average
2967 #[prost(enumeration = "pooling3_d_layer_params::PoolingType3D", tag = "1")]
2968 pub r#type: i32,
2969 /// Depth of the pooling region.
2970 #[prost(int32, tag = "2")]
2971 pub kernel_depth: i32,
2972 /// Height of the pooling region.
2973 #[prost(int32, tag = "3")]
2974 pub kernel_height: i32,
2975 /// Width of the pooling region.
2976 #[prost(int32, tag = "4")]
2977 pub kernel_width: i32,
2978 /// Stride along the depth direction
2979 #[prost(int32, tag = "5")]
2980 pub stride_depth: i32,
2981 /// Stride along the height direction
2982 #[prost(int32, tag = "6")]
2983 pub stride_height: i32,
2984 /// Stride along the width direction
2985 #[prost(int32, tag = "7")]
2986 pub stride_width: i32,
2987 #[prost(enumeration = "pooling3_d_layer_params::Pooling3DPaddingType", tag = "15")]
2988 pub padding_type: i32,
2989 /// Padding before the input in the depth direction.
2990 #[prost(int32, tag = "8")]
2991 pub custom_padding_front: i32,
2992 /// Padding after the input in the depth direction.
2993 #[prost(int32, tag = "9")]
2994 pub custom_padding_back: i32,
2995 /// Padding before the input in the height direction.
2996 #[prost(int32, tag = "10")]
2997 pub custom_padding_top: i32,
2998 /// Padding after the input in the height direction.
2999 #[prost(int32, tag = "11")]
3000 pub custom_padding_bottom: i32,
3001 /// Padding before the input in the width direction.
3002 #[prost(int32, tag = "12")]
3003 pub custom_padding_left: i32,
3004 /// Padding after the input in the width direction.
3005 #[prost(int32, tag = "13")]
3006 pub custom_padding_right: i32,
3007 /// If true, exclude zeros from padding in Average pooling. Meaningless in Max Pooling.
3008 #[prost(bool, tag = "14")]
3009 pub count_exclude_padding: bool,
3010}
3011/// Nested message and enum types in `Pooling3DLayerParams`.
3012pub mod pooling3_d_layer_params {
3013 #[allow(clippy::all)]
3014 #[allow(clippy::pedantic)]
3015 #[allow(clippy::nursery)]
3016 #[derive(
3017 Clone,
3018 Copy,
3019 Debug,
3020 PartialEq,
3021 Eq,
3022 Hash,
3023 PartialOrd,
3024 Ord,
3025 ::prost::Enumeration
3026 )]
3027 #[repr(i32)]
3028 pub enum PoolingType3D {
3029 Max = 0,
3030 Average = 1,
3031 }
3032 impl PoolingType3D {
3033 /// String value of the enum field names used in the ProtoBuf definition.
3034 ///
3035 /// The values are not transformed in any way and thus are considered stable
3036 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
3037 pub fn as_str_name(&self) -> &'static str {
3038 match self {
3039 Self::Max => "MAX",
3040 Self::Average => "AVERAGE",
3041 }
3042 }
3043 /// Creates an enum from field names used in the ProtoBuf definition.
3044 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3045 match value {
3046 "MAX" => Some(Self::Max),
3047 "AVERAGE" => Some(Self::Average),
3048 _ => None,
3049 }
3050 }
3051 }
3052 ///
3053 /// The type of padding.
3054 /// All padding types pad the input shape with zeros.
3055 /// CUSTOM padding will add the custom padding values specified below to their respective
3056 /// dimensions, e.g., `customPaddingFront` number of zeros will be added to one side of the
3057 /// input's depth dimension and `customPaddingBack` number of zeros will be added to the other
3058 /// side of the input's depth dimension.
3059 /// VALID padding adds no padding to any dimension. In this case, the last pool along
3060 /// each dimension will be dropped if the input dimension and the kernel size, and stride do not match.
3061 /// SAME padding adds enough padding to each dimension such that the output
3062 /// has the same spatial dimensions as the input. Padding is added evenly to both
3063 /// sides of each dimension unless the total padding to add is odd, in which case the extra padding
3064 /// is added to the back/bottom/right side of the respective dimension. For example, if the the
3065 /// total horizontal padding is 3, then there will be 1 padding on the left, and 2 padding on the right.
3066 #[allow(clippy::all)]
3067 #[allow(clippy::pedantic)]
3068 #[allow(clippy::nursery)]
3069 #[derive(
3070 Clone,
3071 Copy,
3072 Debug,
3073 PartialEq,
3074 Eq,
3075 Hash,
3076 PartialOrd,
3077 Ord,
3078 ::prost::Enumeration
3079 )]
3080 #[repr(i32)]
3081 pub enum Pooling3DPaddingType {
3082 Custom = 0,
3083 Valid = 1,
3084 Same = 2,
3085 }
3086 impl Pooling3DPaddingType {
3087 /// String value of the enum field names used in the ProtoBuf definition.
3088 ///
3089 /// The values are not transformed in any way and thus are considered stable
3090 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
3091 pub fn as_str_name(&self) -> &'static str {
3092 match self {
3093 Self::Custom => "CUSTOM",
3094 Self::Valid => "VALID",
3095 Self::Same => "SAME",
3096 }
3097 }
3098 /// Creates an enum from field names used in the ProtoBuf definition.
3099 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3100 match value {
3101 "CUSTOM" => Some(Self::Custom),
3102 "VALID" => Some(Self::Valid),
3103 "SAME" => Some(Self::Same),
3104 _ => None,
3105 }
3106 }
3107 }
3108}
3109///
3110/// A layer to pool three spatial dimensions down to one value.
3111/// This behaves like a special case of Pooling3DLayerParams in which
3112/// the Kernel is the size of the input and there is no padding.
3113///
3114/// Input
3115/// A blob with rank equal to 5, representing \[Batch, channels, depth, height, width\].
3116///
3117/// Output
3118/// Rank is same as the input: A blob with rank equal to 5, representing \[Batch, channels, depth, height, width\].
3119/// Depth, height, and width of the output will always be 1.
3120///
3121/// Requires 1 input and produces 1 output.
3122///
3123/// For example, given an input of shape (1,1,2,3,3):
3124/// +----+----+----+
3125/// / | 10 | 11 | 12 |
3126/// / +----+----+----+
3127/// / | 13 | 14 | 15 |
3128/// / +----+----+----+
3129/// / | 16 | 17 | 18 |
3130/// / +----+----+----+
3131/// +----+----+----+ /
3132/// | 1 | 2 | 3 | /
3133/// +----+----+----+ /
3134/// | 4 | 5 | 6 | /
3135/// +----+----+----+ /
3136/// | 7 | 8 | 9 | /
3137/// +----+----+----+
3138///
3139/// And applying MAX global 3d pooling, we expect to get an output with shape: (1,1,1,1,1) and value:
3140/// +----+
3141/// | 18 |
3142/// +----+
3143#[allow(clippy::all)]
3144#[allow(clippy::pedantic)]
3145#[allow(clippy::nursery)]
3146#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3147pub struct GlobalPooling3DLayerParams {
3148 /// Whether to use Max or Average
3149 #[prost(
3150 enumeration = "global_pooling3_d_layer_params::GlobalPoolingType3D",
3151 tag = "1"
3152 )]
3153 pub r#type: i32,
3154}
3155/// Nested message and enum types in `GlobalPooling3DLayerParams`.
3156pub mod global_pooling3_d_layer_params {
3157 #[allow(clippy::all)]
3158 #[allow(clippy::pedantic)]
3159 #[allow(clippy::nursery)]
3160 #[derive(
3161 Clone,
3162 Copy,
3163 Debug,
3164 PartialEq,
3165 Eq,
3166 Hash,
3167 PartialOrd,
3168 Ord,
3169 ::prost::Enumeration
3170 )]
3171 #[repr(i32)]
3172 pub enum GlobalPoolingType3D {
3173 Max = 0,
3174 Average = 1,
3175 }
3176 impl GlobalPoolingType3D {
3177 /// String value of the enum field names used in the ProtoBuf definition.
3178 ///
3179 /// The values are not transformed in any way and thus are considered stable
3180 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
3181 pub fn as_str_name(&self) -> &'static str {
3182 match self {
3183 Self::Max => "MAX",
3184 Self::Average => "AVERAGE",
3185 }
3186 }
3187 /// Creates an enum from field names used in the ProtoBuf definition.
3188 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3189 match value {
3190 "MAX" => Some(Self::Max),
3191 "AVERAGE" => Some(Self::Average),
3192 _ => None,
3193 }
3194 }
3195 }
3196}
3197///
3198/// A layer that performs padding along spatial dimensions.
3199///
3200/// .. code::
3201///
3202/// y = PaddingLayer(x)
3203///
3204/// Requires 1 input and produces 1 output.
3205///
3206/// Input
3207/// A blob with rank at least 2.
3208/// e.g.: blob with shape ``\[H_in, W_in\]``.
3209/// For ranks greater than 2, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch
3210/// i.e. Padding is applied on last two dimensions.
3211///
3212/// Output
3213/// Same rank as the input.
3214/// e.g.: blob with shape ``\[H_out, W_out\]``.
3215///
3216/// Output dimensions are calculated as follows:
3217///
3218/// .. code::
3219///
3220/// H_out = H_in + topPaddingAmount + bottomPaddingAmount
3221/// W_out = W_in + leftPaddingAmount + rightPaddingAmount
3222///
3223/// topPaddingAmount == Height startEdgeSize == borderAmounts\[0\].startEdgeSize
3224/// bottomPaddingAmount == Height endEdgeSize == borderAmounts\[0\].endEdgeSize
3225/// leftPaddingAmount == Width startEdgeSize == borderAmounts\[1\].startEdgeSize
3226/// rightPaddingAmount == Width endEdgeSize == borderAmounts\[1\].endEdgeSize
3227///
3228/// There are three types of padding:
3229///
3230/// - ``PaddingConstant``, which fills a constant value at the border.
3231/// - ``PaddingReflection``, which reflects the values at the border.
3232/// - ``PaddingReplication``, which replicates the values at the border.
3233///
3234/// Given the following input:
3235///
3236/// .. code::
3237///
3238/// \[1, 3, 4\] : 1 2 3 4
3239/// 5 6 7 8
3240/// 9 10 11 12
3241///
3242/// Here is the output of applying the padding
3243/// ``(top=2, left=2, bottom=0, right=0)``
3244/// with each of the supported types:
3245///
3246/// - ``PaddingConstant`` (``value = 0``):
3247/// .. code::
3248///
3249/// \[1, 5, 6\] : 0 0 0 0 0 0
3250/// 0 0 0 0 0 0
3251/// 0 0 1 2 3 4
3252/// 0 0 5 6 7 8
3253/// 0 0 9 10 11 12
3254///
3255/// - ``PaddingReflection``:
3256/// .. code::
3257///
3258/// \[1, 5, 6\] : 11 10 9 10 11 12
3259/// 7 6 5 6 7 8
3260/// 3 2 1 2 3 4
3261/// 7 6 5 6 7 8
3262/// 11 10 9 10 11 12
3263///
3264/// - ``PaddingReplication``:
3265/// .. code::
3266///
3267/// \[1, 5, 6\] : 1 1 1 2 3 4
3268/// 1 1 1 2 3 4
3269/// 1 1 1 2 3 4
3270/// 5 5 5 6 7 8
3271/// 9 9 9 10 11 12
3272#[allow(clippy::all)]
3273#[allow(clippy::pedantic)]
3274#[allow(clippy::nursery)]
3275#[derive(Clone, PartialEq, ::prost::Message)]
3276pub struct PaddingLayerParams {
3277 /// Amounts to be padded to the input.
3278 #[prost(message, optional, tag = "10")]
3279 pub padding_amounts: ::core::option::Option<BorderAmounts>,
3280 #[prost(oneof = "padding_layer_params::PaddingType", tags = "1, 2, 3")]
3281 pub padding_type: ::core::option::Option<padding_layer_params::PaddingType>,
3282}
3283/// Nested message and enum types in `PaddingLayerParams`.
3284pub mod padding_layer_params {
3285 ///
3286 /// Fill a constant value in the padded region.
3287 #[allow(clippy::all)]
3288 #[allow(clippy::pedantic)]
3289 #[allow(clippy::nursery)]
3290 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
3291 pub struct PaddingConstant {
3292 #[prost(float, tag = "1")]
3293 pub value: f32,
3294 }
3295 ///
3296 /// Reflect the values at the border for padding.
3297 #[allow(clippy::all)]
3298 #[allow(clippy::pedantic)]
3299 #[allow(clippy::nursery)]
3300 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3301 pub struct PaddingReflection {}
3302 ///
3303 /// Replicate the values at the border for padding.
3304 #[allow(clippy::all)]
3305 #[allow(clippy::pedantic)]
3306 #[allow(clippy::nursery)]
3307 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3308 pub struct PaddingReplication {}
3309 #[allow(clippy::all)]
3310 #[allow(clippy::pedantic)]
3311 #[allow(clippy::nursery)]
3312 #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
3313 pub enum PaddingType {
3314 #[prost(message, tag = "1")]
3315 Constant(PaddingConstant),
3316 #[prost(message, tag = "2")]
3317 Reflection(PaddingReflection),
3318 #[prost(message, tag = "3")]
3319 Replication(PaddingReplication),
3320 }
3321}
3322///
3323/// A layer that concatenates along the axis = -3 or -5.
3324/// For general concatenation along any axis, see ConcatNDLayer.
3325///
3326/// .. code::
3327///
3328/// y = ConcatLayer(x1,x2,....)
3329///
3330/// Requires more than 1 input and produces 1 output.
3331///
3332/// Input
3333/// All input blobs must have same rank.
3334/// If "sequenceConcat" = False, rank must be greater than equal to 3. In this case concatenation is along axis = -3
3335/// If "sequenceConcat" = True, rank must be greater than equal to 5. In this case concatenation is along axis = -5
3336///
3337/// Output
3338/// Same rank as the input.
3339///
3340#[allow(clippy::all)]
3341#[allow(clippy::pedantic)]
3342#[allow(clippy::nursery)]
3343#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3344pub struct ConcatLayerParams {
3345 ///
3346 /// If true, concatenate along the axis = -5 instead of axis = -3.
3347 #[prost(bool, tag = "100")]
3348 pub sequence_concat: bool,
3349}
3350///
3351/// A layer that performs local response normalization (LRN).
3352///
3353/// .. code::
3354///
3355/// y = LRNLayer(x)
3356///
3357/// Requires 1 input and produces 1 output.
3358///
3359/// Input
3360/// A blob with rank greater than equal to 3.
3361/// Example: Rank 4 blob represents \[Batch, channels, height, width\]
3362/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
3363/// Output
3364/// A blob with the same shape as the input.
3365///
3366/// This layer is described by the following formula:
3367///
3368/// .. math::
3369/// x_i \leftarrow \dfrac{x_i}{\left ( k + \dfrac{\alpha}{\text{localSize}} \sum_j x_j^2 \right )^\beta}
3370///
3371/// where the summation is done over a ``(localSize, 1, 1)`` neighborhood ---
3372/// that is, over a window "across" channels in 1x1 spatial neighborhoods.
3373#[allow(clippy::all)]
3374#[allow(clippy::pedantic)]
3375#[allow(clippy::nursery)]
3376#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3377pub struct LrnLayerParams {
3378 #[prost(float, tag = "1")]
3379 pub alpha: f32,
3380 #[prost(float, tag = "2")]
3381 pub beta: f32,
3382 /// Number of channels in the normalization window.
3383 #[prost(uint64, tag = "3")]
3384 pub local_size: u64,
3385 /// Defaults to 1 if not set or 0. Must be strictly positive.
3386 #[prost(float, tag = "4")]
3387 pub k: f32,
3388}
3389///
3390/// Softmax Normalization Layer
3391///
3392/// A layer that performs softmax normalization.
3393/// Normalization is applied along axis = -3 or N-3 (where N is the rank of the input)
3394/// For softmax layer that can operate on any axis, see SoftmaxNDLayer.
3395///
3396///
3397/// .. code::
3398///
3399/// y = SoftmaxLayer(x)
3400///
3401/// Requires 1 input and produces 1 output.
3402///
3403/// Input
3404/// Must be a blob with rank >= 3.
3405/// Output
3406/// A blob with the same shape as the input.
3407///
3408/// This layer is described by the following formula:
3409///
3410/// .. math::
3411/// x_i \leftarrow \dfrac{e^{x_i}}{\sum_i{e^{x_i}}}
3412#[allow(clippy::all)]
3413#[allow(clippy::pedantic)]
3414#[allow(clippy::nursery)]
3415#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3416pub struct SoftmaxLayerParams {}
3417///
3418/// A layer that uniformly splits across axis = -3 to produce a specified number of outputs.
3419/// For general split operation along any axis, see SplitNDLayer.
3420///
3421/// .. code::
3422///
3423/// (y1,y2,...yN) = SplitLayer(x), where N = nOutputs
3424///
3425/// Requires 1 input and produces multiple outputs.
3426///
3427/// Input
3428/// A blob with rank at least 3.
3429/// e.g.: blob with shape ``\[C, H, W\]``
3430/// Output
3431/// ``nOutputs`` blobs each with same rank as the input.
3432/// e.g.: For input that is of shape ``\[C, H, W\]``, output shapes will be ``\[C/nOutputs, H, W\]``
3433#[allow(clippy::all)]
3434#[allow(clippy::pedantic)]
3435#[allow(clippy::nursery)]
3436#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
3437pub struct SplitLayerParams {
3438 /// The number of outputs.
3439 #[prost(uint64, tag = "1")]
3440 pub n_outputs: u64,
3441}
3442///
3443/// A layer that performs elementwise addition.
3444/// This layer has limited broadcasting support. For general broadcasting see AddBroadcastableLayer.
3445///
3446/// .. code::
3447///
3448/// y = AddLayer(x1,x2,...)
3449///
3450/// Requires 1 or more than 1 input and produces 1 output.
3451///
3452/// Input
3453/// In general, there are no rank constraints.
3454/// However, only certain set of shapes are broadcastable. For example:
3455/// \[B, 1, 1, 1\], \[B, C, 1, 1\], \[B, 1, H, W\], \[B, C, H, W\]
3456/// Output
3457/// A blob with shape equal to the input blob.
3458///
3459/// If only one input is provided, scalar addition is performed:
3460///
3461/// .. math::
3462/// y = x + \alpha
3463///
3464#[allow(clippy::all)]
3465#[allow(clippy::pedantic)]
3466#[allow(clippy::nursery)]
3467#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3468pub struct AddLayerParams {
3469 ///
3470 /// Scalar to be added to the input.
3471 /// Only used if there is a single input.
3472 #[prost(float, tag = "1")]
3473 pub alpha: f32,
3474}
3475///
3476/// A layer that performs elementwise multiplication.
3477/// This layer has limited broadcasting support. For general broadcasting see MultiplyBroadcastableLayer.
3478///
3479/// .. code::
3480///
3481/// y = MultiplyLayer(x1,x2,...)
3482///
3483/// Requires 1 or more than 1 input and produces 1 output.
3484///
3485/// Input
3486/// In general, there are no rank constraints.
3487/// However, only certain set of shapes are broadcastable. For example:
3488/// \[B, 1, 1, 1\], \[B, C, 1, 1\], \[B, 1, H, W\], \[B, C, H, W\]
3489/// Output
3490/// A blob with shape equal to the first input blob.
3491///
3492/// If only one input is provided, scalar multiplication is performed:
3493///
3494/// .. math::
3495/// y = \alpha x
3496///
3497#[allow(clippy::all)]
3498#[allow(clippy::pedantic)]
3499#[allow(clippy::nursery)]
3500#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3501pub struct MultiplyLayerParams {
3502 ///
3503 /// Scalar to be multiplied with the input.
3504 /// Only used if there is a single input.
3505 #[prost(float, tag = "1")]
3506 pub alpha: f32,
3507}
3508///
3509/// A layer that applies a unary function.
3510///
3511/// .. code::
3512///
3513/// y = UnaryFunctionLayer(x)
3514///
3515/// Requires 1 input and produces 1 output.
3516///
3517/// Input
3518/// A blob with no rank constraints.
3519/// Output
3520/// A blob with the same shape as the input.
3521///
3522/// The input is first modified by shifting and scaling:
3523///
3524/// .. math::
3525/// x \leftarrow \text{scale} \cdot x + \text{shift}
3526#[allow(clippy::all)]
3527#[allow(clippy::pedantic)]
3528#[allow(clippy::nursery)]
3529#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3530pub struct UnaryFunctionLayerParams {
3531 /// The type of unary function.
3532 #[prost(enumeration = "unary_function_layer_params::Operation", tag = "1")]
3533 pub r#type: i32,
3534 ///
3535 /// A constant used in ``POWER`` and ``THRESHOLD`` functions.
3536 #[prost(float, tag = "2")]
3537 pub alpha: f32,
3538 ///
3539 /// A small constant to avoid division by 0 while normalizing variance.
3540 /// Defaults to ``1e-6`` if not set or set to ``0``.
3541 #[prost(float, tag = "3")]
3542 pub epsilon: f32,
3543 ///
3544 /// Input is shifted by this amount
3545 /// before the unary function is applied.
3546 /// Defaults to ``0.0`` if not set.
3547 #[prost(float, tag = "4")]
3548 pub shift: f32,
3549 ///
3550 /// Input is scaled by this amount
3551 /// before the unary function is applied.
3552 /// Defaults to ``1.0`` if not set or set to ``0``.
3553 #[prost(float, tag = "5")]
3554 pub scale: f32,
3555}
3556/// Nested message and enum types in `UnaryFunctionLayerParams`.
3557pub mod unary_function_layer_params {
3558 ///
3559 /// A unary operator.
3560 ///
3561 /// The following functions are supported:
3562 ///
3563 /// ``SQRT``
3564 /// .. math:: f(x) = \sqrt{x}
3565 ///
3566 /// ``RSQRT``
3567 /// .. math:: f(x) = \dfrac{1}{\sqrt{x + \epsilon}}
3568 ///
3569 /// ``INVERSE``
3570 /// .. math:: f(x) = \dfrac{1}{x + \epsilon}
3571 ///
3572 /// ``POWER``
3573 /// .. math:: f(x) = x^\alpha
3574 ///
3575 /// ``EXP``
3576 /// .. math:: f(x) = e^x
3577 ///
3578 /// ``LOG``
3579 /// .. math:: f(x) = \log x
3580 ///
3581 /// ``ABS``
3582 /// .. math:: f(x) = |x|
3583 ///
3584 /// ``THRESHOLD``
3585 /// .. math:: f(x) = \text{max}(\alpha, x)
3586 #[allow(clippy::all)]
3587 #[allow(clippy::pedantic)]
3588 #[allow(clippy::nursery)]
3589 #[derive(
3590 Clone,
3591 Copy,
3592 Debug,
3593 PartialEq,
3594 Eq,
3595 Hash,
3596 PartialOrd,
3597 Ord,
3598 ::prost::Enumeration
3599 )]
3600 #[repr(i32)]
3601 pub enum Operation {
3602 Sqrt = 0,
3603 Rsqrt = 1,
3604 Inverse = 2,
3605 Power = 3,
3606 Exp = 4,
3607 Log = 5,
3608 Abs = 6,
3609 Threshold = 7,
3610 }
3611 impl Operation {
3612 /// String value of the enum field names used in the ProtoBuf definition.
3613 ///
3614 /// The values are not transformed in any way and thus are considered stable
3615 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
3616 pub fn as_str_name(&self) -> &'static str {
3617 match self {
3618 Self::Sqrt => "SQRT",
3619 Self::Rsqrt => "RSQRT",
3620 Self::Inverse => "INVERSE",
3621 Self::Power => "POWER",
3622 Self::Exp => "EXP",
3623 Self::Log => "LOG",
3624 Self::Abs => "ABS",
3625 Self::Threshold => "THRESHOLD",
3626 }
3627 }
3628 /// Creates an enum from field names used in the ProtoBuf definition.
3629 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3630 match value {
3631 "SQRT" => Some(Self::Sqrt),
3632 "RSQRT" => Some(Self::Rsqrt),
3633 "INVERSE" => Some(Self::Inverse),
3634 "POWER" => Some(Self::Power),
3635 "EXP" => Some(Self::Exp),
3636 "LOG" => Some(Self::Log),
3637 "ABS" => Some(Self::Abs),
3638 "THRESHOLD" => Some(Self::Threshold),
3639 _ => None,
3640 }
3641 }
3642 }
3643}
3644///
3645/// A layer that scales up spatial dimensions.
3646/// It supports two modes: nearest neighbour (default) and bilinear.
3647///
3648/// .. code::
3649///
3650/// y = UpsampleLayer(x)
3651///
3652/// Requires 1 input and produces 1 output.
3653///
3654/// Input
3655/// A blob with rank at least 3.
3656/// e.g.: blob with shape ``\[C, H, W\]``.
3657/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
3658///
3659/// Output
3660/// Same rank as the input.
3661/// e.g.: blob with shape ``\[C, scalingFactor[0\] * H, scalingFactor\[1\] * W]``
3662#[allow(clippy::all)]
3663#[allow(clippy::pedantic)]
3664#[allow(clippy::nursery)]
3665#[derive(Clone, PartialEq, ::prost::Message)]
3666pub struct UpsampleLayerParams {
3667 ///
3668 /// Scaling Factor. Mutually exclusive with fractionalScalingFactor.
3669 /// Must be length 2 in order ``\[H, W\]``.
3670 /// If not set, default value ``\[1, 1\]`` is used.
3671 #[prost(uint64, repeated, tag = "1")]
3672 pub scaling_factor: ::prost::alloc::vec::Vec<u64>,
3673 ///
3674 /// Fractional scaling factor. Mutually exclusive with scalingFactor.
3675 /// Must be length 2 in order ``\[H, W\]``.
3676 /// If not set, default value ``\[1.0, 1.0\]`` is used.
3677 #[prost(float, repeated, tag = "7")]
3678 pub fractional_scaling_factor: ::prost::alloc::vec::Vec<f32>,
3679 #[prost(enumeration = "upsample_layer_params::InterpolationMode", tag = "5")]
3680 pub mode: i32,
3681 #[prost(enumeration = "upsample_layer_params::LinearUpsampleMode", tag = "6")]
3682 pub linear_upsample_mode: i32,
3683}
3684/// Nested message and enum types in `UpsampleLayerParams`.
3685pub mod upsample_layer_params {
3686 ///
3687 /// Overall mode for interpolating new elements when upsampling.
3688 /// NN - Nearest Neighbors - simply pick the nearest true value for interpolated values.
3689 /// BILINEAR - Use bilinear interpolation. See LinearUpsamplingMode for behavior.
3690 #[allow(clippy::all)]
3691 #[allow(clippy::pedantic)]
3692 #[allow(clippy::nursery)]
3693 #[derive(
3694 Clone,
3695 Copy,
3696 Debug,
3697 PartialEq,
3698 Eq,
3699 Hash,
3700 PartialOrd,
3701 Ord,
3702 ::prost::Enumeration
3703 )]
3704 #[repr(i32)]
3705 pub enum InterpolationMode {
3706 /// Nearest Neighbour
3707 Nn = 0,
3708 /// Bilinear
3709 Bilinear = 1,
3710 }
3711 impl InterpolationMode {
3712 /// String value of the enum field names used in the ProtoBuf definition.
3713 ///
3714 /// The values are not transformed in any way and thus are considered stable
3715 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
3716 pub fn as_str_name(&self) -> &'static str {
3717 match self {
3718 Self::Nn => "NN",
3719 Self::Bilinear => "BILINEAR",
3720 }
3721 }
3722 /// Creates an enum from field names used in the ProtoBuf definition.
3723 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3724 match value {
3725 "NN" => Some(Self::Nn),
3726 "BILINEAR" => Some(Self::Bilinear),
3727 _ => None,
3728 }
3729 }
3730 }
3731 ///
3732 /// LinearUpsampleMode specifies the behavior for linear upsampling. Only valid when Interpolation Mode is BILINEAR.
3733 /// If input grid is \[0, Xin-1\] (corresponding to an input size of Xin), and if the output size is Xout,
3734 /// then the grid points are sampled in the following manner:
3735 /// DEFAULT:
3736 /// spacing = (Xin-Xin/Xout) / (Xout-1)
3737 /// grid_point\[i\] = min(Xin-1, max(0, i * spacing)), for i = 0,1,2,….,Xout-1
3738 /// ALIGN_CORNERS_TRUE:
3739 /// spacing = (Xin-1) / (Xout-1)
3740 /// grid_point\[i\] = min(Xin-1, max(0, i * spacing)), for i = 0,1,2,….,Xout-1
3741 /// ALIGN_CORNERS_FALSE:
3742 /// spacing = Xin / Xout
3743 /// grid_point\[i\] = min(Xin-1, max(0, i * spacing + 0.5 * spacing - 0.5)), for i = 0,1,2,….,Xout-1
3744 #[allow(clippy::all)]
3745 #[allow(clippy::pedantic)]
3746 #[allow(clippy::nursery)]
3747 #[derive(
3748 Clone,
3749 Copy,
3750 Debug,
3751 PartialEq,
3752 Eq,
3753 Hash,
3754 PartialOrd,
3755 Ord,
3756 ::prost::Enumeration
3757 )]
3758 #[repr(i32)]
3759 pub enum LinearUpsampleMode {
3760 Default = 0,
3761 AlignCornersTrue = 1,
3762 AlignCornersFalse = 2,
3763 }
3764 impl LinearUpsampleMode {
3765 /// String value of the enum field names used in the ProtoBuf definition.
3766 ///
3767 /// The values are not transformed in any way and thus are considered stable
3768 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
3769 pub fn as_str_name(&self) -> &'static str {
3770 match self {
3771 Self::Default => "DEFAULT",
3772 Self::AlignCornersTrue => "ALIGN_CORNERS_TRUE",
3773 Self::AlignCornersFalse => "ALIGN_CORNERS_FALSE",
3774 }
3775 }
3776 /// Creates an enum from field names used in the ProtoBuf definition.
3777 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
3778 match value {
3779 "DEFAULT" => Some(Self::Default),
3780 "ALIGN_CORNERS_TRUE" => Some(Self::AlignCornersTrue),
3781 "ALIGN_CORNERS_FALSE" => Some(Self::AlignCornersFalse),
3782 _ => None,
3783 }
3784 }
3785 }
3786}
3787///
3788/// A layer that resizes the input to a pre-specified spatial size using bilinear interpolation.
3789///
3790/// .. code::
3791///
3792/// y = ResizeBilinearLayer(x)
3793///
3794/// Requires 1 input and produces 1 output.
3795///
3796/// Input
3797/// A blob with rank at least 3.
3798/// e.g.: blob with shape ``\[C, H_in, W_in\]``.
3799/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
3800///
3801/// Output
3802/// Same rank as the input.
3803/// e.g.: blob with shape ``\[C, H_out, W_out\]``.
3804///
3805#[allow(clippy::all)]
3806#[allow(clippy::pedantic)]
3807#[allow(clippy::nursery)]
3808#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
3809pub struct ResizeBilinearLayerParams {
3810 ///
3811 /// Target Spatial Size.
3812 /// Must be length 2 in order ``\[Height, Width\]``, i.e. ``\[H_out, W_out\]``.
3813 /// If not set, default value ``\[1, 1\]`` is used.
3814 #[prost(uint64, repeated, tag = "1")]
3815 pub target_size: ::prost::alloc::vec::Vec<u64>,
3816 ///
3817 /// Mode used to compute the grid on which the spatial output values are evaluated.
3818 /// Same mode is applied to both the height and width axes.
3819 #[prost(message, optional, tag = "2")]
3820 pub mode: ::core::option::Option<SamplingMode>,
3821}
3822///
3823/// A layer that extracts cropped spatial patches or RoIs (regions of interest) from the input and resizes them to a pre-specified size using
3824/// bilinear interpolation.
3825/// Note that RoI Align layer can be implemented with this layer followed by a pooling layer.
3826///
3827/// .. code::
3828///
3829/// y = CropResizeLayer(x)
3830///
3831/// Requires 2 inputs and produces 1 output.
3832///
3833/// Input
3834/// There are two inputs.
3835/// First input represents an image feature map.
3836/// Second input represents the bounding box coordinates for N patches or RoIs (region of interest).
3837///
3838/// First input is rank 5: \[1, Batch, C, H_in, W_in\].
3839/// Second input is rank 5. Its shape can be either \[N, 1, 4, 1, 1\] or \[N, 1, 5, 1, 1\].
3840///
3841/// N: number of patches/RoIs to be extracted
3842///
3843/// If RoI shape = ``\[N, 1, 4, 1, 1\]``
3844/// The axis=-3 corresponds to the four coordinates specifying the bounding box.
3845/// All the N RoIs are extracted from all the batches of the input.
3846///
3847/// If RoI shape = ``\[N, 1, 5, 1, 1\]``
3848/// The first element of the axis=-3 specifies the input batch id from which to extract the RoI and
3849/// must be in the interval ``\[0, Batch - 1\]``. That is, n-th RoI is extracted from the RoI\[n,0,0,0,0\]-th
3850/// input batch id. The last four elements of the axis=-3 specify the bounding box coordinates.
3851///
3852/// Output
3853/// A blob with rank 5.
3854/// - Shape is \[N, Batch, C, H_out, W_out\] if input RoI shape is \[N, 1, 4, 1, 1\]
3855/// - Shape is \[N, 1, C, H_out, W_out\] if input RoI shape is \[N, 1, 5, 1, 1\]
3856///
3857#[allow(clippy::all)]
3858#[allow(clippy::pedantic)]
3859#[allow(clippy::nursery)]
3860#[derive(Clone, PartialEq, ::prost::Message)]
3861pub struct CropResizeLayerParams {
3862 ///
3863 /// Target Spatial Size.
3864 /// Must be length 2 in order ``\[Height, Width\]``, i.e. ``\[H_out, W_out\]``.
3865 /// If not set, default value ``\[1, 1\]`` is used.
3866 #[prost(uint64, repeated, tag = "1")]
3867 pub target_size: ::prost::alloc::vec::Vec<u64>,
3868 ///
3869 /// If true the bounding box coordinates must be in the interval \[0, 1\].
3870 /// They are scaled by (H_in - 1), (W_in - 1), i.e. based on the input spatial dimensions.
3871 /// If false the bounding box coordinates must be in the interval
3872 /// \[0, H_in -1\] and \[0, W_in - 1\], respectively for height and width dimensions.
3873 #[prost(bool, tag = "2")]
3874 pub normalized_coordinates: bool,
3875 ///
3876 /// Mode used to compute the grid on which the spatial output values are evaluated.
3877 /// Same mode is applied to both the height and width axes.
3878 #[prost(message, optional, tag = "3")]
3879 pub mode: ::core::option::Option<SamplingMode>,
3880 ///
3881 /// Representation used to express the bounding box coordinates.
3882 /// It determines how the values of the second input are interpreted.
3883 #[prost(message, optional, tag = "4")]
3884 pub box_indices_mode: ::core::option::Option<BoxCoordinatesMode>,
3885 ///
3886 /// Additional spatial scale that multiplies the bounding box coordinates.
3887 /// Generally used while implementing the RoI Align layer,
3888 /// which uses unnormalized RoI coordinates along with a spatial scale less than or equal to 1.
3889 #[prost(float, tag = "5")]
3890 pub spatial_scale: f32,
3891}
3892///
3893/// A layer that performs elementwise addition of a bias,
3894/// which is broadcasted to match the input shape.
3895///
3896/// .. code::
3897///
3898/// y = BiasLayer(x)
3899///
3900/// Requires 1 input and produces 1 output.
3901///
3902/// Input
3903/// A blob with rank at least 3.
3904/// e.g.: blob with shape ``\[C, H, W\]``.
3905/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
3906/// Output
3907/// A blob with the same shape as the input.
3908#[allow(clippy::all)]
3909#[allow(clippy::pedantic)]
3910#[allow(clippy::nursery)]
3911#[derive(Clone, PartialEq, ::prost::Message)]
3912pub struct BiasLayerParams {
3913 ///
3914 /// The shape of the bias.
3915 /// Must be one of the following:
3916 /// ``\[1\]``, ``\[C\]``, ``\[1, H, W\]`` or ``\[C, H, W\]``.
3917 #[prost(uint64, repeated, tag = "1")]
3918 pub shape: ::prost::alloc::vec::Vec<u64>,
3919 ///
3920 /// The bias values.
3921 /// The size must be equal to the product of the ``shape`` dimensions.
3922 #[prost(message, optional, tag = "2")]
3923 pub bias: ::core::option::Option<WeightParams>,
3924}
3925///
3926/// A layer that performs elmentwise multiplication by a scale factor
3927/// and optionally adds a bias;
3928/// both the scale and bias are broadcasted to match the input shape.
3929///
3930/// .. code::
3931///
3932/// y = ScaleLayer(x)
3933///
3934/// Requires 1 input and produces 1 output.
3935///
3936/// Input
3937/// A blob with rank at least 3.
3938/// e.g.: blob with shape ``\[C, H, W\]``.
3939/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
3940/// Output
3941/// A blob with the same shape as the input.
3942#[allow(clippy::all)]
3943#[allow(clippy::pedantic)]
3944#[allow(clippy::nursery)]
3945#[derive(Clone, PartialEq, ::prost::Message)]
3946pub struct ScaleLayerParams {
3947 ///
3948 /// The shape of the scale.
3949 /// Must be one of the following:
3950 /// ``\[1\]``, ``\[C\]``, ``\[1, H, W\]`` or ``\[C, H, W\]``.
3951 #[prost(uint64, repeated, tag = "1")]
3952 pub shape_scale: ::prost::alloc::vec::Vec<u64>,
3953 ///
3954 /// The scale values.
3955 /// The size must be equal to the product of the ``shape`` dimensions.
3956 ///
3957 /// Scale values. Size must be equal to the product of dimensions specified in shapeScale.
3958 #[prost(message, optional, tag = "2")]
3959 pub scale: ::core::option::Option<WeightParams>,
3960 /// If true, a bias is added after scaling.
3961 #[prost(bool, tag = "3")]
3962 pub has_bias: bool,
3963 ///
3964 /// The shape of the bias.
3965 /// Must be one of the following:
3966 /// ``\[1\]``, ``\[C\]``, ``\[1, H, W\]`` or ``\[C, H, W\]``.
3967 #[prost(uint64, repeated, tag = "4")]
3968 pub shape_bias: ::prost::alloc::vec::Vec<u64>,
3969 ///
3970 /// The bias values.
3971 /// The size must be equal to the product of the ``shape`` dimensions.
3972 #[prost(message, optional, tag = "5")]
3973 pub bias: ::core::option::Option<WeightParams>,
3974}
3975///
3976/// A layer that loads data as a parameter and provides it as an output.
3977/// The output is rank 5. For general rank, see LoadConstantNDLayer.
3978///
3979/// .. code::
3980///
3981/// y = LoadConstantLayer()
3982///
3983/// Requires no input and produces 1 output.
3984///
3985/// Output:
3986/// A blob with rank 5 and shape ``\[1, 1, C, H, W\]``
3987#[allow(clippy::all)]
3988#[allow(clippy::pedantic)]
3989#[allow(clippy::nursery)]
3990#[derive(Clone, PartialEq, ::prost::Message)]
3991pub struct LoadConstantLayerParams {
3992 ///
3993 /// The shape of the constant to be loaded,
3994 /// which must be``\[C, H, W\]``, that is length 3.
3995 #[prost(uint64, repeated, tag = "1")]
3996 pub shape: ::prost::alloc::vec::Vec<u64>,
3997 ///
3998 /// The data values,
3999 /// of size ``C * H * W``.
4000 #[prost(message, optional, tag = "2")]
4001 pub data: ::core::option::Option<WeightParams>,
4002}
4003///
4004/// A layer that performs L2 normalization, i.e. divides by the
4005/// the square root of the sum of squares of all elements of input.
4006///
4007/// .. code::
4008///
4009/// y = L2NormalizeLayer(x)
4010///
4011/// Requires 1 input and produces 1 output.
4012///
4013/// Input
4014/// A blob with rank greater than equal to 3.
4015/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
4016/// Output
4017/// A blob with the same shape as the input.
4018///
4019/// This layer is described by the following formula:
4020///
4021/// .. math::
4022/// x_i \leftarrow \dfrac{x_i}{\sqrt{\sum{x_i^2} + \epsilon}}
4023#[allow(clippy::all)]
4024#[allow(clippy::pedantic)]
4025#[allow(clippy::nursery)]
4026#[derive(Clone, Copy, PartialEq, ::prost::Message)]
4027pub struct L2NormalizeLayerParams {
4028 ///
4029 /// A small constant to avoid division by 0 while normalizing variance.
4030 /// Defaults to ``1e-6`` if not set or set to ``0``.
4031 #[prost(float, tag = "1")]
4032 pub epsilon: f32,
4033}
4034///
4035/// A layer that flattens the input.
4036///
4037/// .. code::
4038///
4039/// y = FlattenLayer(x)
4040///
4041/// Requires 1 input and produces 1 output.
4042///
4043/// Input
4044/// A blob with rank greater than equal to 3.
4045/// e.g.: Rank 4 blob represents \[Batch, C, H, W\]
4046/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
4047/// Output
4048/// Same rank as the input, such that last two dimensions are both 1.
4049/// e.g.: For rank 4 input, output shape is ``\[Batch, C * H * W, 1, 1\]``
4050///
4051/// There are two X orders: ``CHANNEL_FIRST`` and ``CHANNEL_LAST``.
4052/// ``CHANNEL_FIRST`` does not require data to be rearranged,
4053/// because row major ordering is used by internal storage.
4054/// ``CHANNEL_LAST`` requires data to be rearranged.
4055#[allow(clippy::all)]
4056#[allow(clippy::pedantic)]
4057#[allow(clippy::nursery)]
4058#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4059pub struct FlattenLayerParams {
4060 #[prost(enumeration = "flatten_layer_params::FlattenOrder", tag = "1")]
4061 pub mode: i32,
4062}
4063/// Nested message and enum types in `FlattenLayerParams`.
4064pub mod flatten_layer_params {
4065 #[allow(clippy::all)]
4066 #[allow(clippy::pedantic)]
4067 #[allow(clippy::nursery)]
4068 #[derive(
4069 Clone,
4070 Copy,
4071 Debug,
4072 PartialEq,
4073 Eq,
4074 Hash,
4075 PartialOrd,
4076 Ord,
4077 ::prost::Enumeration
4078 )]
4079 #[repr(i32)]
4080 pub enum FlattenOrder {
4081 ChannelFirst = 0,
4082 ChannelLast = 1,
4083 }
4084 impl FlattenOrder {
4085 /// String value of the enum field names used in the ProtoBuf definition.
4086 ///
4087 /// The values are not transformed in any way and thus are considered stable
4088 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
4089 pub fn as_str_name(&self) -> &'static str {
4090 match self {
4091 Self::ChannelFirst => "CHANNEL_FIRST",
4092 Self::ChannelLast => "CHANNEL_LAST",
4093 }
4094 }
4095 /// Creates an enum from field names used in the ProtoBuf definition.
4096 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
4097 match value {
4098 "CHANNEL_FIRST" => Some(Self::ChannelFirst),
4099 "CHANNEL_LAST" => Some(Self::ChannelLast),
4100 _ => None,
4101 }
4102 }
4103 }
4104}
4105///
4106/// A layer that recasts the input into a new shape.
4107///
4108/// .. code::
4109///
4110/// y = ReshapeLayer(x)
4111///
4112/// Requires 1 input and produces 1 output.
4113///
4114/// Input
4115/// A blob with rank 5.
4116/// e.g.: ``\[1, 1, C, H, W\]`` or ``\[Seq, 1, C, H, W\]``.
4117/// Output
4118/// A blob with rank 5.
4119/// e.g.: ``\[1, 1, C_out, H_out, W_out\]`` or ``\[Seq_out, 1, C_out, H_out, W_out\]``.
4120///
4121/// There are two reshape orders: ``CHANNEL_FIRST`` and ``CHANNEL_LAST``.
4122/// ``CHANNEL_FIRST`` is equivalent to
4123/// flattening the input to ``\[Seq, 1, C * H * W, 1, 1\]`` in channel first order
4124/// and then reshaping it to the target shape;
4125/// no data rearrangement is required.
4126/// ``CHANNEL_LAST`` is equivalent to
4127/// flattening the input to ``\[Seq, 1, H * W * C, 1, 1\]`` in channel last order,
4128/// reshaping it to ``\[Seq_out, 1, H_out, W_out, C_out\]`` (it is now in "H_out-major"" order),
4129/// and then permuting it to ``\[C_out, H_out, W_out\]``;
4130/// both the flattening and permuting requires the data to be rearranged.
4131#[allow(clippy::all)]
4132#[allow(clippy::pedantic)]
4133#[allow(clippy::nursery)]
4134#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4135pub struct ReshapeLayerParams {
4136 ///
4137 /// The shape of the output.
4138 /// Must be of length 3 or 4.
4139 /// If set to 3, ``targetShape`` is interpreted as
4140 /// ``\[1, 1, C_out, H_out, W_out\]``, and sequence length of the input is preserved.
4141 /// If set to 4, ``targetShape`` is interpreted as
4142 /// ``\[Seq_out, 1, C_out, H_out, W_out\]``,
4143 /// where ``Seq_out`` is the new sequence length.
4144 #[prost(int64, repeated, tag = "1")]
4145 pub target_shape: ::prost::alloc::vec::Vec<i64>,
4146 #[prost(enumeration = "reshape_layer_params::ReshapeOrder", tag = "2")]
4147 pub mode: i32,
4148}
4149/// Nested message and enum types in `ReshapeLayerParams`.
4150pub mod reshape_layer_params {
4151 #[allow(clippy::all)]
4152 #[allow(clippy::pedantic)]
4153 #[allow(clippy::nursery)]
4154 #[derive(
4155 Clone,
4156 Copy,
4157 Debug,
4158 PartialEq,
4159 Eq,
4160 Hash,
4161 PartialOrd,
4162 Ord,
4163 ::prost::Enumeration
4164 )]
4165 #[repr(i32)]
4166 pub enum ReshapeOrder {
4167 ChannelFirst = 0,
4168 ChannelLast = 1,
4169 }
4170 impl ReshapeOrder {
4171 /// String value of the enum field names used in the ProtoBuf definition.
4172 ///
4173 /// The values are not transformed in any way and thus are considered stable
4174 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
4175 pub fn as_str_name(&self) -> &'static str {
4176 match self {
4177 Self::ChannelFirst => "CHANNEL_FIRST",
4178 Self::ChannelLast => "CHANNEL_LAST",
4179 }
4180 }
4181 /// Creates an enum from field names used in the ProtoBuf definition.
4182 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
4183 match value {
4184 "CHANNEL_FIRST" => Some(Self::ChannelFirst),
4185 "CHANNEL_LAST" => Some(Self::ChannelLast),
4186 _ => None,
4187 }
4188 }
4189 }
4190}
4191///
4192/// A layer that rearranges the dimensions and data of an input.
4193/// For generic transpose/permute operation see TransposeLayer.
4194///
4195/// .. code::
4196///
4197/// y = PermuteLayer(x)
4198///
4199/// Requires 1 input and produces 1 output.
4200///
4201/// Input
4202/// Must be a rank 5 blob.
4203/// e.g.: shape ``\[Seq, B, C, H, W\]``.
4204/// Output
4205/// Rank 5 blob. Transposed version of the input, such that dimensions at axis=1 or axis=-4 is unchanged.
4206///
4207///
4208/// Examples:
4209///
4210/// Assume input shape is \[Seq, B, C, H, W\]
4211///
4212/// - If ``axis`` is set to ``\[0, 3, 1, 2\]``,
4213/// then the output has shape ``\[Seq, B, W, C, H\]``
4214///
4215/// - If ``axis`` is set to ``\[3, 1, 2, 0\]``,
4216/// then the output has shape ``\[W, B, C, H, Seq\]``
4217///
4218/// - If ``axis`` is set to ``\[0, 3, 2, 1\]``,
4219/// then the output has shape ``\[Seq, B, W, H, C\]``
4220///
4221/// - If ``axis`` is not set, or is set to ``\[0, 1, 2, 3\]``,
4222/// the output is the same as the input.
4223#[allow(clippy::all)]
4224#[allow(clippy::pedantic)]
4225#[allow(clippy::nursery)]
4226#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
4227pub struct PermuteLayerParams {
4228 ///
4229 /// The order in which to permute the dimensions.
4230 /// Must have length 4 and a permutation of ``\[0, 1, 2, 3\]``.
4231 #[prost(uint64, repeated, tag = "1")]
4232 pub axis: ::prost::alloc::vec::Vec<u64>,
4233}
4234///
4235/// A layer that reorganizes data in the input in specific ways.
4236///
4237/// .. code::
4238///
4239/// y = ReorganizeDataLayer(x)
4240///
4241/// Requires 1 input and produces 1 output.
4242///
4243/// Input
4244/// A blob with rank at least 3.
4245/// e.g.: blob with shape ``\[C, H, W\]``.
4246/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
4247/// Output
4248/// Same rank as the input.
4249/// e.g.: blob with shape ``\[C_out, H_out, W_out\]``.
4250///
4251/// mode == SPACE_TO_DEPTH
4252/// ``\[C_out, H_out, W_out\]`` : ``\[C * blockSize * blockSize, H/blockSize, W/blockSize\]``.
4253/// blockSize must divide H and W.
4254/// Data is moved from the spatial dimensions to the channel dimension. Input is spatially divided into
4255/// non-overlapping blocks of size blockSize X blockSize and data from each block is moved into the
4256/// channel dimension.
4257///
4258/// mode == DEPTH_TO_SPACE
4259/// ``\[C_out, H_out, W_out\]`` : ``\[C/(blockSize * blockSize), H * blockSize, W * blockSize\]``.
4260/// Square of blockSize must divide C.
4261/// Reverse of SPACE_TO_DEPTH. Data is moved from the channel dimension to the spatial dimensions.
4262///
4263/// mode == PIXEL_SHUFFLE
4264/// ``\[C_out, H_out, W_out\]`` : ``\[C/(blockSize * blockSize), H * blockSize, W * blockSize\]``.
4265/// Square of blockSize must divide C.
4266/// Similar to DEPTH_TO_SPACE, but using the pixel-shuffle semantics for channel order in the output space.
4267/// In both modes, elements along the channel dimension are collapsed into
4268/// blocks in the spatial dimensions. The difference is in the arrangement of
4269/// the input-channels' data in the output space. See below example for more
4270/// detail.
4271/// (Only available in Core ML Specification >= 5 (iOS >= 14, macOS >= 11.0)
4272///
4273///
4274/// Examples:
4275///
4276/// Assume input is the following \[C = 8, H = 1, W = 2\] tensor:
4277///
4278/// .. code::
4279///
4280/// \[[[1 2]\] [\[3 4]\] [\[5 6]\] [\[7 8]\] [\[9 10]\] [\[11 12]\] [\[13 14]\] [\[15 16]\]]
4281///
4282/// If block_size == 2 and mode == DEPTH_TO_SPACE, output will be the following
4283/// \[C = 2, H = 2, W = 4\] tensor:
4284///
4285/// .. code::
4286///
4287/// \[[[ 1 5 2 6\]
4288/// \[ 9 13 10 14]\]
4289///
4290/// \[[ 3 7 4 8\]
4291/// \[11 15 12 16]\]]
4292///
4293/// For mode == SPACE_TO_DEPTH, the behavior is the same as mode ==
4294/// DEPTH_TO_SPACE, but with the input and output swapped.
4295///
4296/// If block_size == 2 and mode == PIXEL_SHUFFLE, output will be the following
4297/// \[C = 2, H = 2, W = 4\] tensor:
4298///
4299/// .. code::
4300///
4301/// \[[[ 1 3 2 4\]
4302/// \[ 5 7 6 8]\]
4303///
4304/// \[[ 9 11 10 12\]
4305/// \[13 15 14 16]\]]
4306///
4307#[allow(clippy::all)]
4308#[allow(clippy::pedantic)]
4309#[allow(clippy::nursery)]
4310#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4311pub struct ReorganizeDataLayerParams {
4312 #[prost(enumeration = "reorganize_data_layer_params::ReorganizationType", tag = "1")]
4313 pub mode: i32,
4314 /// must be greater than 1
4315 #[prost(uint64, tag = "2")]
4316 pub block_size: u64,
4317}
4318/// Nested message and enum types in `ReorganizeDataLayerParams`.
4319pub mod reorganize_data_layer_params {
4320 #[allow(clippy::all)]
4321 #[allow(clippy::pedantic)]
4322 #[allow(clippy::nursery)]
4323 #[derive(
4324 Clone,
4325 Copy,
4326 Debug,
4327 PartialEq,
4328 Eq,
4329 Hash,
4330 PartialOrd,
4331 Ord,
4332 ::prost::Enumeration
4333 )]
4334 #[repr(i32)]
4335 pub enum ReorganizationType {
4336 SpaceToDepth = 0,
4337 DepthToSpace = 1,
4338 PixelShuffle = 2,
4339 }
4340 impl ReorganizationType {
4341 /// String value of the enum field names used in the ProtoBuf definition.
4342 ///
4343 /// The values are not transformed in any way and thus are considered stable
4344 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
4345 pub fn as_str_name(&self) -> &'static str {
4346 match self {
4347 Self::SpaceToDepth => "SPACE_TO_DEPTH",
4348 Self::DepthToSpace => "DEPTH_TO_SPACE",
4349 Self::PixelShuffle => "PIXEL_SHUFFLE",
4350 }
4351 }
4352 /// Creates an enum from field names used in the ProtoBuf definition.
4353 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
4354 match value {
4355 "SPACE_TO_DEPTH" => Some(Self::SpaceToDepth),
4356 "DEPTH_TO_SPACE" => Some(Self::DepthToSpace),
4357 "PIXEL_SHUFFLE" => Some(Self::PixelShuffle),
4358 _ => None,
4359 }
4360 }
4361 }
4362}
4363///
4364/// A layer that slices the input data along axis = -1 or -2 or -3.
4365/// For general slice along any axis, please see SliceStaticLayer/SliceDynamicLayer.
4366///
4367/// .. code::
4368///
4369/// y = SliceLayer(x)
4370///
4371/// Requires 1 input and produces 1 output.
4372///
4373/// Input
4374/// A blob that can, in general, have any rank. However, depending on the value of "axis" ,
4375/// there may be additional rank constraints.
4376/// Output
4377/// A blob with the same rank as the input.
4378///
4379/// Sliced section is taken from the interval ``[startIndex, endIndex)``, i.e.
4380/// startIndex is inclusive while endIndex is exclusive.
4381/// stride must be positive and represents the step size for slicing.
4382/// Negative indexing is supported for startIndex and endIndex.
4383/// -1 denotes N-1, -2 denotes N-2 and so on, where N is the length of the dimension to be sliced.
4384///
4385#[allow(clippy::all)]
4386#[allow(clippy::pedantic)]
4387#[allow(clippy::nursery)]
4388#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4389pub struct SliceLayerParams {
4390 /// start of the sliced section. Inclusive.
4391 #[prost(int64, tag = "1")]
4392 pub start_index: i64,
4393 /// end of sliced section. Exclusive.
4394 #[prost(int64, tag = "2")]
4395 pub end_index: i64,
4396 /// The step size. Must be positive.
4397 #[prost(uint64, tag = "3")]
4398 pub stride: u64,
4399 /// The following mapping is used for interpreting this parameter:
4400 /// CHANNEL_AXIS => axis = -3, input must have rank at least 3.
4401 /// HEIGHT_AXIS => axis = -2, input must have rank at least 2.
4402 /// WIDTH_AXIS => axis = -1
4403 #[prost(enumeration = "slice_layer_params::SliceAxis", tag = "4")]
4404 pub axis: i32,
4405}
4406/// Nested message and enum types in `SliceLayerParams`.
4407pub mod slice_layer_params {
4408 #[allow(clippy::all)]
4409 #[allow(clippy::pedantic)]
4410 #[allow(clippy::nursery)]
4411 #[derive(
4412 Clone,
4413 Copy,
4414 Debug,
4415 PartialEq,
4416 Eq,
4417 Hash,
4418 PartialOrd,
4419 Ord,
4420 ::prost::Enumeration
4421 )]
4422 #[repr(i32)]
4423 pub enum SliceAxis {
4424 ChannelAxis = 0,
4425 HeightAxis = 1,
4426 WidthAxis = 2,
4427 }
4428 impl SliceAxis {
4429 /// String value of the enum field names used in the ProtoBuf definition.
4430 ///
4431 /// The values are not transformed in any way and thus are considered stable
4432 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
4433 pub fn as_str_name(&self) -> &'static str {
4434 match self {
4435 Self::ChannelAxis => "CHANNEL_AXIS",
4436 Self::HeightAxis => "HEIGHT_AXIS",
4437 Self::WidthAxis => "WIDTH_AXIS",
4438 }
4439 }
4440 /// Creates an enum from field names used in the ProtoBuf definition.
4441 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
4442 match value {
4443 "CHANNEL_AXIS" => Some(Self::ChannelAxis),
4444 "HEIGHT_AXIS" => Some(Self::HeightAxis),
4445 "WIDTH_AXIS" => Some(Self::WidthAxis),
4446 _ => None,
4447 }
4448 }
4449 }
4450}
4451///
4452/// A layer that reduces the input using a specified operation.
4453///
4454/// .. code::
4455///
4456/// y = ReduceLayer(x)
4457///
4458/// Requires 1 input and produces 1 output.
4459///
4460/// Input
4461/// A blob that can, in general, have any rank. However, depending on the value of "axis" ,
4462/// there may be additional rank constraints.
4463/// Output
4464/// A blob with the same rank as the input, which has 1s on the dimensions specified in the parameter "axis"
4465///
4466/// Values supported for axis are \[-1\], \[-2\], \[-3\], \[-2,-1\], \[-3,-2,-1\]
4467/// and the equivalent positive values (depending on the rank of the input)
4468/// For mode == 'ArgMax', axis must be \[-1\] or \[-2\] or \[-3\].
4469#[allow(clippy::all)]
4470#[allow(clippy::pedantic)]
4471#[allow(clippy::nursery)]
4472#[derive(Clone, Copy, PartialEq, ::prost::Message)]
4473pub struct ReduceLayerParams {
4474 /// Specifies function used to reduce.
4475 #[prost(enumeration = "reduce_layer_params::ReduceOperation", tag = "1")]
4476 pub mode: i32,
4477 ///
4478 /// Used if mode is ``LOGSUM``.
4479 /// Defaults to ``1e-6`` if not set or is set to ``0``.
4480 #[prost(float, tag = "2")]
4481 pub epsilon: f32,
4482 /// The following mapping is used for interpreting this parameter:
4483 /// CHW = axis \[-3, -2, -1\], input must have rank at least 3.
4484 /// HW = axis \[-2, -1\], input must have rank at least 2.
4485 /// C = axis \[-3\]
4486 /// H = axis \[-2\]
4487 /// W = axis \[-1\]
4488 #[prost(enumeration = "reduce_layer_params::ReduceAxis", tag = "3")]
4489 pub axis: i32,
4490}
4491/// Nested message and enum types in `ReduceLayerParams`.
4492pub mod reduce_layer_params {
4493 ///
4494 /// The following reduction operations are supported
4495 /// and are applied on the specified axis of the input array:
4496 ///
4497 /// ``SUM``
4498 /// Sum of all elements
4499 ///
4500 /// .. math:: \sum{x_i}
4501 ///
4502 /// ``AVG``
4503 /// Sum of all elements divided by the number of elements
4504 ///
4505 /// .. math:: \dfrac{\sum^n{x_i}}{n}
4506 ///
4507 /// ``PROD``
4508 /// Product of all elements
4509 ///
4510 /// .. math:: \prod{x_i}
4511 ///
4512 /// ``LOGSUM``
4513 /// Sum of the natural logarithm of all elements
4514 ///
4515 /// .. math:: \sum{\ln{(x_i + \epsilon)}}
4516 ///
4517 /// ``SUMSQUARE``
4518 /// Sum of squares of all elements
4519 ///
4520 /// .. math:: \sum{x^2}
4521 ///
4522 /// ``L1``
4523 /// L1 normalization of all elements
4524 ///
4525 /// .. math:: ||x||_1 = \sum{|x_i|}
4526 ///
4527 /// ``L2``
4528 /// L2 normalization of all elements
4529 ///
4530 /// .. math:: ||x||_2 = \sqrt{\sum{x_i^2}}
4531 ///
4532 /// ``MAX``
4533 /// Maximum of all elements
4534 ///
4535 /// .. math:: \text{max}(x_i)
4536 ///
4537 /// ``MIN``
4538 /// Minimum of all elements
4539 ///
4540 /// .. math:: \text{min}(x_i)
4541 ///
4542 /// ``ARGMAX``
4543 /// Argument of the maximum of all elements
4544 ///
4545 /// .. math:: \text{argmax}(x_i)
4546 ///
4547 #[allow(clippy::all)]
4548 #[allow(clippy::pedantic)]
4549 #[allow(clippy::nursery)]
4550 #[derive(
4551 Clone,
4552 Copy,
4553 Debug,
4554 PartialEq,
4555 Eq,
4556 Hash,
4557 PartialOrd,
4558 Ord,
4559 ::prost::Enumeration
4560 )]
4561 #[repr(i32)]
4562 pub enum ReduceOperation {
4563 Sum = 0,
4564 Avg = 1,
4565 Prod = 2,
4566 Logsum = 3,
4567 Sumsquare = 4,
4568 L1 = 5,
4569 L2 = 6,
4570 Max = 7,
4571 Min = 8,
4572 /// only supported with axis = C, H or W.
4573 Argmax = 9,
4574 }
4575 impl ReduceOperation {
4576 /// String value of the enum field names used in the ProtoBuf definition.
4577 ///
4578 /// The values are not transformed in any way and thus are considered stable
4579 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
4580 pub fn as_str_name(&self) -> &'static str {
4581 match self {
4582 Self::Sum => "SUM",
4583 Self::Avg => "AVG",
4584 Self::Prod => "PROD",
4585 Self::Logsum => "LOGSUM",
4586 Self::Sumsquare => "SUMSQUARE",
4587 Self::L1 => "L1",
4588 Self::L2 => "L2",
4589 Self::Max => "MAX",
4590 Self::Min => "MIN",
4591 Self::Argmax => "ARGMAX",
4592 }
4593 }
4594 /// Creates an enum from field names used in the ProtoBuf definition.
4595 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
4596 match value {
4597 "SUM" => Some(Self::Sum),
4598 "AVG" => Some(Self::Avg),
4599 "PROD" => Some(Self::Prod),
4600 "LOGSUM" => Some(Self::Logsum),
4601 "SUMSQUARE" => Some(Self::Sumsquare),
4602 "L1" => Some(Self::L1),
4603 "L2" => Some(Self::L2),
4604 "MAX" => Some(Self::Max),
4605 "MIN" => Some(Self::Min),
4606 "ARGMAX" => Some(Self::Argmax),
4607 _ => None,
4608 }
4609 }
4610 }
4611 #[allow(clippy::all)]
4612 #[allow(clippy::pedantic)]
4613 #[allow(clippy::nursery)]
4614 #[derive(
4615 Clone,
4616 Copy,
4617 Debug,
4618 PartialEq,
4619 Eq,
4620 Hash,
4621 PartialOrd,
4622 Ord,
4623 ::prost::Enumeration
4624 )]
4625 #[repr(i32)]
4626 pub enum ReduceAxis {
4627 Chw = 0,
4628 Hw = 1,
4629 C = 2,
4630 H = 3,
4631 W = 4,
4632 }
4633 impl ReduceAxis {
4634 /// String value of the enum field names used in the ProtoBuf definition.
4635 ///
4636 /// The values are not transformed in any way and thus are considered stable
4637 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
4638 pub fn as_str_name(&self) -> &'static str {
4639 match self {
4640 Self::Chw => "CHW",
4641 Self::Hw => "HW",
4642 Self::C => "C",
4643 Self::H => "H",
4644 Self::W => "W",
4645 }
4646 }
4647 /// Creates an enum from field names used in the ProtoBuf definition.
4648 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
4649 match value {
4650 "CHW" => Some(Self::Chw),
4651 "HW" => Some(Self::Hw),
4652 "C" => Some(Self::C),
4653 "H" => Some(Self::H),
4654 "W" => Some(Self::W),
4655 _ => None,
4656 }
4657 }
4658 }
4659}
4660///
4661/// A layer that crops the spatial dimensions of an input.
4662/// If two inputs are provided, the shape of the second input is used as the reference shape.
4663///
4664/// .. code::
4665///
4666/// y = CropLayer(x1) or y = CropLayer(x1,x2)
4667///
4668/// Requires 1 or 2 inputs and produces 1 output.
4669///
4670/// Input
4671/// 1 or 2 tensors, each with rank at least 3, both inputs must have equal rank.
4672/// Example:
4673/// - 1 input case: A blob with shape ``\[C, H_in, W_in\]``.
4674/// - 2 input case: 1st blob with shape ``\[C, H_in, W_in\]``, 2nd blob with shape ``\[C, H_out, W_out\]``.
4675///
4676/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
4677///
4678/// Output
4679/// Same rank as the inputs.
4680/// e.g.: A blob with shape ``\[C, H_out, W_out\]``.
4681///
4682/// If one input is used, output is computed as follows:
4683///
4684/// .. code::
4685///
4686/// y = x1\[:, topCropAmount:H_in - bottomCropAmount, leftCropAmount:W_in - rightCropAmount\]
4687///
4688/// topCropAmount == Height startEdgeSize == borderAmounts\[0\].startEdgeSize
4689/// bottomCropAmount == Height endEdgeSize == borderAmounts\[0\].endEdgeSize
4690/// leftCropAmount == Width startEdgeSize == borderAmounts\[1\].startEdgeSize
4691/// rightCropAmount == Width endEdgeSize == borderAmounts\[1\].endEdgeSize
4692///
4693/// H_out = H_in - topCropAmount - bottomCropAmount
4694/// W_out = W_in - leftCropAmount - rightCropAmount
4695///
4696/// If two inputs are used, output is computed as follows:
4697///
4698/// .. code::
4699///
4700/// y = x1\[:, offset[0\]:offset\[0\] + H_out, offset\[1\]:offset\[1\] + W_out]
4701#[allow(clippy::all)]
4702#[allow(clippy::pedantic)]
4703#[allow(clippy::nursery)]
4704#[derive(Clone, PartialEq, ::prost::Message)]
4705pub struct CropLayerParams {
4706 ///
4707 /// The amounts to be cropped from the input.
4708 /// Used only if a single input is provided.
4709 #[prost(message, optional, tag = "1")]
4710 pub crop_amounts: ::core::option::Option<BorderAmounts>,
4711 ///
4712 /// The offset amounts.
4713 /// Used only if two inputs are provided.
4714 /// Must be of length 2, in order ``\[H, W\]``.
4715 #[prost(uint64, repeated, tag = "5")]
4716 pub offset: ::prost::alloc::vec::Vec<u64>,
4717}
4718///
4719/// A layer that computes the elementwise average of the inputs.
4720/// This layer has limited broadcasting support. For general broadcasting see AddBroadcastableLayer.
4721///
4722/// .. code::
4723///
4724/// y = AverageLayer(x1,x2,...)
4725///
4726/// Requires multiple inputs and produces 1 output.
4727///
4728/// Input
4729/// In general, there are no rank constraints.
4730/// However, only certain set of shapes are broadcastable. For example:
4731/// \[B, 1, 1, 1\], \[B, C, 1, 1\], \[B, 1, H, W\], \[B, C, H, W\]
4732/// Output
4733/// A blob with the same shape as each input.
4734#[allow(clippy::all)]
4735#[allow(clippy::pedantic)]
4736#[allow(clippy::nursery)]
4737#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4738pub struct AverageLayerParams {}
4739///
4740/// A layer that computes the elementwise maximum over the inputs.
4741///
4742/// .. code::
4743///
4744/// y = MaxLayer(x1,x2,...)
4745///
4746/// Requires multiple inputs and produces 1 output.
4747///
4748/// Input
4749/// In general, there are no rank constraints.
4750/// However, only certain set of shapes are broadcastable. For example:
4751/// \[B, C, 1, 1\], \[B, C, H, W\]
4752/// Output
4753/// A blob with the same shape as each input.
4754#[allow(clippy::all)]
4755#[allow(clippy::pedantic)]
4756#[allow(clippy::nursery)]
4757#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4758pub struct MaxLayerParams {}
4759///
4760/// A layer that computes the elementwise minimum over the inputs.
4761///
4762/// .. code::
4763///
4764/// y = MinLayer(x1,x2,...)
4765///
4766/// Requires multiple inputs and produces 1 output.
4767///
4768/// Input
4769/// In general, there are no rank constraints.
4770/// However, only certain set of shapes are broadcastable. For example:
4771/// \[B, C, 1, 1\], \[B, C, H, W\]
4772/// Output
4773/// A blob with the same shape as each input.
4774#[allow(clippy::all)]
4775#[allow(clippy::pedantic)]
4776#[allow(clippy::nursery)]
4777#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4778pub struct MinLayerParams {}
4779///
4780/// A layer that computes the dot product of two vectors.
4781///
4782/// .. code::
4783///
4784/// y = DotProductLayer(x1,x2)
4785///
4786/// Requires 2 inputs and produces 1 output.
4787///
4788/// Input
4789/// Two blobs with rank at least 3, such that the last two dimensions must be 1.
4790/// e.g.: blobs with shape ``\[B, C, 1, 1\]``.
4791/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
4792///
4793/// Output
4794/// Same rank as the input.
4795/// e.g. for rank 4 inputs, output shape: \[B, 1, 1, 1\]
4796#[allow(clippy::all)]
4797#[allow(clippy::pedantic)]
4798#[allow(clippy::nursery)]
4799#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4800pub struct DotProductLayerParams {
4801 ///
4802 /// If true, inputs are normalized first,
4803 /// thereby computing the cosine similarity.
4804 #[prost(bool, tag = "1")]
4805 pub cosine_similarity: bool,
4806}
4807///
4808/// A layer that performs mean variance normalization, along axis = -3.
4809///
4810/// .. code::
4811///
4812/// y = MeanVarianceNormalizeLayer(x)
4813///
4814/// Requires 1 input and produces 1 output.
4815///
4816/// Input
4817/// A blob with rank greater than equal to 3.
4818/// Example: Rank 4 blob represents \[Batch, channels, height, width\]
4819/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
4820///
4821/// Output
4822/// A blob with the same shape as the input.
4823///
4824/// If ``acrossChannels == true``
4825/// normalization is performed on flattened input, i.e. the input is reshaped to (Batch,C), where "Batch" contains
4826/// all dimensions from 0 to -4 (inclusive), and C contains dimensions -1, -2, -3.
4827///
4828/// If ``acrossChannels == false``
4829/// normalization is performed within a channel,
4830/// across spatial dimensions (i.e. last two dimensions).
4831#[allow(clippy::all)]
4832#[allow(clippy::pedantic)]
4833#[allow(clippy::nursery)]
4834#[derive(Clone, Copy, PartialEq, ::prost::Message)]
4835pub struct MeanVarianceNormalizeLayerParams {
4836 ///
4837 /// If true, mean and variance are computed across channels.
4838 #[prost(bool, tag = "1")]
4839 pub across_channels: bool,
4840 ///
4841 /// If false, only mean is subtracted.
4842 #[prost(bool, tag = "2")]
4843 pub normalize_variance: bool,
4844 ///
4845 /// A small constant to avoid division by 0 while normalizing variance.
4846 /// Defaults to ``1e-6`` if not set or set to ``0``.
4847 #[prost(float, tag = "3")]
4848 pub epsilon: f32,
4849}
4850///
4851/// A layer that repeats a sequence or the dimension sitting at axis = -5
4852///
4853/// .. code::
4854///
4855/// y = SequenceRepeatLayer(x)
4856///
4857/// Requires 1 input and produces 1 output.
4858///
4859/// Input
4860/// A blob with rank at least 5.
4861/// e.g: shape ``\[Seq, B, C, H, W\]``
4862/// Output
4863/// A blob with the same rank as the input.
4864/// e.g.: for input shape ``\[Seq, B, C, H, W\]``, output shape is ``\[nRepetitions * Seq, B, C, H, W\]``.
4865#[allow(clippy::all)]
4866#[allow(clippy::pedantic)]
4867#[allow(clippy::nursery)]
4868#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
4869pub struct SequenceRepeatLayerParams {
4870 ///
4871 /// Number of repetitions.
4872 /// Defaults to ``1`` if not set or set to ``0``.
4873 #[prost(uint64, tag = "1")]
4874 pub n_repetitions: u64,
4875}
4876///
4877/// A simple recurrent layer.
4878///
4879/// .. code::
4880///
4881/// y_t = SimpleRecurrentLayer(x_t, y_{t-1})
4882///
4883/// Input
4884/// A blob of rank 5, with shape `\[Seq, Batch, inputVectorSize, 1, 1\]``.
4885/// This represents a sequence of vectors of size ``inputVectorSize``.
4886/// Output
4887/// Same rank as the input.
4888/// Represents a vector of size ``outputVectorSize``. It is either the final output or a sequence of outputs at all time steps.
4889///
4890/// - Output Shape: ``\[1, Batch, outputVectorSize, 1, 1\]`` , if ``sequenceOutput == false``
4891/// - Output Shape: ``\[Seq, Batch, outputVectorSize, 1, 1\]`` , if ``sequenceOutput == true``
4892///
4893/// This layer is described by the following equation:
4894///
4895/// .. math::
4896/// \boldsymbol{y_t} = f(\mathrm{clip}(W \boldsymbol{x_t} + \
4897/// R \boldsymbol{y_{t-1}} + b))
4898///
4899/// - ``W`` is a 2-dimensional weight matrix
4900/// (``\[outputVectorSize, inputVectorSize\]``, row-major)
4901/// - ``R`` is a 2-dimensional recursion matrix
4902/// (``\[outputVectorSize, outputVectorSize\]``, row-major)
4903/// - ``b`` is a 1-dimensional bias vector (``\[outputVectorSize\]``)
4904/// - ``f()`` is an activation
4905/// - ``clip()`` is a function that constrains values between ``\[-50.0, 50.0\]``
4906#[allow(clippy::all)]
4907#[allow(clippy::pedantic)]
4908#[allow(clippy::nursery)]
4909#[derive(Clone, PartialEq, ::prost::Message)]
4910pub struct SimpleRecurrentLayerParams {
4911 /// The size of the input vectors.
4912 #[prost(uint64, tag = "1")]
4913 pub input_vector_size: u64,
4914 /// The size of the output vectors.
4915 #[prost(uint64, tag = "2")]
4916 pub output_vector_size: u64,
4917 ///
4918 /// Activations supported are Linear, Sigmoid, Tanh, ReLU, Scaled Tanh (alpha = 1.71, beta = 2/3), Hard sigmoid (alpha = 0.2, beta = 0.5)
4919 ///
4920 /// The activation function.
4921 #[prost(message, optional, tag = "10")]
4922 pub activation: ::core::option::Option<ActivationParams>,
4923 ///
4924 /// If false output is just the result after final state update.
4925 /// If true, output is a sequence, containing outputs at all time steps.
4926 #[prost(bool, tag = "15")]
4927 pub sequence_output: bool,
4928 /// If false, no bias is added.
4929 #[prost(bool, tag = "20")]
4930 pub has_bias_vector: bool,
4931 /// Weight matrix W.
4932 #[prost(message, optional, tag = "30")]
4933 pub weight_matrix: ::core::option::Option<WeightParams>,
4934 /// Recursion Weight matrix R.
4935 #[prost(message, optional, tag = "31")]
4936 pub recursion_matrix: ::core::option::Option<WeightParams>,
4937 /// Bias vector b.
4938 #[prost(message, optional, tag = "32")]
4939 pub bias_vector: ::core::option::Option<WeightParams>,
4940 /// If true, then the node processes the input sequence from right to left
4941 #[prost(bool, tag = "100")]
4942 pub reverse_input: bool,
4943}
4944///
4945/// Gated-Recurrent Unit (GRU) Layer
4946///
4947/// .. code::
4948///
4949/// y_t = GRULayer(x_t, y_{t-1})
4950///
4951/// Input
4952/// A blob of rank 5, with shape `\[Seq, Batch, inputVectorSize, 1, 1\]``.
4953/// This represents a sequence of vectors of size ``inputVectorSize``.
4954/// Output
4955/// Same rank as the input.
4956/// Represents a vector of size ``outputVectorSize``. It is either the final output or a sequence of outputs at all time steps.
4957///
4958/// - Output Shape: ``\[1, Batch, outputVectorSize, 1, 1\]`` , if ``sequenceOutput == false``
4959/// - Output Shape: ``\[Seq, Batch, outputVectorSize, 1, 1\]`` , if ``sequenceOutput == true``
4960///
4961/// This layer is described by the following equations:
4962///
4963/// Update Gate
4964/// .. math::
4965/// \boldsymbol{z_t} = \
4966/// f(\mathrm{clip}(W_z \boldsymbol{x_t} + \
4967/// R_z \boldsymbol{y_{t-1}} + b_z)
4968///
4969/// Reset Gate
4970/// .. math::
4971/// \boldsymbol{r_t} = \
4972/// f(\mathrm{clip}(W_r \boldsymbol{x_t} + \
4973/// R_r \boldsymbol{y_{t-1}} + b_r))
4974///
4975/// Cell Memory State
4976/// .. math::
4977/// \boldsymbol{c_t} = \
4978/// \boldsymbol{y_{t-1}} \odot \boldsymbol{r_t}
4979///
4980/// Output Gate
4981/// .. math::
4982/// \boldsymbol{o_t} = \
4983/// g(\mathrm{clip}(W_o \boldsymbol{x_t} + \
4984/// R_o \boldsymbol{c_t} + b_o))
4985///
4986/// Output
4987/// .. math::
4988/// \boldsymbol{y_t} = \
4989/// (1 - \boldsymbol{z_t}) \odot \boldsymbol{o_t} + \
4990/// \boldsymbol{z_t} \odot \boldsymbol{y_{t-1}}
4991///
4992/// - ``W_z``, ``W_r``, ``W_o`` are 2-dimensional input weight matrices
4993/// (``\[outputVectorSize, inputVectorSize\]``, row-major)
4994/// - ``R_z``, ``R_r``, ``R_o`` are 2-dimensional recursion matrices
4995/// (``\[outputVectorSize, outputVectorSize\]``, row-major)
4996/// - ``b_z``, ``b_r``, ``b_o`` are 1-dimensional bias vectors
4997/// (``\[outputVectorSize\]``)
4998/// - ``f()``, ``g()`` are activations
4999/// - ``clip()`` is a function that constrains values between ``\[-50.0, 50.0\]``
5000/// - ``⊙`` denotes the elementwise product of matrices
5001#[allow(clippy::all)]
5002#[allow(clippy::pedantic)]
5003#[allow(clippy::nursery)]
5004#[derive(Clone, PartialEq, ::prost::Message)]
5005pub struct GruLayerParams {
5006 /// Size of the input vectors.
5007 #[prost(uint64, tag = "1")]
5008 pub input_vector_size: u64,
5009 /// Size of the output vectors.
5010 #[prost(uint64, tag = "2")]
5011 pub output_vector_size: u64,
5012 ///
5013 /// 2 element array representing activations \[f(), g()\] in that order.
5014 /// Typical values used = \[sigmoid, tanh\].
5015 /// Activations supported are Linear, Sigmoid, Tanh, ReLU, Scaled Tanh (alpha = 1.71, beta = 2/3), Hard sigmoid (alpha = 0.2, beta = 0.5)
5016 #[prost(message, repeated, tag = "10")]
5017 pub activations: ::prost::alloc::vec::Vec<ActivationParams>,
5018 ///
5019 /// If false output is just the result after final state update.
5020 /// If true, output is a sequence, containing outputs at all time steps.
5021 #[prost(bool, tag = "15")]
5022 pub sequence_output: bool,
5023 ///
5024 /// If false, no biases (``b_z``, ``b_r``, ``b_o``) are added.
5025 #[prost(bool, tag = "20")]
5026 pub has_bias_vectors: bool,
5027 /// Weight Matrix W_z.
5028 #[prost(message, optional, tag = "30")]
5029 pub update_gate_weight_matrix: ::core::option::Option<WeightParams>,
5030 /// Weight Matrix W_r.
5031 #[prost(message, optional, tag = "31")]
5032 pub reset_gate_weight_matrix: ::core::option::Option<WeightParams>,
5033 /// Weight Matrix W_o.
5034 #[prost(message, optional, tag = "32")]
5035 pub output_gate_weight_matrix: ::core::option::Option<WeightParams>,
5036 /// Recursion Weight Matrix R_z.
5037 #[prost(message, optional, tag = "50")]
5038 pub update_gate_recursion_matrix: ::core::option::Option<WeightParams>,
5039 /// Recursion Weight Matrix R_r.
5040 #[prost(message, optional, tag = "51")]
5041 pub reset_gate_recursion_matrix: ::core::option::Option<WeightParams>,
5042 /// Recursion Weight Matrix R_o.
5043 #[prost(message, optional, tag = "52")]
5044 pub output_gate_recursion_matrix: ::core::option::Option<WeightParams>,
5045 /// Bias vector b_z.
5046 #[prost(message, optional, tag = "70")]
5047 pub update_gate_bias_vector: ::core::option::Option<WeightParams>,
5048 /// Bias vector b_r.
5049 #[prost(message, optional, tag = "71")]
5050 pub reset_gate_bias_vector: ::core::option::Option<WeightParams>,
5051 /// Bias vector b_o.
5052 #[prost(message, optional, tag = "72")]
5053 pub output_gate_bias_vector: ::core::option::Option<WeightParams>,
5054 /// If true, then the node processes the input sequence from right to left
5055 #[prost(bool, tag = "100")]
5056 pub reverse_input: bool,
5057}
5058///
5059/// Long short-term memory (LSTM) parameters.
5060///
5061/// This is described by the following equations:
5062///
5063/// Input Gate
5064/// .. math::
5065/// \boldsymbol{i_t} = \
5066/// f(\mathrm{clip}(W_i \boldsymbol{x_t} + \
5067/// R_i \boldsymbol{y_{t-1}} + \
5068/// p_i \odot c_{t-1} + b_i))
5069///
5070/// Forget Gate
5071/// .. math::
5072/// \boldsymbol{f_t} = \
5073/// f(\mathrm{clip}(W_f \boldsymbol{x_t} + \
5074/// R_f \boldsymbol{y_{t-1}} + \
5075/// p_f \odot c_{t-1} + b_f))
5076///
5077/// Block Input
5078/// .. math::
5079/// \boldsymbol{z_t} = \
5080/// g(\mathrm{clip}(W_z \boldsymbol{x_t} + \
5081/// R_z \boldsymbol{y_{t-1}} + b_z))
5082///
5083/// Cell Memory State
5084/// .. math::
5085/// \boldsymbol{c_t} = \
5086/// \boldsymbol{c_{t-1}} \odot \boldsymbol{f_t} + \
5087/// \boldsymbol{i_t} \odot \boldsymbol{z_t}
5088///
5089/// Output Gate
5090/// .. math::
5091/// \boldsymbol{o_t} = \
5092/// f(\mathrm{clip}(W_o \boldsymbol{x_t} + \
5093/// R_o \boldsymbol{y_{t-1}} + \
5094/// p_o \odot c_t + b_o))
5095///
5096/// Output
5097/// .. math::
5098/// \boldsymbol{y_t} = \
5099/// h(\boldsymbol{c_t}) \odot \boldsymbol{o_t}
5100///
5101/// - ``W_i``, ``W_f``, ``W_z``, ``W_o`` are 2-dimensional input weight matrices
5102/// (``\[outputVectorSize, inputVectorSize\]``, row-major)
5103/// - ``R_i``, ``R_f``, ``R_z``, ``R_o`` are 2-dimensional recursion matrices
5104/// (``\[outputVectorSize, outputVectorSize\]``, row-major)
5105/// - ``b_i``, ``b_f``, ``b_z``, ``b_o`` are 1-dimensional bias vectors
5106/// (``\[outputVectorSize\]``)
5107/// - ``p_``, ``p_f``, ``p_o`` are 1-dimensional peephole vectors
5108/// (``\[outputVectorSize\]``)
5109/// - ``f()``, ``g()``, ``h()`` are activations
5110/// - ``clip()`` is a function that constrains values between ``\[-50.0, 50.0\]``
5111/// - ``⊙`` denotes the elementwise product of matrices
5112#[allow(clippy::all)]
5113#[allow(clippy::pedantic)]
5114#[allow(clippy::nursery)]
5115#[derive(Clone, Copy, PartialEq, ::prost::Message)]
5116pub struct LstmParams {
5117 ///
5118 /// If true, output is a sequence, containing outputs at all time steps.
5119 /// If false, output is just the result after final state update.
5120 #[prost(bool, tag = "10")]
5121 pub sequence_output: bool,
5122 ///
5123 /// If false, no biases (``b_i``, ``b_f``, ``b_z``, ``b_o``) are added.
5124 #[prost(bool, tag = "20")]
5125 pub has_bias_vectors: bool,
5126 ///
5127 /// If true, a vector of ``1`` values is added to ``b_f``.
5128 #[prost(bool, tag = "30")]
5129 pub forget_bias: bool,
5130 ///
5131 /// If true, peephole vectors are included.
5132 #[prost(bool, tag = "40")]
5133 pub has_peephole_vectors: bool,
5134 ///
5135 /// If the coupled Input and Forget flag is on, the behaviour of
5136 /// ``c_t`` is changed to the following (i.e. forget gate is not used):
5137 ///
5138 /// .. math::
5139 /// \boldsymbol{c_t} = \
5140 /// \boldsymbol{c_{t-1}} \odot (1 - \boldsymbol{i_t}) + \
5141 /// \boldsymbol{i_t} \odot \boldsymbol{z_t}
5142 ///
5143 #[prost(bool, tag = "50")]
5144 pub coupled_input_and_forget_gate: bool,
5145 ///
5146 /// Places a limit on the maximum and minimum values of ``c_t``.
5147 /// c_t = min(c_t, cellClipThreshold)
5148 /// c_t = max(c_t, -cellClipThreshold)
5149 /// If 0, it is set to its default value = 50.0.
5150 #[prost(float, tag = "60")]
5151 pub cell_clip_threshold: f32,
5152}
5153///
5154/// Weights for long short-term memory (LSTM) layers
5155#[allow(clippy::all)]
5156#[allow(clippy::pedantic)]
5157#[allow(clippy::nursery)]
5158#[derive(Clone, PartialEq, ::prost::Message)]
5159pub struct LstmWeightParams {
5160 /// Weight Matrix W_i.
5161 #[prost(message, optional, tag = "1")]
5162 pub input_gate_weight_matrix: ::core::option::Option<WeightParams>,
5163 /// Weight Matrix W_f.
5164 #[prost(message, optional, tag = "2")]
5165 pub forget_gate_weight_matrix: ::core::option::Option<WeightParams>,
5166 /// Weight Matrix W_z.
5167 #[prost(message, optional, tag = "3")]
5168 pub block_input_weight_matrix: ::core::option::Option<WeightParams>,
5169 /// Weight Matrix W_o.
5170 #[prost(message, optional, tag = "4")]
5171 pub output_gate_weight_matrix: ::core::option::Option<WeightParams>,
5172 /// Recursion Weight Matrix R_i.
5173 #[prost(message, optional, tag = "20")]
5174 pub input_gate_recursion_matrix: ::core::option::Option<WeightParams>,
5175 /// Recursion Weight Matrix R_f.
5176 #[prost(message, optional, tag = "21")]
5177 pub forget_gate_recursion_matrix: ::core::option::Option<WeightParams>,
5178 /// Recursion Weight Matrix R_z.
5179 #[prost(message, optional, tag = "22")]
5180 pub block_input_recursion_matrix: ::core::option::Option<WeightParams>,
5181 /// Recursion Weight Matrix R_o.
5182 #[prost(message, optional, tag = "23")]
5183 pub output_gate_recursion_matrix: ::core::option::Option<WeightParams>,
5184 /// biases:
5185 ///
5186 /// Bias vector b_i.
5187 #[prost(message, optional, tag = "40")]
5188 pub input_gate_bias_vector: ::core::option::Option<WeightParams>,
5189 /// Bias vector b_f.
5190 #[prost(message, optional, tag = "41")]
5191 pub forget_gate_bias_vector: ::core::option::Option<WeightParams>,
5192 /// Bias vector b_z.
5193 #[prost(message, optional, tag = "42")]
5194 pub block_input_bias_vector: ::core::option::Option<WeightParams>,
5195 /// Bias vector b_o.
5196 #[prost(message, optional, tag = "43")]
5197 pub output_gate_bias_vector: ::core::option::Option<WeightParams>,
5198 /// peepholes:
5199 ///
5200 /// Peephole vector p_i.
5201 #[prost(message, optional, tag = "60")]
5202 pub input_gate_peephole_vector: ::core::option::Option<WeightParams>,
5203 /// Peephole vector p_f.
5204 #[prost(message, optional, tag = "61")]
5205 pub forget_gate_peephole_vector: ::core::option::Option<WeightParams>,
5206 /// Peephole vector p_o.
5207 #[prost(message, optional, tag = "62")]
5208 pub output_gate_peephole_vector: ::core::option::Option<WeightParams>,
5209}
5210///
5211/// A unidirectional long short-term memory (LSTM) layer.
5212///
5213/// .. code::
5214///
5215/// (y_t, c_t) = UniDirectionalLSTMLayer(x_t, y_{t-1}, c_{t-1})
5216///
5217/// Input
5218/// A blob of rank 5, with shape `\[Seq, Batch, inputVectorSize, 1, 1\]``.
5219/// This represents a sequence of vectors of size ``inputVectorSize``.
5220/// Output
5221/// Same rank as the input.
5222/// Represents a vector of size ``outputVectorSize``. It is either the final output or a sequence of outputs at all time steps.
5223///
5224/// - Output Shape: ``\[1, Batch, outputVectorSize, 1, 1\]`` , if ``sequenceOutput == false``
5225/// - Output Shape: ``\[Seq, Batch, outputVectorSize, 1, 1\]`` , if ``sequenceOutput == true``
5226///
5227#[allow(clippy::all)]
5228#[allow(clippy::pedantic)]
5229#[allow(clippy::nursery)]
5230#[derive(Clone, PartialEq, ::prost::Message)]
5231pub struct UniDirectionalLstmLayerParams {
5232 /// Size of the input vectors.
5233 #[prost(uint64, tag = "1")]
5234 pub input_vector_size: u64,
5235 /// Size of the output vectors.
5236 #[prost(uint64, tag = "2")]
5237 pub output_vector_size: u64,
5238 ///
5239 /// 3 element array representing activations \[f(),g(),h()\] in that order.
5240 /// Typical values used = \[sigmoid, tanh, tanh\].
5241 /// Activations supported are Linear, Sigmoid, Tanh, ReLU, Scaled Tanh (alpha = 1.71, beta = 2/3), Hard sigmoid (alpha = 0.2, beta = 0.5)
5242 #[prost(message, repeated, tag = "10")]
5243 pub activations: ::prost::alloc::vec::Vec<ActivationParams>,
5244 #[prost(message, optional, tag = "15")]
5245 pub params: ::core::option::Option<LstmParams>,
5246 /// Weights, biases and peepholes.
5247 #[prost(message, optional, tag = "20")]
5248 pub weight_params: ::core::option::Option<LstmWeightParams>,
5249 /// If true, then the node processes the input sequence from right to left
5250 #[prost(bool, tag = "100")]
5251 pub reverse_input: bool,
5252}
5253///
5254/// Bidirectional long short-term memory (LSTM) layer
5255///
5256/// .. code::
5257///
5258/// (y_t, c_t, y_t_reverse, c_t_reverse) = BiDirectionalLSTMLayer(x_t, y_{t-1}, c_{t-1}, y_{t-1}_reverse, c_{t-1}_reverse)
5259///
5260/// Input
5261/// A blob of rank 5, with shape `\[Seq, Batch, inputVectorSize, 1, 1\]``.
5262/// This represents a sequence of vectors of size ``inputVectorSize``.
5263/// Output
5264/// Same rank as the input.
5265/// Represents a vector of size ``2 * outputVectorSize``. It is either the final output or a sequence of outputs at all time steps.
5266///
5267/// - Output Shape: ``\[1, Batch, 2 * outputVectorSize, 1, 1\]`` , if ``sequenceOutput == false``
5268/// - Output Shape: ``\[Seq, Batch, 2 * outputVectorSize, 1, 1\]`` , if ``sequenceOutput == true``
5269///
5270///
5271/// The first LSTM operates on the input sequence in the forward direction.
5272/// The second LSTM operates on the input sequence in the reverse direction.
5273///
5274/// Example: given the input sequence ``\[x_1, x_2, x_3\]``,
5275/// where ``x_i`` are vectors at time index ``i``:
5276///
5277/// The forward LSTM output is ``\[yf_1, yf_2, yf_3\]``,
5278///
5279/// where ``yf_i`` are vectors of size ``outputVectorSize``:
5280///
5281/// - ``yf_1`` is the output at the end of sequence {``x_1``}
5282/// - ``yf_2`` is the output at the end of sequence {``x_1``, ``x_2``}
5283/// - ``yf_3`` is the output at the end of sequence {``x_1``, ``x_2``, ``x_3``}
5284///
5285/// The backward LSTM output: ``\[yb_1, yb_2, yb_3\]``,
5286///
5287/// where ``yb_i`` are vectors of size ``outputVectorSize``:
5288///
5289/// - ``yb_1`` is the output at the end of sequence {``x_3``}
5290/// - ``yb_2`` is the output at the end of sequence {``x_3``, ``x_2``}
5291/// - ``yb_3`` is the output at the end of sequence {``x_3``, ``x_2``, ``x_1``}
5292///
5293/// Output of the bi-dir layer:
5294///
5295/// - if ``sequenceOutput = True`` : { ``\[yf_1, yb_3\]``, ``\[yf_2, yb_2\]``, ``\[yf_3, yb_1\]`` }
5296/// - if ``sequenceOutput = False`` : { ``\[yf_3, yb_3\]`` }
5297#[allow(clippy::all)]
5298#[allow(clippy::pedantic)]
5299#[allow(clippy::nursery)]
5300#[derive(Clone, PartialEq, ::prost::Message)]
5301pub struct BiDirectionalLstmLayerParams {
5302 ///
5303 /// Size of the input vectors.
5304 #[prost(uint64, tag = "1")]
5305 pub input_vector_size: u64,
5306 ///
5307 /// Size of the outputs vectors.
5308 /// It is same for both forward and backward LSTMs.
5309 #[prost(uint64, tag = "2")]
5310 pub output_vector_size: u64,
5311 ///
5312 /// 3 element array representing activations \[f(),g(),h()\] in that order.
5313 /// Typical values used = \[sigmoid, tanh, tanh\].
5314 /// Activations supported are Linear, Sigmoid, Tanh, ReLU, Scaled Tanh (alpha = 1.71, beta = 2/3), Hard sigmoid (alpha = 0.2, beta = 0.5)
5315 #[prost(message, repeated, tag = "10")]
5316 pub activations_forward_lstm: ::prost::alloc::vec::Vec<ActivationParams>,
5317 ///
5318 /// Currently, backward LSTM activations
5319 /// must be same as the ones for the forward LSTM.
5320 #[prost(message, repeated, tag = "11")]
5321 pub activations_backward_lstm: ::prost::alloc::vec::Vec<ActivationParams>,
5322 ///
5323 /// Common parameters shared by the forward and backward LSTMs.
5324 #[prost(message, optional, tag = "15")]
5325 pub params: ::core::option::Option<LstmParams>,
5326 ///
5327 /// Weights and biases.
5328 /// Must be a length 2 message,
5329 /// for the forward and backward LSTM respectively.
5330 #[prost(message, repeated, tag = "20")]
5331 pub weight_params: ::prost::alloc::vec::Vec<LstmWeightParams>,
5332}
5333#[allow(clippy::all)]
5334#[allow(clippy::pedantic)]
5335#[allow(clippy::nursery)]
5336#[derive(Clone, PartialEq, ::prost::Message)]
5337pub struct CustomLayerParams {
5338 /// The name of the class (conforming to MLCustomLayer) corresponding to this layer
5339 #[prost(string, tag = "10")]
5340 pub class_name: ::prost::alloc::string::String,
5341 /// Any weights -- these are serialized in binary format and memmapped at runtime
5342 #[prost(message, repeated, tag = "20")]
5343 pub weights: ::prost::alloc::vec::Vec<WeightParams>,
5344 /// these may be handled as strings, so this should not be large
5345 #[prost(map = "string, message", tag = "30")]
5346 pub parameters: ::std::collections::HashMap<
5347 ::prost::alloc::string::String,
5348 custom_layer_params::CustomLayerParamValue,
5349 >,
5350 /// An (optional) description of the layer provided by the model creator. This information is displayed when viewing the model, but does not affect the model's execution on device.
5351 #[prost(string, tag = "40")]
5352 pub description: ::prost::alloc::string::String,
5353}
5354/// Nested message and enum types in `CustomLayerParams`.
5355pub mod custom_layer_params {
5356 #[allow(clippy::all)]
5357 #[allow(clippy::pedantic)]
5358 #[allow(clippy::nursery)]
5359 #[derive(Clone, PartialEq, ::prost::Message)]
5360 pub struct CustomLayerParamValue {
5361 #[prost(oneof = "custom_layer_param_value::Value", tags = "10, 20, 30, 40, 50")]
5362 pub value: ::core::option::Option<custom_layer_param_value::Value>,
5363 }
5364 /// Nested message and enum types in `CustomLayerParamValue`.
5365 pub mod custom_layer_param_value {
5366 #[allow(clippy::all)]
5367 #[allow(clippy::pedantic)]
5368 #[allow(clippy::nursery)]
5369 #[derive(Clone, PartialEq, ::prost::Oneof)]
5370 pub enum Value {
5371 #[prost(double, tag = "10")]
5372 DoubleValue(f64),
5373 #[prost(string, tag = "20")]
5374 StringValue(::prost::alloc::string::String),
5375 #[prost(int32, tag = "30")]
5376 IntValue(i32),
5377 #[prost(int64, tag = "40")]
5378 LongValue(i64),
5379 #[prost(bool, tag = "50")]
5380 BoolValue(bool),
5381 }
5382 }
5383}
5384#[allow(clippy::all)]
5385#[allow(clippy::pedantic)]
5386#[allow(clippy::nursery)]
5387#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5388pub struct TransposeLayerParams {
5389 ///
5390 /// Length of "axes" should match the rank of input & output tensor
5391 /// "axes" should be a permutation of "\[0,1,2,...,N-1\]" where N is the rank.
5392 ///
5393 ///
5394 #[prost(uint64, repeated, tag = "1")]
5395 pub axes: ::prost::alloc::vec::Vec<u64>,
5396}
5397///
5398/// A layer that computes the matrix multiplication of two tensors with numpy-like broadcasting
5399/// where the matrices reside in the last two indices of the tensor.
5400///
5401/// .. code::
5402///
5403/// y = BatchedMatMul(a,b)
5404///
5405/// Requires 1 or 2 inputs and produces 1 output.
5406///
5407/// The first tensor, "a", must be provided as an input. The second tensor can either be an input or provided as a weight matrix parameter.
5408///
5409/// Input
5410/// - a: First N-Dimensional tensor
5411/// - b: Second N-Dimensional tensor (either a rank-N input or a matrix, i.e. N=2, provided as a layer parameter)
5412///
5413/// Output
5414/// A tensor containing the matrix product of two tensors.
5415/// When there are two inputs: rank is max(2, rank(a), rank(b))
5416/// When there is one input: rank is same as that of the input.
5417///
5418/// This operation behaves as following:
5419///
5420/// When there are two inputs:
5421/// - If N >= 2 for both tensors, it is treated as a batch of matrices residing in the last two indices.
5422/// All the indices, except for the last two, are broadcasted using conventional rules.
5423/// - If the first tensor is 1-D, it is converted to a 2-D tensor by prepending a 1 to its shape. Eg. (D) -> (1,D)
5424/// - If the second tensor is 1-D, it is converted to a 2-D tensor by appending a 1 to its shape. Eg. (D) -> (D,1)
5425///
5426/// When there is one input:
5427/// - The weight matrix corresponds to a matrix, of shape (X1, X2). Values of X1, X2 must be provided as layer parameters.
5428/// - The input, "a", is reshaped into a matrix by combining all the leading dimensions, except the last, into a batch dimension. eg:
5429/// - if "a" is rank 1 (X1,) --> (1, X1). Output shape will be (X2,)
5430/// - if "a" is rank 2 (B1, X1) --> no need to reshape. Output shape will be (B1, X2)
5431/// - if "a" is rank 3 (B1, B2, X1) --> (B1 * B2, X1). Output shape will be (B1, B2, X2)
5432/// - etc
5433#[allow(clippy::all)]
5434#[allow(clippy::pedantic)]
5435#[allow(clippy::nursery)]
5436#[derive(Clone, PartialEq, ::prost::Message)]
5437pub struct BatchedMatMulLayerParams {
5438 ///
5439 /// If transposeA is true, it transposes the left matrix on the fly before matrix multiplication.
5440 /// (is ignored when there is one input)
5441 #[prost(bool, tag = "1")]
5442 pub transpose_a: bool,
5443 ///
5444 /// If transposeB is true, it transposes the right matrix on the fly before matrix multiplication.
5445 /// (is ignored when there is one input)
5446 #[prost(bool, tag = "2")]
5447 pub transpose_b: bool,
5448 /// X1: same as the last dimension of the input tensor
5449 #[prost(uint64, tag = "5")]
5450 pub weight_matrix_first_dimension: u64,
5451 /// X2: same as the last dimension of the output tensor
5452 #[prost(uint64, tag = "6")]
5453 pub weight_matrix_second_dimension: u64,
5454 /// Whether a bias is added or not. Supported only when there is one input.
5455 #[prost(bool, tag = "7")]
5456 pub has_bias: bool,
5457 ///
5458 /// Weight matrix representing shape \[X1, X2\].
5459 /// Values are however stored in column major order,
5460 /// in the "repeated float" or "bytes" fields of the message "WeightParams"
5461 #[prost(message, optional, tag = "8")]
5462 pub weights: ::core::option::Option<WeightParams>,
5463 /// Bias vector \[X2\]. Supported only when there is one input.
5464 #[prost(message, optional, tag = "9")]
5465 pub bias: ::core::option::Option<WeightParams>,
5466 ///
5467 /// If set, this layer, at runtime, quantizes the floating point input blob to int8 before applying the
5468 /// matrix multiplication using the INT8 weight parameters provided in weights->int8RawValue. The
5469 /// result is then dequantized.
5470 /// Requires:
5471 /// * number of inputs to be 1
5472 /// * hasBias == false
5473 /// * QuantizationType == LinearQuantizationParams, such that
5474 /// * size of the "scale" field is 1 and "bias" field is empty in "LinearQuantizationParams"
5475 /// * numberOfBits == 8
5476 /// * weights->rawValue_size to be empty
5477 #[prost(bool, tag = "10")]
5478 pub int8_dynamic_quantize: bool,
5479}
5480///
5481/// A layer that concatenates a list of tensors along a specified axis.
5482///
5483/// .. code::
5484///
5485/// y = ConcatNDLayer(x1,x2,....)
5486///
5487/// Requires at least 2 input and produces 1 output.
5488///
5489/// Input
5490/// The rank of the input tensors must match and all dimensions also must match, except for the dimension 'axis'.
5491///
5492///
5493/// Output
5494/// Same rank as the input. The dimension along "axis", is the sum of the dimensions of the inputs.
5495///
5496/// example:
5497///
5498/// in1 : shape (3, 2), value = \[[1, 2\], \[3, 4\], \[5, 6]\]
5499/// in2 : shape (3, 2), value = \[[7, 8\], \[9, 10\], \[11, 12]\]
5500/// axis = 0
5501///
5502/// if interleave = False (default)
5503/// output : shape (6, 2)
5504/// output\[0:3, :\] = in1
5505/// output\[3:6, :\] = in2
5506/// value = \[[1, 2\], \[3, 4\], \[5, 6\], \[7, 8\], \[9, 10\], \[11, 12]\]
5507///
5508/// if interleave = True
5509/// output : shape (6, 2)
5510/// output\[0::2, :\] = in1
5511/// output\[1::2, :\] = in2
5512/// value = \[[1, 2\], \[7, 8\], \[3, 4\], \[9, 10\], \[5, 6\], \[11, 12]\]
5513///
5514#[allow(clippy::all)]
5515#[allow(clippy::pedantic)]
5516#[allow(clippy::nursery)]
5517#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5518pub struct ConcatNdLayerParams {
5519 ///
5520 /// Dimension along which to concatenate. Supports negative values of the parameter 'axis'.
5521 #[prost(int64, tag = "1")]
5522 pub axis: i64,
5523 ///
5524 /// (Only available in Core ML Specification >= 5 (iOS >= 14, macOS >= 11.0)
5525 /// Interleave option. If True, concatenation is done via interleaving the inputs.
5526 /// This requires all inputs to have the exact same shape.
5527 #[prost(bool, tag = "2")]
5528 pub interleave: bool,
5529}
5530///
5531/// A layer that performs softmax normalization along a specified axis.
5532///
5533/// .. code::
5534///
5535/// y = SoftmaxNDLayer(x)
5536///
5537/// Requires 1 input and produces 1 output.
5538///
5539/// Output shape is same as the input.
5540#[allow(clippy::all)]
5541#[allow(clippy::pedantic)]
5542#[allow(clippy::nursery)]
5543#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5544pub struct SoftmaxNdLayerParams {
5545 ///
5546 /// Dimension on which the softmax would be performed. Supports negative values of the parameter 'axis'.
5547 #[prost(int64, tag = "1")]
5548 pub axis: i64,
5549}
5550///
5551/// A layer that reverses specific dimensions of the input tensor.
5552/// It is similar in functionality to the numpy.flip method.
5553///
5554/// Requires 1 input and produces 1 output.
5555/// Output shape is same as the input.
5556#[allow(clippy::all)]
5557#[allow(clippy::pedantic)]
5558#[allow(clippy::nursery)]
5559#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
5560pub struct ReverseLayerParams {
5561 ///
5562 /// Reverses each dimension of the input tensor for which corresponding reverseDim is set to True.
5563 /// Requires len(reverseDim) == rank(inputTensor)
5564 #[prost(bool, repeated, tag = "1")]
5565 pub reverse_dim: ::prost::alloc::vec::Vec<bool>,
5566}
5567///
5568/// A layer that reverses variable length slices.
5569///
5570/// Requires 2 inputs and produces 1 output.
5571///
5572/// 2 inputs, in order are denoted by "data", "seq_lengths".
5573/// "seq_lenghts" must be a rank 1 tensor, i.e. seq_lengths.shape = (B,)
5574/// which contains the lengths of the amount of sequence to be reversed, for each element of the batch.
5575/// Dimension "batchAxis" in "data" must be equal to B, i.e,
5576/// data.shape\[batchAxis\] = B.
5577///
5578/// According to the batch axis, input "data" is first divided into a batch of B inputs,
5579/// each of which is flipped along the dimension "sequenceAxis", by the amount specified in
5580/// "seq_lengths", the second input.
5581///
5582/// e.g.:
5583///
5584/// data \[shape = (2,4)\]:
5585/// \[0 1 2 3\]
5586/// \[4 5 6 7\]
5587/// seq_lengths \[shape = (2,)\]:
5588/// \[3, 0\]
5589/// batchAxis = 0
5590/// sequenceAxis = 1
5591///
5592/// output \[shape = (2,4)\]:
5593/// \[2 1 0 3\]
5594/// \[4 5 6 7\]
5595///
5596///
5597/// data \[shape = (2,3,2)\]:
5598/// \[0 1\]
5599/// \[2 3\]
5600/// \[4 5\] (slice = 0)
5601/// \[6 7\]
5602/// \[8 9\]
5603/// \[10 11\] (slice = 1)
5604/// seq_lengths \[shape = (2,)\]:
5605/// \[2, 3\]
5606/// batchAxis = 0
5607/// sequenceAxis = 1
5608///
5609/// output \[shape = (2,3,2)\]:
5610/// \[2 3\]
5611/// \[0 1\]
5612/// \[4 5\] (slice = 0)
5613/// \[10 11\]
5614/// \[8 9\]
5615/// \[6 7\] (slice = 1)
5616///
5617/// Output shape is same as the input.
5618#[allow(clippy::all)]
5619#[allow(clippy::pedantic)]
5620#[allow(clippy::nursery)]
5621#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5622pub struct ReverseSeqLayerParams {
5623 /// batch axis has to be strictly less than seq_axis
5624 #[prost(int64, tag = "1")]
5625 pub batch_axis: i64,
5626 #[prost(int64, tag = "2")]
5627 pub sequence_axis: i64,
5628}
5629///
5630/// A layer that loads data as a parameter and provides it as an output.
5631///
5632/// .. code::
5633///
5634/// y = LoadConstantNDLayer()
5635///
5636/// Requires no input and produces 1 output.
5637///
5638/// Output: A tensor with shape as provided in the parameter "shape"
5639#[allow(clippy::all)]
5640#[allow(clippy::pedantic)]
5641#[allow(clippy::nursery)]
5642#[derive(Clone, PartialEq, ::prost::Message)]
5643pub struct LoadConstantNdLayerParams {
5644 ///
5645 /// The shape of the constant to be loaded.
5646 #[prost(uint64, repeated, tag = "1")]
5647 pub shape: ::prost::alloc::vec::Vec<u64>,
5648 #[prost(message, optional, tag = "2")]
5649 pub data: ::core::option::Option<WeightParams>,
5650}
5651///
5652/// A layer that generates an output tensor with a constant value.
5653/// Input is only used to determine the shape of the output.
5654/// This layer is used to allocate a tensor with a dynamic shape (that of the input) and constant value.
5655///
5656/// Requires 1 input and produces 1 output.
5657///
5658/// .. code::
5659///
5660/// y = FillLikeLayer(x)
5661///
5662/// Input
5663/// A N-Dimensional tensor, whose values are ignored. Only the shape is used to
5664/// infer the shape of the output.
5665///
5666/// Output
5667/// A N-Dimensional tensor with the same shape as the input tensor.
5668///
5669#[allow(clippy::all)]
5670#[allow(clippy::pedantic)]
5671#[allow(clippy::nursery)]
5672#[derive(Clone, Copy, PartialEq, ::prost::Message)]
5673pub struct FillLikeLayerParams {
5674 #[prost(float, tag = "1")]
5675 pub value: f32,
5676}
5677///
5678/// A layer that generates an output tensor with a constant value.
5679/// This layer is used to allocate a tensor with a static shape and constant value.
5680///
5681/// Requires no input and produces 1 output.
5682///
5683/// .. code::
5684///
5685/// y = FillStaticLayer(x)
5686///
5687/// Output
5688/// A N-Dimensional tensor of shape "targetShape".
5689///
5690#[allow(clippy::all)]
5691#[allow(clippy::pedantic)]
5692#[allow(clippy::nursery)]
5693#[derive(Clone, PartialEq, ::prost::Message)]
5694pub struct FillStaticLayerParams {
5695 #[prost(float, tag = "1")]
5696 pub value: f32,
5697 #[prost(uint64, repeated, tag = "2")]
5698 pub target_shape: ::prost::alloc::vec::Vec<u64>,
5699}
5700///
5701/// A layer that generates an output tensor with a constant value.
5702/// This layer is used to allocate a tensor with a dynamic shape (as specified by the input) and constant value.
5703///
5704/// Requires 1 input and produces 1 output.
5705///
5706/// .. code::
5707///
5708/// y = FillDynamicLayer(x)
5709///
5710/// Input
5711/// A rank 1 tensor specifying the shape of the output
5712///
5713/// Output
5714/// An N-Dimensional tensor with the shape specified by the values in the input tensor.
5715///
5716#[allow(clippy::all)]
5717#[allow(clippy::pedantic)]
5718#[allow(clippy::nursery)]
5719#[derive(Clone, Copy, PartialEq, ::prost::Message)]
5720pub struct FillDynamicLayerParams {
5721 #[prost(float, tag = "1")]
5722 pub value: f32,
5723}
5724///
5725/// A layer that returns the elements either from tensor x or tensor y,
5726/// depending on the value in the condition tensor.
5727/// It is similar in functionality to the numpy.where method with 3 inputs.
5728///
5729/// Requires 3 inputs and produces 1 output.
5730/// Inputs, in order, are the condition tensor, x and y.
5731///
5732/// for each vector index (i,...,j):
5733/// output\[i,...,j\] = x\[i,...,j\] if condition\[i,...,j\] = True
5734/// y\[i,...,j\] if condition\[i,...,j\] = False
5735///
5736/// All the 3 inputs are first broadcasted to a common shape.
5737/// (the shapes must be broadcastable)
5738///
5739/// output.rank = max(input\[0\].rank, input\[1\].rank, input\[2\].rank)
5740///
5741#[allow(clippy::all)]
5742#[allow(clippy::pedantic)]
5743#[allow(clippy::nursery)]
5744#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5745pub struct WhereBroadcastableLayerParams {}
5746///
5747/// A layer that computes elementwise trigonometric sine function.
5748///
5749///
5750/// .. code::
5751///
5752/// y = SinLayer(x)
5753///
5754/// Requires 1 input and produces 1 output.
5755/// Output shape is same as the input.
5756///
5757#[allow(clippy::all)]
5758#[allow(clippy::pedantic)]
5759#[allow(clippy::nursery)]
5760#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5761pub struct SinLayerParams {}
5762///
5763/// A layer that computes elementwise trigonometric cosine function.
5764///
5765///
5766/// .. code::
5767///
5768/// y = CosLayer(x)
5769///
5770/// Requires 1 input and produces 1 output.
5771/// Output shape is same as the input.
5772///
5773#[allow(clippy::all)]
5774#[allow(clippy::pedantic)]
5775#[allow(clippy::nursery)]
5776#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5777pub struct CosLayerParams {}
5778///
5779/// A layer that computes elementwise trigonometric tangent function.
5780///
5781///
5782/// .. code::
5783///
5784/// y = TanLayer(x)
5785///
5786/// Requires 1 input and produces 1 output.
5787/// Output shape is same as the input.
5788///
5789#[allow(clippy::all)]
5790#[allow(clippy::pedantic)]
5791#[allow(clippy::nursery)]
5792#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5793pub struct TanLayerParams {}
5794///
5795/// A layer that computes elementwise trigonometric arcsine function.
5796///
5797///
5798/// .. code::
5799///
5800/// y = AsinLayer(x)
5801///
5802/// Requires 1 input and produces 1 output.
5803/// Output shape is same as the input.
5804///
5805#[allow(clippy::all)]
5806#[allow(clippy::pedantic)]
5807#[allow(clippy::nursery)]
5808#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5809pub struct AsinLayerParams {}
5810///
5811/// A layer that computes elementwise trigonometric arccosine function.
5812///
5813///
5814/// .. code::
5815///
5816/// y = AcosLayer(x)
5817///
5818/// Requires 1 input and produces 1 output.
5819/// Output shape is same as the input.
5820///
5821#[allow(clippy::all)]
5822#[allow(clippy::pedantic)]
5823#[allow(clippy::nursery)]
5824#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5825pub struct AcosLayerParams {}
5826///
5827/// A layer that computes elementwise trigonometric arctangent function.
5828///
5829///
5830/// .. code::
5831///
5832/// y = AtanLayer(x)
5833///
5834/// Requires 1 input and produces 1 output.
5835/// Output shape is same as the input.
5836///
5837#[allow(clippy::all)]
5838#[allow(clippy::pedantic)]
5839#[allow(clippy::nursery)]
5840#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5841pub struct AtanLayerParams {}
5842///
5843/// A layer that computes elementwise trigonometric hyperbolic sine function.
5844///
5845///
5846/// .. code::
5847///
5848/// y = SinhLayer(x)
5849///
5850/// Requires 1 input and produces 1 output.
5851/// Output shape is same as the input.
5852///
5853#[allow(clippy::all)]
5854#[allow(clippy::pedantic)]
5855#[allow(clippy::nursery)]
5856#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5857pub struct SinhLayerParams {}
5858///
5859/// A layer that computes elementwise trigonometric hyperbolic cosine function.
5860///
5861///
5862/// .. code::
5863///
5864/// y = CoshLayer(x)
5865///
5866/// Requires 1 input and produces 1 output.
5867/// Output shape is same as the input.
5868///
5869#[allow(clippy::all)]
5870#[allow(clippy::pedantic)]
5871#[allow(clippy::nursery)]
5872#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5873pub struct CoshLayerParams {}
5874///
5875/// A layer that computes elementwise trigonometric hyperbolic tangent function.
5876///
5877///
5878/// .. code::
5879///
5880/// y = TanhLayer(x)
5881///
5882/// Requires 1 input and produces 1 output.
5883/// Output shape is same as the input.
5884///
5885#[allow(clippy::all)]
5886#[allow(clippy::pedantic)]
5887#[allow(clippy::nursery)]
5888#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5889pub struct TanhLayerParams {}
5890///
5891/// A layer that computes elementwise trigonometric hyperbolic arcsine function.
5892///
5893///
5894/// .. code::
5895///
5896/// y = AsinhLayer(x)
5897///
5898/// Requires 1 input and produces 1 output.
5899/// Output shape is same as the input.
5900///
5901#[allow(clippy::all)]
5902#[allow(clippy::pedantic)]
5903#[allow(clippy::nursery)]
5904#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5905pub struct AsinhLayerParams {}
5906///
5907/// A layer that computes elementwise trigonometric hyperbolic arccosine function.
5908///
5909///
5910/// .. code::
5911///
5912/// y = AcoshLayer(x)
5913///
5914/// Requires 1 input and produces 1 output.
5915/// Output shape is same as the input.
5916///
5917#[allow(clippy::all)]
5918#[allow(clippy::pedantic)]
5919#[allow(clippy::nursery)]
5920#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5921pub struct AcoshLayerParams {}
5922///
5923/// A layer that computes elementwise trigonometric hyperbolic arctangent function.
5924///
5925///
5926/// .. code::
5927///
5928/// y = AtanhLayer(x)
5929///
5930/// Requires 1 input and produces 1 output.
5931/// Output shape is same as the input.
5932///
5933#[allow(clippy::all)]
5934#[allow(clippy::pedantic)]
5935#[allow(clippy::nursery)]
5936#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5937pub struct AtanhLayerParams {}
5938///
5939/// A layer that raises each element in first tensor to the power of
5940/// corresponding element in the second tensor.
5941/// Supports conventional numpy-like broadcasting.
5942///
5943/// .. code::
5944///
5945/// y = PowBroadcastableLayer(x)
5946///
5947/// Requires 2 inputs and produces 1 output.
5948///
5949/// Input
5950/// - First N-Dimensional tensor
5951/// - Second N-Dimensional tensor
5952///
5953/// Output
5954/// An N-Dimensional tensor with the broadcast shape.
5955///
5956#[allow(clippy::all)]
5957#[allow(clippy::pedantic)]
5958#[allow(clippy::nursery)]
5959#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5960pub struct PowBroadcastableLayerParams {}
5961///
5962/// A layer that computes the exponential of all elements in the input tensor, with the base 2.
5963///
5964///
5965/// .. code::
5966///
5967/// y = Exp2Layer(x)
5968///
5969/// Requires 1 input and produces 1 output.
5970/// Output shape is same as the input.
5971///
5972#[allow(clippy::all)]
5973#[allow(clippy::pedantic)]
5974#[allow(clippy::nursery)]
5975#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
5976pub struct Exp2LayerParams {}
5977///
5978/// A layer that returns a tensor containing the indices of all non-zero
5979/// elements of input tensor.
5980/// It is similar in functionality to the numpy.where method with 1 input.
5981///
5982/// Requires 1 input and produces 1 output.
5983/// Output is of rank 2, of shape (N,R),
5984/// where N is the number of non-zero elements in the input and R is the rank of the input.
5985///
5986/// Output contains indices represented in the multi-index form
5987///
5988/// e.g.:
5989/// input {shape = (4,)}:
5990/// \[0 1 0 2\]
5991/// output {shape = (2,1)}:
5992/// \[1\]
5993/// \[3\]
5994///
5995///
5996/// input {shape = (3, 3)}:
5997/// \[1 2 1\]
5998/// \[0 2 2\]
5999/// \[2 1 0\]
6000/// output {shape = (7,1)}:
6001/// \[0. 0.\]
6002/// \[0. 1.\]
6003/// \[0. 2.\]
6004/// \[1. 1.\]
6005/// \[1. 2.\]
6006/// \[2. 0.\]
6007/// \[2. 1.\]
6008///
6009#[allow(clippy::all)]
6010#[allow(clippy::pedantic)]
6011#[allow(clippy::nursery)]
6012#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6013pub struct WhereNonZeroLayerParams {}
6014///
6015/// A layer that copies a tensor setting everything outside a central band in
6016/// each inner-most matrix to zero.
6017///
6018/// Requires 1 input and produces 1 output.
6019///
6020/// Parameters for matrix_band_part layer
6021/// band(m, n) = (num_lower < 0 || (m-n) <= num_lower) && (num_upper < 0 || (n-m) <= num_upper).
6022/// output\[i, j, k, ..., m, n\] = band(m, n) * input\[i, j, k, ..., m, n\]
6023///
6024///
6025/// Output shape is same as the input shape.
6026/// Rank of the input must be at least 2.
6027/// For rank higher than 2, the last 2 dimensions are treated as the matrix, while the rest are treated as batch.
6028#[allow(clippy::all)]
6029#[allow(clippy::pedantic)]
6030#[allow(clippy::nursery)]
6031#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6032pub struct MatrixBandPartLayerParams {
6033 #[prost(int64, tag = "1")]
6034 pub num_lower: i64,
6035 #[prost(int64, tag = "2")]
6036 pub num_upper: i64,
6037}
6038///
6039/// A layer that copies a tensor setting everything outside upper triangular to zero.
6040///
6041/// Requires 1 input and produces 1 output.
6042///
6043/// Output shape is same as the input shape.
6044/// Rank of the input must be at least 2.
6045/// For rank higher than 2, the last 2 dimensions are treated as the matrix, while the rest are treated as batch.
6046#[allow(clippy::all)]
6047#[allow(clippy::pedantic)]
6048#[allow(clippy::nursery)]
6049#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6050pub struct UpperTriangularLayerParams {
6051 /// Diagonal below which to zero elements. k = 0 (the default) is the main diagonal, k < 0 is below it and k > 0 is above
6052 #[prost(int64, tag = "1")]
6053 pub k: i64,
6054}
6055///
6056/// A layer that copies a tensor setting everything outside lower triangular to zero.
6057///
6058/// Requires 1 input and produces 1 output.
6059///
6060/// Output shape is same as the input shape.
6061/// Rank of the input must be at least 2.
6062/// For rank higher than 2, the last 2 dimensions are treated as the matrix, while the rest are treated as batch.
6063#[allow(clippy::all)]
6064#[allow(clippy::pedantic)]
6065#[allow(clippy::nursery)]
6066#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6067pub struct LowerTriangularLayerParams {
6068 /// Diagonal above which to zero elements. k = 0 (the default) is the main diagonal, k < 0 is below it and k > 0 is above
6069 #[prost(int64, tag = "1")]
6070 pub k: i64,
6071}
6072///
6073///
6074/// A layer that broadcasts a tensor to a new shape.
6075///
6076/// Requires 2 inputs and produces 1 output.
6077///
6078/// First input is broadcast to produce the output, while the second input is only
6079/// used to determine the shape of the output. Values of second input are not used.
6080///
6081/// Output is a tensor with the same shape as the second input.
6082///
6083#[allow(clippy::all)]
6084#[allow(clippy::pedantic)]
6085#[allow(clippy::nursery)]
6086#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6087pub struct BroadcastToLikeLayerParams {}
6088///
6089///
6090/// A layer that broadcasts a tensor to a new shape.
6091///
6092/// Requires 1 input and produces 1 output.
6093///
6094/// Output tensor is the broadcasted version of the input and has shape as specified in the
6095/// parameter "targetShape".
6096#[allow(clippy::all)]
6097#[allow(clippy::pedantic)]
6098#[allow(clippy::nursery)]
6099#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6100pub struct BroadcastToStaticLayerParams {
6101 #[prost(uint64, repeated, tag = "1")]
6102 pub target_shape: ::prost::alloc::vec::Vec<u64>,
6103}
6104///
6105///
6106/// A layer that broadcasts a tensor to a new shape.
6107///
6108/// Requires 2 inputs and produces 1 output.
6109///
6110/// First input is the one that is broadcasted to produce the output.
6111/// Second input is a rank 1 tensor specifying the shape of the output.
6112/// Output tensor has shape as specified by the values in the 2nd input tensor.
6113#[allow(clippy::all)]
6114#[allow(clippy::pedantic)]
6115#[allow(clippy::nursery)]
6116#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6117pub struct BroadcastToDynamicLayerParams {}
6118///
6119/// A layer that performs element-wise addition operation with broadcast support.
6120///
6121/// Requires 2 inputs and produces 1 output.
6122#[allow(clippy::all)]
6123#[allow(clippy::pedantic)]
6124#[allow(clippy::nursery)]
6125#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6126pub struct AddBroadcastableLayerParams {}
6127///
6128/// A layer that performs element-wise maximum operation with broadcast support.
6129///
6130/// Requires 2 inputs and produces 1 output.
6131#[allow(clippy::all)]
6132#[allow(clippy::pedantic)]
6133#[allow(clippy::nursery)]
6134#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6135pub struct MaxBroadcastableLayerParams {}
6136///
6137/// A layer that performs element-wise minimum operation with broadcast support.
6138///
6139/// Requires 2 inputs and produces 1 output.
6140#[allow(clippy::all)]
6141#[allow(clippy::pedantic)]
6142#[allow(clippy::nursery)]
6143#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6144pub struct MinBroadcastableLayerParams {}
6145///
6146/// A layer that performs element-wise modular operation with broadcast support.
6147///
6148/// Requires 2 inputs and produces 1 output.
6149#[allow(clippy::all)]
6150#[allow(clippy::pedantic)]
6151#[allow(clippy::nursery)]
6152#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6153pub struct ModBroadcastableLayerParams {}
6154///
6155/// A layer that performs element-wise floor division operation with broadcast support.
6156///
6157/// Requires 2 inputs and produces 1 output.
6158#[allow(clippy::all)]
6159#[allow(clippy::pedantic)]
6160#[allow(clippy::nursery)]
6161#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6162pub struct FloorDivBroadcastableLayerParams {}
6163///
6164/// A layer that performs element-wise subtract operation with broadcast support.
6165///
6166/// Requires 2 inputs and produces 1 output.
6167#[allow(clippy::all)]
6168#[allow(clippy::pedantic)]
6169#[allow(clippy::nursery)]
6170#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6171pub struct SubtractBroadcastableLayerParams {}
6172///
6173/// A layer that performs element-wise multiply operation with broadcast support.
6174///
6175/// Requires 2 inputs and produces 1 output.
6176#[allow(clippy::all)]
6177#[allow(clippy::pedantic)]
6178#[allow(clippy::nursery)]
6179#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6180pub struct MultiplyBroadcastableLayerParams {}
6181///
6182/// A layer that performs element-wise division operation with broadcast support.
6183///
6184/// Requires 2 inputs and produces 1 output.
6185#[allow(clippy::all)]
6186#[allow(clippy::pedantic)]
6187#[allow(clippy::nursery)]
6188#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6189pub struct DivideBroadcastableLayerParams {}
6190///
6191/// Gather layer that gathers elements from the first input, along a specified axis,
6192/// at indices specified in the second input.
6193/// It is similar in functionality to the numpy.take method.
6194///
6195/// Requires 2 inputs and produces 1 output.
6196///
6197/// Given two inputs, 'data' and 'indices', gather the slices of 'data'
6198/// and store into output.
6199/// e.g.
6200/// for i in \[0, length(indices) - 1\]
6201/// output\[i\] = data\[indices[i]\] (1-D case, axis=0)
6202///
6203/// if axis = 0:
6204/// for each vector index (i,...,j)
6205/// output\[i,...,j,:,..,:\] = data\[indices[i,...,j\],:,..,:]
6206///
6207/// output.rank = (data.rank - 1) + indices.rank
6208///
6209/// Negative indices and negative axis are supported.
6210///
6211/// e.g:
6212///
6213/// data shape = (2, 3)
6214/// indices shape = (6, 8)
6215/// axis = 0
6216/// output shape = (6, 8) + (3,) = (6, 8, 3)
6217///
6218/// data shape = (2, 3, 5)
6219/// indices shape = (6, 8)
6220/// axis = 1
6221/// output shape = (2,) + (6, 8) + (5,) = (2, 6, 8, 5)
6222///
6223#[allow(clippy::all)]
6224#[allow(clippy::pedantic)]
6225#[allow(clippy::nursery)]
6226#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6227pub struct GatherLayerParams {
6228 #[prost(int64, tag = "1")]
6229 pub axis: i64,
6230}
6231#[allow(clippy::all)]
6232#[allow(clippy::pedantic)]
6233#[allow(clippy::nursery)]
6234#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6235pub struct ScatterLayerParams {
6236 #[prost(int64, tag = "1")]
6237 pub axis: i64,
6238 /// mode of accumulation.
6239 #[prost(enumeration = "ScatterMode", tag = "2")]
6240 pub mode: i32,
6241}
6242///
6243/// A layer that gathers elements from the first input, 'params', at the multi-indices specified
6244/// by the second input, 'indices'.
6245///
6246/// Requires 2 inputs and produces 1 output.
6247///
6248/// 'params' = input\[0\], 'indices' = input\[1\]
6249///
6250/// 'indices' is a rank K+1 tensor of shape \[I_0, I_1, .., I_(K-1), I_K\] which is viewed as a collection of
6251/// indices of (I_0 * I_1 * ... * I_(K-1)) points in the I_K dimensional space. For instance, the multi-index of the first point
6252/// is indices\[0,0,...,0,:\].
6253///
6254/// Here is how the output is constructed:
6255///
6256/// for i = 0,1,...,(I_0-1)
6257/// ...
6258/// for j = 0,1,....,(I_(K-1)-1)
6259/// output\[i,....,j,:,:,..,:\] = params\[indices[i,...,j,:\], :,:,..,:]
6260///
6261/// Hence, output shape is \[I_0, I_1,...,I(K-1)\] + params.shape\[I_K:\]
6262///
6263/// output.rank = indices.rank - 1 + params.rank - indices.shape\[-1\]
6264///
6265/// e.g:
6266///
6267/// input\[0\] shape = (4, 2, 3, 4)
6268/// input\[1\] shape = (6, 2)
6269/// output shape = (6,) + (3, 4) = (6, 3, 4)
6270///
6271/// input\[0\] shape = (3, 3, 3, 4, 7)
6272/// input\[1\] shape = (3, 5)
6273/// output shape = (3,) + () = (3,)
6274///
6275/// input\[0\] shape = (5, 3, 2, 5)
6276/// input\[1\] shape = (2, 7, 3, 2)
6277/// output shape = (2, 7, 3) + (2, 5) = (2, 7, 3, 2, 5)
6278///
6279#[allow(clippy::all)]
6280#[allow(clippy::pedantic)]
6281#[allow(clippy::nursery)]
6282#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6283pub struct GatherNdLayerParams {}
6284///
6285/// A layer that scatters data into a new tensor according to multi-indices from the input.
6286/// This is the inverse operation of GatherND.
6287///
6288/// Requires 3 inputs and produces 1 output.
6289/// 3 inputs, in order are denoted as "container", "indices", "updates".
6290///
6291/// 'indices' is a rank K+1 tensor of shape \[I_0, I_1, .., I_(K-1), I_K\] which is viewed as a collection of
6292/// indices of (I_0 * I_1 * ... * I_(K-1)) points in the I_K dimensional space. For instance, the multi-index of the first point
6293/// is indices\[0,0,...,0,:\].
6294///
6295/// container.rank >= I_K
6296/// updates.rank = K + (container.rank - I_K)
6297/// shape of 'updates' = \[I_0, I_1,...,I(K-1)\] + container.shape\[I_K:\]
6298///
6299/// output = container
6300/// For each vector index (i,...,j) s.t. 0<=i<I_0,..., 0<=j<I_K
6301/// output\[indices[i,...,j,:\], :,:,..,:] = updates\[i,....,j,:,:,..,:\] // if mode == "SCATTER_UPDATE"
6302///
6303/// The output has the same shape as the first input.
6304///
6305/// e.g:
6306///
6307/// container shape = (3, 2)
6308/// indices shape = (4, 2)
6309/// updates shape = (4,)
6310/// output shape = (3, 2)
6311///
6312/// container shape = (7, 6)
6313/// indices shape = (4, 7, 2, 5, 1)
6314/// updates shape = (4, 7, 2, 5, 6)
6315/// output shape = (7, 6)
6316///
6317#[allow(clippy::all)]
6318#[allow(clippy::pedantic)]
6319#[allow(clippy::nursery)]
6320#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6321pub struct ScatterNdLayerParams {
6322 /// mode of accumulation.
6323 #[prost(enumeration = "ScatterMode", tag = "1")]
6324 pub mode: i32,
6325}
6326///
6327/// Gather layer that gathers elements from the first input, along a specified axis,
6328/// at indices specified in the second input.
6329/// It is similar in functionality to the numpy.take_along_axis method.
6330///
6331/// Requires 2 inputs and produces 1 output.
6332///
6333/// Given two inputs, 'data' and 'indices', gather the slices of 'data'
6334/// and store into output.
6335///
6336/// Both inputs and output have the same rank.
6337/// Output shape is same as the shape of 'indices'
6338/// Shapes of 'indices' and 'data' match, except at the 'axis' dimension.
6339///
6340/// This operation performs the following operation for axis=0:
6341/// for each vector index (i,j,....,k)
6342/// output\[i,j,....,k\] = data\[index[i,j,....,k\],j,....,k]
6343///
6344/// Negative indices and negative axis are supported.
6345///
6346/// e.g:
6347///
6348/// data shape = (4, 4, 7)
6349/// indices shape = (4, 5, 7)
6350/// axis = 1
6351/// output shape = (4, 5, 7)
6352///
6353#[allow(clippy::all)]
6354#[allow(clippy::pedantic)]
6355#[allow(clippy::nursery)]
6356#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6357pub struct GatherAlongAxisLayerParams {
6358 #[prost(int64, tag = "1")]
6359 pub axis: i64,
6360}
6361///
6362/// A layer that scatters data into a new tensor according to indices from
6363/// the input along the given axis into the output tensor.
6364/// This is the inverse operation of GatherAlongAxis.
6365/// It is similar in functionality to the numpy.put_along_axis method.
6366///
6367/// Requires 3 inputs and produces 1 output.
6368/// 3 inputs, in order are denoted as "container", "indices", "updates".
6369///
6370/// All inputs and output have the same rank.
6371/// Output shape is same as the shape of 'container'
6372/// Shapes of 'indices' and 'updates' match, which is same as the shape of 'container' except at the 'axis' dimension.
6373///
6374/// Negative indices and negative axis are supported.
6375///
6376/// This operation performs the following operation for axis=0:
6377/// output = container
6378/// for each vector index (i,j,....,k)
6379/// output\[index[i,j,....,k\],j,....,k] = updates\[i,j,....,k\]
6380///
6381/// e.g.:
6382///
6383/// container shape = (2, 5, 6)
6384/// indices shape = (2, 2, 6)
6385/// updates shape = (2, 2, 6)
6386/// axis = -2
6387/// output shape = (2, 5, 6)
6388///
6389#[allow(clippy::all)]
6390#[allow(clippy::pedantic)]
6391#[allow(clippy::nursery)]
6392#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6393pub struct ScatterAlongAxisLayerParams {
6394 #[prost(int64, tag = "1")]
6395 pub axis: i64,
6396 /// mode of accumulation.
6397 #[prost(enumeration = "ScatterMode", tag = "2")]
6398 pub mode: i32,
6399}
6400///
6401/// A layer that stacks the input tensors along the given axis.
6402/// It is similar in functionality to the numpy.stack method.
6403///
6404/// Requires at least 2 inputs and produces 1 output.
6405/// All inputs must have the same shape.
6406/// Rank of the output is 1 greater than the rank of the inputs.
6407///
6408/// Negative indexing is supported for the "axis" parameter.
6409///
6410/// e.g.:
6411///
6412/// input shape = (2, 4, 2)
6413/// number of inputs = 5
6414/// axis = 3
6415/// output shape = (2, 4, 2, 5)
6416///
6417/// input shape = (2, 4, 2)
6418/// number of inputs = 5
6419/// axis = -2
6420/// output shape = (2, 4, 5, 2)
6421#[allow(clippy::all)]
6422#[allow(clippy::pedantic)]
6423#[allow(clippy::nursery)]
6424#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
6425pub struct StackLayerParams {
6426 #[prost(int64, tag = "1")]
6427 pub axis: i64,
6428}
6429///
6430/// A layer that reshapes a tensor that does not alter the rank of the input.
6431/// Order of the data is left unchanged.
6432///
6433/// Requires 1 input and produces 1 output.
6434///
6435/// e.g:
6436///
6437/// input shape = (20,10)
6438/// targetShape = (5,-1)
6439/// output shape = (5,40)
6440///
6441/// input shape = (20,10,5)
6442/// targetShape = (0,2,25)
6443/// output shape = (20,2,25)
6444///
6445/// input shape = (10,3,5)
6446/// targetShape = (25,0,-1)
6447/// output shape = (25,3,2)
6448#[allow(clippy::all)]
6449#[allow(clippy::pedantic)]
6450#[allow(clippy::nursery)]
6451#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6452pub struct RankPreservingReshapeLayerParams {
6453 ///
6454 /// Length of this field must be same as the input/output rank.
6455 /// It can have 0's, in which case the corresponding input dimension is kept intact.
6456 /// At most one element can be -1, in which case the output dimension is calculated from rest of the shape.
6457 #[prost(int64, repeated, tag = "1")]
6458 pub target_shape: ::prost::alloc::vec::Vec<i64>,
6459}
6460///
6461/// Constant padding layer.
6462/// Pad the input array with a constant value, either along a single given axis or along a set of axes.
6463///
6464/// Requires 1 or 2 inputs and produces 1 output.
6465/// The amount of padding can be either set as a parameter ("padAmounts") or provided as a second input.
6466///
6467/// Output rank is same as the rank of the first input.
6468///
6469/// when "padToGivenOutputSizeMode" is False:
6470///
6471/// output_shape\[i\] = input_shape\[i\] + padAmounts\[2*i\] + padAmounts\[2*i+1\], i=0,...,rank-1
6472///
6473/// Examples:
6474///
6475/// input shape = (20,10)
6476/// padAmounts = \[0,1,4,0\]
6477/// output shape = (21,14)
6478///
6479/// input shape = (20,10,5)
6480/// padAmounts = \[0,0,3,4,0,9\]
6481/// output shape = (20,17,14)
6482///
6483///
6484/// when "padToGivenOutputSizeMode" is True
6485///
6486/// output_shape\[i\] = max(input_shape\[i\], max(padAmounts\[2*i\] + padAmounts\[2*i+1\])), i=0,...,rank-1
6487///
6488/// input shape = (20,10)
6489/// padAmounts = \[0,21,14,0\]
6490/// output shape = (21,14)
6491///
6492/// input shape = (20,10,5)
6493/// padAmounts = \[0,0,17,0,0,14\]
6494/// output shape = (20,17,14)
6495#[allow(clippy::all)]
6496#[allow(clippy::pedantic)]
6497#[allow(clippy::nursery)]
6498#[derive(Clone, PartialEq, ::prost::Message)]
6499pub struct ConstantPaddingLayerParams {
6500 ///
6501 /// The value to be used for padding.
6502 #[prost(float, tag = "1")]
6503 pub value: f32,
6504 ///
6505 /// Length of this repeated field must be twice the rank of the first input.
6506 /// 2*i-th and (2*i+1)-th values represent the amount of padding to be applied to the the i-th input
6507 /// dimension, "before" and "after" the input values, respectively.
6508 #[prost(uint64, repeated, tag = "2")]
6509 pub pad_amounts: ::prost::alloc::vec::Vec<u64>,
6510 ///
6511 /// When this is True, positive values in "padAmounts" are equivalent to the output shape.
6512 /// In that case only one of padAmounts\[2*i\] and padAmounts\[2*i+1\] can be non zero, for i=0,..,rank-1.
6513 #[prost(bool, tag = "3")]
6514 pub pad_to_given_output_size_mode: bool,
6515}
6516///
6517/// A layer that returns a tensor filled with values from the normal distribution.
6518///
6519/// Requires 1 input and produces 1 output.
6520///
6521/// Parameters
6522/// seed: seed used for the normal distribution.
6523/// mean: mean of the normal distribution.
6524/// stdDev: standard deviation of the normal distribution.
6525///
6526/// Input
6527/// An N-Dimensional tensor, whose values are ignored. Only the shape is used to
6528/// infer the shape of the output.
6529///
6530/// Output
6531/// An N-Dimensional tensor with the same shape as the input tensor.
6532///
6533#[allow(clippy::all)]
6534#[allow(clippy::pedantic)]
6535#[allow(clippy::nursery)]
6536#[derive(Clone, Copy, PartialEq, ::prost::Message)]
6537pub struct RandomNormalLikeLayerParams {
6538 #[prost(int64, tag = "1")]
6539 pub seed: i64,
6540 #[prost(float, tag = "2")]
6541 pub mean: f32,
6542 #[prost(float, tag = "3")]
6543 pub std_dev: f32,
6544}
6545///
6546/// A layer that returns a tensor filled with values from the normal distribution.
6547///
6548/// Requires no input and produces 1 output.
6549///
6550/// Parameters
6551/// seed: seed used for the normal distribution.
6552/// mean: mean of the normal distribution.
6553/// stdDev: standard deviation of the normal distribution.
6554/// outputShape: shape of the output tensor.
6555///
6556/// Output
6557/// An N-Dimensional tensor of shape "outputShape".
6558///
6559#[allow(clippy::all)]
6560#[allow(clippy::pedantic)]
6561#[allow(clippy::nursery)]
6562#[derive(Clone, PartialEq, ::prost::Message)]
6563pub struct RandomNormalStaticLayerParams {
6564 #[prost(int64, tag = "1")]
6565 pub seed: i64,
6566 #[prost(float, tag = "2")]
6567 pub mean: f32,
6568 #[prost(float, tag = "3")]
6569 pub std_dev: f32,
6570 #[prost(uint64, repeated, tag = "4")]
6571 pub output_shape: ::prost::alloc::vec::Vec<u64>,
6572}
6573///
6574/// A layer that returns a tensor filled with values from the normal distribution.
6575///
6576/// Requires 1 input and produces 1 output.
6577///
6578/// Parameters:
6579/// seed: seed used for the normal distribution.
6580/// mean: mean of the normal distribution.
6581/// stdDev: standard deviation of the normal distribution.
6582///
6583/// Input
6584/// A rank 1 tensor specifying the shape of the output
6585///
6586/// Output
6587/// An N-Dimensional tensor with the shape specified by the values in the input tensor.
6588#[allow(clippy::all)]
6589#[allow(clippy::pedantic)]
6590#[allow(clippy::nursery)]
6591#[derive(Clone, Copy, PartialEq, ::prost::Message)]
6592pub struct RandomNormalDynamicLayerParams {
6593 #[prost(int64, tag = "1")]
6594 pub seed: i64,
6595 #[prost(float, tag = "2")]
6596 pub mean: f32,
6597 #[prost(float, tag = "3")]
6598 pub std_dev: f32,
6599}
6600///
6601/// A layer that returns a tensor filled with values from the uniform distribution.
6602///
6603/// Requires 1 input and produces 1 output.
6604///
6605/// Parameters
6606/// seed: seed used for the uniform distribution.
6607/// minVal: lower bound on the range of random values for the uniform distribution.
6608/// maxVal: upper bound on the range of random values for the uniform distribution.
6609///
6610/// Input
6611/// An N-Dimensional tensor, whose values are ignored. Only the shape is used to
6612/// infer the shape of the output.
6613///
6614/// Output
6615/// An N-Dimensional tensor with the same shape as the input tensor.
6616///
6617#[allow(clippy::all)]
6618#[allow(clippy::pedantic)]
6619#[allow(clippy::nursery)]
6620#[derive(Clone, Copy, PartialEq, ::prost::Message)]
6621pub struct RandomUniformLikeLayerParams {
6622 #[prost(int64, tag = "1")]
6623 pub seed: i64,
6624 #[prost(float, tag = "2")]
6625 pub min_val: f32,
6626 #[prost(float, tag = "3")]
6627 pub max_val: f32,
6628}
6629///
6630/// A layer that returns a tensor filled with values from the uniform distribution.
6631///
6632/// Requires no input and produces 1 output.
6633///
6634/// Parameters
6635/// seed: seed used for the uniform distribution.
6636/// minVal: lower bound on the range of random values for the uniform distribution.
6637/// maxVal: upper bound on the range of random values for the uniform distribution.
6638/// outputShape: shape of the output tensor.
6639///
6640/// Output
6641/// An N-Dimensional tensor of shape "outputShape".
6642///
6643#[allow(clippy::all)]
6644#[allow(clippy::pedantic)]
6645#[allow(clippy::nursery)]
6646#[derive(Clone, PartialEq, ::prost::Message)]
6647pub struct RandomUniformStaticLayerParams {
6648 #[prost(int64, tag = "1")]
6649 pub seed: i64,
6650 #[prost(float, tag = "2")]
6651 pub min_val: f32,
6652 #[prost(float, tag = "3")]
6653 pub max_val: f32,
6654 #[prost(uint64, repeated, tag = "4")]
6655 pub output_shape: ::prost::alloc::vec::Vec<u64>,
6656}
6657///
6658/// A layer that returns a tensor filled with values from the uniform distribution.
6659///
6660/// Requires 1 input and produces 1 output.
6661///
6662/// Parameters:
6663/// seed: seed used for the uniform distribution.
6664/// minVal: lower bound on the range of random values for the uniform distribution.
6665/// maxVal: upper bound on the range of random values for the uniform distribution.
6666///
6667/// Input
6668/// A rank 1 tensor specifying the shape of the output
6669///
6670/// Output
6671/// An N-Dimensional tensor with the shape specified by the values in the input tensor.
6672///
6673#[allow(clippy::all)]
6674#[allow(clippy::pedantic)]
6675#[allow(clippy::nursery)]
6676#[derive(Clone, Copy, PartialEq, ::prost::Message)]
6677pub struct RandomUniformDynamicLayerParams {
6678 #[prost(int64, tag = "1")]
6679 pub seed: i64,
6680 #[prost(float, tag = "2")]
6681 pub min_val: f32,
6682 #[prost(float, tag = "3")]
6683 pub max_val: f32,
6684}
6685///
6686/// A layer that returns a tensor filled with values from the Bernoulli distribution.
6687///
6688/// Requires 1 input and produces 1 output.
6689///
6690/// Parameters
6691/// seed: seed used for the Bernoulli distribution.
6692/// prob: probability of a 1 event.
6693///
6694/// Input
6695/// An N-Dimensional tensor, whose values are ignored. Only the shape is used to
6696/// infer the shape of the output.
6697///
6698/// Output
6699/// An N-Dimensional tensor with the same shape as the input tensor.
6700///
6701#[allow(clippy::all)]
6702#[allow(clippy::pedantic)]
6703#[allow(clippy::nursery)]
6704#[derive(Clone, Copy, PartialEq, ::prost::Message)]
6705pub struct RandomBernoulliLikeLayerParams {
6706 #[prost(int64, tag = "1")]
6707 pub seed: i64,
6708 #[prost(float, tag = "2")]
6709 pub prob: f32,
6710}
6711///
6712/// A layer that returns a tensor filled with values from the Bernoulli distribution.
6713///
6714/// Requires no input and produces 1 output.
6715///
6716/// Parameters
6717/// seed: seed used for the Bernoulli distribution.
6718/// prob: probability of a 1 event.
6719/// outputShape: shape of the output tensor.
6720///
6721/// Output
6722/// An N-Dimensional tensor of shape "outputShape".
6723#[allow(clippy::all)]
6724#[allow(clippy::pedantic)]
6725#[allow(clippy::nursery)]
6726#[derive(Clone, PartialEq, ::prost::Message)]
6727pub struct RandomBernoulliStaticLayerParams {
6728 #[prost(int64, tag = "1")]
6729 pub seed: i64,
6730 #[prost(float, tag = "2")]
6731 pub prob: f32,
6732 #[prost(uint64, repeated, tag = "3")]
6733 pub output_shape: ::prost::alloc::vec::Vec<u64>,
6734}
6735///
6736/// A layer that returns a tensor filled with values from the Bernoulli distribution.
6737///
6738/// Requires 1 input and produces 1 output.
6739///
6740/// Parameters:
6741/// seed: seed used for the Bernoulli distribution.
6742/// prob: probability of a 1 event.
6743///
6744/// Input
6745/// A rank 1 tensor specifying the shape of the output
6746///
6747/// Output
6748/// An N-Dimensional tensor with the shape specified by the values in the input tensor.
6749#[allow(clippy::all)]
6750#[allow(clippy::pedantic)]
6751#[allow(clippy::nursery)]
6752#[derive(Clone, Copy, PartialEq, ::prost::Message)]
6753pub struct RandomBernoulliDynamicLayerParams {
6754 #[prost(int64, tag = "1")]
6755 pub seed: i64,
6756 #[prost(float, tag = "2")]
6757 pub prob: f32,
6758}
6759///
6760/// A layer that returns a tensor of the specified shape filled with values from the categorical distribution.
6761///
6762/// Requires 1 input and produces 1 output.
6763///
6764/// Parameter:
6765/// seed: seed used for the categorical distribution.
6766/// numSamples: number of samples to draw.
6767/// isLogits: true if the inputs are logits, false if the inputs are probabilities.
6768/// eps: default value is 1e-10.
6769/// temperature: default value is 1.0.
6770///
6771/// Input tensor shape = \[D_1, D_2, ... , D_(R-1), D_R\] (Rank = R)
6772/// Then the shape of the output is \[D_1, D_2, ... , D_(R-1), numSamples\] (Rank = R)
6773///
6774#[allow(clippy::all)]
6775#[allow(clippy::pedantic)]
6776#[allow(clippy::nursery)]
6777#[derive(Clone, Copy, PartialEq, ::prost::Message)]
6778pub struct CategoricalDistributionLayerParams {
6779 #[prost(int64, tag = "1")]
6780 pub seed: i64,
6781 #[prost(int64, tag = "2")]
6782 pub num_samples: i64,
6783 #[prost(bool, tag = "3")]
6784 pub is_logits: bool,
6785 #[prost(float, tag = "4")]
6786 pub eps: f32,
6787 #[prost(float, tag = "5")]
6788 pub temperature: f32,
6789}
6790///
6791/// A layer that performs reduction with L1 normalization operation.
6792///
6793/// Negative indexing is supported.
6794/// Requires 1 input and produces 1 output.
6795///
6796/// Parameters:
6797/// axes: dimensions along which to perform reduction
6798/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
6799/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
6800///
6801#[allow(clippy::all)]
6802#[allow(clippy::pedantic)]
6803#[allow(clippy::nursery)]
6804#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6805pub struct ReduceL1LayerParams {
6806 #[prost(int64, repeated, tag = "1")]
6807 pub axes: ::prost::alloc::vec::Vec<i64>,
6808 #[prost(bool, tag = "2")]
6809 pub keep_dims: bool,
6810 #[prost(bool, tag = "3")]
6811 pub reduce_all: bool,
6812}
6813///
6814/// A layer that performs reduction with L2 normalization operation.
6815///
6816/// Negative indexing is supported.
6817/// Requires 1 input and produces 1 output.
6818///
6819/// Parameters:
6820/// axes: dimensions along which to perform reduction
6821/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
6822/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
6823///
6824#[allow(clippy::all)]
6825#[allow(clippy::pedantic)]
6826#[allow(clippy::nursery)]
6827#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6828pub struct ReduceL2LayerParams {
6829 #[prost(int64, repeated, tag = "1")]
6830 pub axes: ::prost::alloc::vec::Vec<i64>,
6831 #[prost(bool, tag = "2")]
6832 pub keep_dims: bool,
6833 #[prost(bool, tag = "3")]
6834 pub reduce_all: bool,
6835}
6836///
6837/// A layer that performs reduction with max operation.
6838///
6839/// Negative indexing is supported.
6840/// Requires 1 input and produces 1 output.
6841///
6842/// Parameters:
6843/// axes: dimensions along which to perform reduction
6844/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
6845/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
6846///
6847#[allow(clippy::all)]
6848#[allow(clippy::pedantic)]
6849#[allow(clippy::nursery)]
6850#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6851pub struct ReduceMaxLayerParams {
6852 #[prost(int64, repeated, tag = "1")]
6853 pub axes: ::prost::alloc::vec::Vec<i64>,
6854 #[prost(bool, tag = "2")]
6855 pub keep_dims: bool,
6856 #[prost(bool, tag = "3")]
6857 pub reduce_all: bool,
6858}
6859///
6860/// A layer that performs reduction with min operation.
6861///
6862/// Negative indexing is supported.
6863/// Requires 1 input and produces 1 output.
6864///
6865/// Parameters:
6866/// axes: dimensions along which to perform reduction
6867/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
6868/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
6869///
6870#[allow(clippy::all)]
6871#[allow(clippy::pedantic)]
6872#[allow(clippy::nursery)]
6873#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6874pub struct ReduceMinLayerParams {
6875 #[prost(int64, repeated, tag = "1")]
6876 pub axes: ::prost::alloc::vec::Vec<i64>,
6877 #[prost(bool, tag = "2")]
6878 pub keep_dims: bool,
6879 #[prost(bool, tag = "3")]
6880 pub reduce_all: bool,
6881}
6882///
6883/// A layer that performs reduction with sum operation.
6884///
6885/// Negative indexing is supported.
6886/// Requires 1 input and produces 1 output.
6887///
6888/// Parameters:
6889/// axes: dimensions along which to perform reduction
6890/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
6891/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
6892///
6893#[allow(clippy::all)]
6894#[allow(clippy::pedantic)]
6895#[allow(clippy::nursery)]
6896#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6897pub struct ReduceSumLayerParams {
6898 #[prost(int64, repeated, tag = "1")]
6899 pub axes: ::prost::alloc::vec::Vec<i64>,
6900 #[prost(bool, tag = "2")]
6901 pub keep_dims: bool,
6902 #[prost(bool, tag = "3")]
6903 pub reduce_all: bool,
6904}
6905///
6906/// A layer that performs reduction with prod operation.
6907///
6908/// Negative indexing is supported.
6909/// Requires 1 input and produces 1 output.
6910///
6911/// Parameters:
6912/// axes: dimensions along which to perform reduction
6913/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
6914/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
6915///
6916#[allow(clippy::all)]
6917#[allow(clippy::pedantic)]
6918#[allow(clippy::nursery)]
6919#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6920pub struct ReduceProdLayerParams {
6921 #[prost(int64, repeated, tag = "1")]
6922 pub axes: ::prost::alloc::vec::Vec<i64>,
6923 #[prost(bool, tag = "2")]
6924 pub keep_dims: bool,
6925 #[prost(bool, tag = "3")]
6926 pub reduce_all: bool,
6927}
6928///
6929/// A layer that performs reduction with mean operation.
6930///
6931/// Negative indexing is supported.
6932/// Requires 1 input and produces 1 output.
6933///
6934/// Parameters:
6935/// axes: dimensions along which to perform reduction
6936/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
6937/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
6938///
6939#[allow(clippy::all)]
6940#[allow(clippy::pedantic)]
6941#[allow(clippy::nursery)]
6942#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6943pub struct ReduceMeanLayerParams {
6944 #[prost(int64, repeated, tag = "1")]
6945 pub axes: ::prost::alloc::vec::Vec<i64>,
6946 #[prost(bool, tag = "2")]
6947 pub keep_dims: bool,
6948 #[prost(bool, tag = "3")]
6949 pub reduce_all: bool,
6950}
6951///
6952/// A layer that performs reduction with logSum operation.
6953///
6954/// Negative indexing is supported.
6955/// Requires 1 input and produces 1 output.
6956///
6957/// Parameters:
6958/// axes: dimensions along which to perform reduction
6959/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
6960/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
6961///
6962#[allow(clippy::all)]
6963#[allow(clippy::pedantic)]
6964#[allow(clippy::nursery)]
6965#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6966pub struct ReduceLogSumLayerParams {
6967 #[prost(int64, repeated, tag = "1")]
6968 pub axes: ::prost::alloc::vec::Vec<i64>,
6969 #[prost(bool, tag = "2")]
6970 pub keep_dims: bool,
6971 #[prost(bool, tag = "3")]
6972 pub reduce_all: bool,
6973}
6974///
6975/// A layer that performs reduction with logSumExp operation.
6976///
6977/// Negative indexing is supported.
6978/// Requires 1 input and produces 1 output.
6979///
6980/// Parameters:
6981/// axes: dimensions along which to perform reduction
6982/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
6983/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
6984///
6985#[allow(clippy::all)]
6986#[allow(clippy::pedantic)]
6987#[allow(clippy::nursery)]
6988#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
6989pub struct ReduceSumSquareLayerParams {
6990 #[prost(int64, repeated, tag = "1")]
6991 pub axes: ::prost::alloc::vec::Vec<i64>,
6992 #[prost(bool, tag = "2")]
6993 pub keep_dims: bool,
6994 #[prost(bool, tag = "3")]
6995 pub reduce_all: bool,
6996}
6997///
6998/// A layer that performs reduction with logSumExp operation.
6999///
7000/// Negative indexing is supported.
7001/// Requires 1 input and produces 1 output.
7002///
7003/// Parameters:
7004/// axes: dimensions along which to perform reduction
7005/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
7006/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
7007///
7008#[allow(clippy::all)]
7009#[allow(clippy::pedantic)]
7010#[allow(clippy::nursery)]
7011#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
7012pub struct ReduceLogSumExpLayerParams {
7013 #[prost(int64, repeated, tag = "1")]
7014 pub axes: ::prost::alloc::vec::Vec<i64>,
7015 #[prost(bool, tag = "2")]
7016 pub keep_dims: bool,
7017 #[prost(bool, tag = "3")]
7018 pub reduce_all: bool,
7019}
7020///
7021/// A layer that increases the rank of the input tensor by adding unit dimensions.
7022///
7023/// Requires 1 input and produces 1 output.
7024///
7025/// e.g.:
7026///
7027/// input shape = (10,5)
7028/// axes = (0,1)
7029/// output shape = (1,1,10,5)
7030///
7031/// input shape = (10,5)
7032/// axes = (0,2)
7033/// output shape = (1,10,1,5)
7034///
7035/// input shape = (10,5)
7036/// axes = (-2,-1)
7037/// output shape = (10,5,1,1)
7038///
7039#[allow(clippy::all)]
7040#[allow(clippy::pedantic)]
7041#[allow(clippy::nursery)]
7042#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
7043pub struct ExpandDimsLayerParams {
7044 ///
7045 /// Axis values provided here get dimension 1 in the output tensor.
7046 /// Negative indexing is supported.
7047 #[prost(int64, repeated, tag = "1")]
7048 pub axes: ::prost::alloc::vec::Vec<i64>,
7049}
7050///
7051/// A layer that flattens the input tensor into a 2-dimensional matrix.
7052///
7053/// Requires 1 input and produces 1 output.
7054/// Output tensor is always rank 2.
7055///
7056/// First dimension of output is the product of all the dimensions in input\[:axis\] ("axis" is exclusive)
7057/// Second dimension of output is the product of all the dimensions in input\[axis:\] ("axis" is inclusive)
7058///
7059/// e.g.:
7060/// input shape: (3,)
7061/// axis: -1
7062/// output shape: (1, 3)
7063///
7064/// input shape: (3,)
7065/// axis: 1
7066/// output shape: (3, 1)
7067///
7068/// input shape: (4, 3)
7069/// axis: -1
7070/// output shape: (4, 3)
7071///
7072/// input shape: (5, 2)
7073/// axis: 0
7074/// output shape: (1, 10)
7075///
7076/// input shape: (5, 5, 3)
7077/// axis: -2
7078/// output shape: (5, 15)
7079///
7080/// input shape: (2, 3, 2)
7081/// axis: -1
7082/// output shape: (6, 2)
7083///
7084#[allow(clippy::all)]
7085#[allow(clippy::pedantic)]
7086#[allow(clippy::nursery)]
7087#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7088pub struct FlattenTo2DLayerParams {
7089 #[prost(int64, tag = "1")]
7090 pub axis: i64,
7091}
7092///
7093/// A layer that reshapes a tensor.
7094///
7095/// Requires 1 input and produces 1 output.
7096///
7097/// Output tensor is the reshaped version of the input and has shape as specified in the
7098/// parameter "targetShape".
7099///
7100#[allow(clippy::all)]
7101#[allow(clippy::pedantic)]
7102#[allow(clippy::nursery)]
7103#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
7104pub struct ReshapeStaticLayerParams {
7105 #[prost(int64, repeated, tag = "1")]
7106 pub target_shape: ::prost::alloc::vec::Vec<i64>,
7107}
7108///
7109/// A layer that reshapes a tensor.
7110///
7111/// Requires 2 inputs and produces 1 output.
7112///
7113/// First input is reshaped to produce the output, while the second input is only
7114/// used to determine the shape of the output. Values of the second input are not used.
7115///
7116/// Output is a tensor with the same shape as the second input.
7117///
7118#[allow(clippy::all)]
7119#[allow(clippy::pedantic)]
7120#[allow(clippy::nursery)]
7121#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7122pub struct ReshapeLikeLayerParams {}
7123///
7124/// A layer that reshapes a tensor.
7125///
7126/// Requires 2 inputs and produces 1 output.
7127///
7128/// First input is the one that is reshaped to produce the output.
7129/// Second input is a rank 1 tensor specifying the shape of the output.
7130/// Output tensor has shape as specified by the values in the 2nd input tensor.
7131#[allow(clippy::all)]
7132#[allow(clippy::pedantic)]
7133#[allow(clippy::nursery)]
7134#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7135pub struct ReshapeDynamicLayerParams {}
7136///
7137/// A layer that decreases the rank of the input tensor by removing unit dimensions.
7138///
7139/// Requires 1 input and produces 1 output.
7140///
7141/// Output rank is one less than input rank, if input rank is more than 1.
7142/// If input rank is 1, output rank is also 1.
7143///
7144/// e.g.:
7145///
7146/// input shape = (1,1,10,5)
7147/// axes = (0,1)
7148/// output shape = (10,5)
7149///
7150/// input shape = (1,10,5,1)
7151/// axes = (0,3)
7152/// output shape = (10,5)
7153///
7154/// input shape = (10,5,1,1)
7155/// axes = (-2,-1)
7156/// output shape = (10,5)
7157///
7158/// input shape = (1,)
7159/// axes = (0)
7160/// output shape = (1,)
7161///
7162#[allow(clippy::all)]
7163#[allow(clippy::pedantic)]
7164#[allow(clippy::nursery)]
7165#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
7166pub struct SqueezeLayerParams {
7167 ///
7168 /// Axis values provided here get removed from the input tensor.
7169 /// Negative indexing is supported.
7170 #[prost(int64, repeated, tag = "1")]
7171 pub axes: ::prost::alloc::vec::Vec<i64>,
7172 /// if true squeeze all dimensions that are 1.
7173 #[prost(bool, tag = "2")]
7174 pub squeeze_all: bool,
7175}
7176///
7177/// A layer that returns top K (or bottom K) values and the corresponding indices
7178/// of the input along a given axis.
7179///
7180/// Requires 1 or 2 inputs and produces 2 outputs.
7181///
7182/// The second input is the value of the K, and is optional.
7183/// If there is only one input, value of K that is specified in the layer parameter is used.
7184///
7185/// Both outputs have the same rank as the first input.
7186/// Second input must correspond to a scalar tensor.
7187///
7188/// e.g.:
7189///
7190/// first input's shape = (45, 34, 10, 5)
7191/// axis = 1
7192/// output shape, for both outputs = (45, K, 10, 5)
7193///
7194#[allow(clippy::all)]
7195#[allow(clippy::pedantic)]
7196#[allow(clippy::nursery)]
7197#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7198pub struct TopKLayerParams {
7199 /// negative indexing is supported
7200 #[prost(int64, tag = "1")]
7201 pub axis: i64,
7202 /// is ignored if a second input is present.
7203 #[prost(uint64, tag = "2")]
7204 pub k: u64,
7205 /// if true, bottom K (values, indices) are returned instead
7206 #[prost(bool, tag = "3")]
7207 pub use_bottom_k: bool,
7208}
7209///
7210/// A layer that returns the indices of the maximum value along a specified axis in a tensor.
7211///
7212/// Requires 1 input and produces 1 output. Negative indexing is supported.
7213///
7214/// Output has the same rank as the input if "removeDim" is False (default).
7215/// Output has rank one less than the input if "removeDim" is True and input rank is more than 1.
7216///
7217/// e.g.:
7218///
7219/// input shape = (45, 34, 10, 5)
7220/// axis = -2
7221/// output shape = (45, 1, 10, 5), if removeDim = False (default)
7222/// output shape = (45, 10, 5), if removeDim = True
7223///
7224/// input shape = (5,)
7225/// axis = 0
7226/// output shape = (1,), if removeDim = False or True
7227///
7228#[allow(clippy::all)]
7229#[allow(clippy::pedantic)]
7230#[allow(clippy::nursery)]
7231#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7232pub struct ArgMaxLayerParams {
7233 #[prost(int64, tag = "1")]
7234 pub axis: i64,
7235 #[prost(bool, tag = "2")]
7236 pub remove_dim: bool,
7237}
7238///
7239/// A layer that returns the indices of the minimum value along a specified axis in a tensor.
7240///
7241/// Requires 1 input and produces 1 output. Negative indexing is supported.
7242///
7243/// Output has the same rank as the input if "removeDim" is False (default).
7244/// Output has rank one less than the input if "removeDim" is True and input rank is more than 1.
7245///
7246/// e.g.:
7247///
7248/// input shape = (45, 34, 10, 5)
7249/// axis = -2
7250/// output shape = (45, 1, 10, 5), if removeDim = False (default)
7251/// output shape = (45, 10, 5), if removeDim = True
7252///
7253/// input shape = (5,)
7254/// axis = 0
7255/// output shape = (1,), if removeDim = False or True
7256///
7257#[allow(clippy::all)]
7258#[allow(clippy::pedantic)]
7259#[allow(clippy::nursery)]
7260#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7261pub struct ArgMinLayerParams {
7262 #[prost(int64, tag = "1")]
7263 pub axis: i64,
7264 #[prost(bool, tag = "2")]
7265 pub remove_dim: bool,
7266}
7267///
7268/// A layer layer that splits the input tensor into multiple output tensors,
7269/// along the specified axis.
7270///
7271/// The layer either uniformly splits the input tensor into ``num_splits`` tensors, or
7272/// splits according to the given split sizes in ``split_sizes``.
7273/// Supports unequal splits and negative indexing.
7274///
7275/// Requires 1 input and produces at least 2 outputs.
7276/// Rank of all the outputs is same as that of the input.
7277///
7278/// If parameter "splitSizes" is provided, value of the parameter "numSplits" is ignored, since in that case
7279/// "numSplits" is automatically inferred to be the length of "splitSizes".
7280///
7281///
7282/// e.g.:
7283/// input shape: (5, 3, 4)
7284/// axis = -3, split_sizes = \[3, 2\]
7285/// output shape: (3, 3, 4)
7286/// output shape: (2, 3, 4)
7287#[allow(clippy::all)]
7288#[allow(clippy::pedantic)]
7289#[allow(clippy::nursery)]
7290#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
7291pub struct SplitNdLayerParams {
7292 #[prost(int64, tag = "1")]
7293 pub axis: i64,
7294 #[prost(uint64, tag = "2")]
7295 pub num_splits: u64,
7296 #[prost(uint64, repeated, tag = "3")]
7297 pub split_sizes: ::prost::alloc::vec::Vec<u64>,
7298}
7299///
7300/// A layer that performs element-wise ceil operation on the input tensor that
7301/// rounds the value to the smallest integer not less than x.
7302///
7303/// Requires 1 input and produces 1 output.
7304/// Output shape is same as the input.
7305///
7306#[allow(clippy::all)]
7307#[allow(clippy::pedantic)]
7308#[allow(clippy::nursery)]
7309#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7310pub struct CeilLayerParams {}
7311///
7312/// A layer that performs element-wise round operation on the input tensor
7313/// that rounds the value to the nearest integer.
7314///
7315/// Requires 1 input and produces 1 output.
7316/// Output shape is same as the input.
7317///
7318#[allow(clippy::all)]
7319#[allow(clippy::pedantic)]
7320#[allow(clippy::nursery)]
7321#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7322pub struct RoundLayerParams {}
7323///
7324/// A layer that performs element-wise floor operation on the input tensor
7325/// that rounds the value to the largest integer not greater than x.
7326///
7327/// Requires 1 input and produces 1 output.
7328/// Output shape is same as the input.
7329///
7330#[allow(clippy::all)]
7331#[allow(clippy::pedantic)]
7332#[allow(clippy::nursery)]
7333#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7334pub struct FloorLayerParams {}
7335///
7336/// A layer that performs element-wise sign operation (+1 for positive values,
7337/// -1 for negative values, 0 for zeros).
7338///
7339/// Requires 1 input and produces 1 output.
7340/// Output shape is same as the input.
7341///
7342#[allow(clippy::all)]
7343#[allow(clippy::pedantic)]
7344#[allow(clippy::nursery)]
7345#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7346pub struct SignLayerParams {}
7347///
7348/// A layer that performs element-wise clip operation. Clip the values in the
7349/// input tensor to the threshold values \[min_value, max_value\].
7350///
7351/// Requires 1 input and produces 1 output.
7352///
7353/// Parameter minVal: the minimum threshold.
7354/// Parameter maxVal: the maximum threshold.
7355///
7356/// output = min(max(input, minVal), maxVal)
7357///
7358/// Output shape is same as the input.
7359#[allow(clippy::all)]
7360#[allow(clippy::pedantic)]
7361#[allow(clippy::nursery)]
7362#[derive(Clone, Copy, PartialEq, ::prost::Message)]
7363pub struct ClipLayerParams {
7364 #[prost(float, tag = "1")]
7365 pub min_val: f32,
7366 #[prost(float, tag = "2")]
7367 pub max_val: f32,
7368}
7369///
7370/// A layer that extracts a slice of size ``(end - begin) / stride``
7371/// from the given input tensor.
7372/// Support negative indexing and negative strides.
7373///
7374/// Requires 1 input and produces 1 output.
7375/// Output rank is same as the input rank.
7376///
7377/// Value of beginIds, beginMasks, endIds, endMasks, strides are required parameters.
7378/// Lengths of all the parameters must equal the rank of the input.
7379///
7380/// i-th element of "beginIds" is ignored and assumed to be 0 if the i-th element of
7381/// "beginMasks" is True
7382///
7383/// i-th element of "endIds" is ignored and assumed to be -1 if the i-th element of
7384/// "endMasks" is True
7385///
7386/// e.g.:
7387/// if i-th element of "squeezeMasks" is set to True, only beginIds\[i\] would be sliced
7388/// out, and all other masks and inputs are ignored.
7389///
7390/// e.g. (without squeezeMasks):
7391/// input shape: (5, 5, 5)
7392/// beginIds: \[1, 2, 3\]
7393/// beginMasks: \[True, False, True\]
7394/// endIds: \[3, -3, 2\]
7395/// endMasks: \[False, True, True\]
7396/// strides: \[2, 2, 2\]
7397/// SqueezeMasks: \[False, False, False\]
7398/// output shape: (2, 2, 3)
7399/// This is equivalent to input\[:3:2, 2::2, ::2\]
7400///
7401/// e.g. (with squeezeMasks):
7402/// input shape: (5, 5, 5)
7403/// beginIds: \[1, 2, 3\]
7404/// beginMasks: \[True, False, True\]
7405/// endIds: \[3, -3, 2\]
7406/// endMasks: \[False, True, True\]
7407/// strides: \[2, 2, 2\]
7408/// SqueezeMasks: \[False, True, False\]
7409/// output shape: (2, 3)
7410/// This is equivalent to input\[:3:2, 2, ::2\]
7411///
7412#[allow(clippy::all)]
7413#[allow(clippy::pedantic)]
7414#[allow(clippy::nursery)]
7415#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
7416pub struct SliceStaticLayerParams {
7417 #[prost(int64, repeated, tag = "1")]
7418 pub begin_ids: ::prost::alloc::vec::Vec<i64>,
7419 #[prost(bool, repeated, tag = "2")]
7420 pub begin_masks: ::prost::alloc::vec::Vec<bool>,
7421 #[prost(int64, repeated, tag = "3")]
7422 pub end_ids: ::prost::alloc::vec::Vec<i64>,
7423 #[prost(bool, repeated, tag = "4")]
7424 pub end_masks: ::prost::alloc::vec::Vec<bool>,
7425 #[prost(int64, repeated, tag = "5")]
7426 pub strides: ::prost::alloc::vec::Vec<i64>,
7427 #[prost(bool, repeated, tag = "6")]
7428 pub squeeze_masks: ::prost::alloc::vec::Vec<bool>,
7429}
7430///
7431/// A layer that extracts a slice of size ``(end - begin) / stride``
7432/// from the given input tensor.
7433/// Support negative indexing and negative strides.
7434/// See "SliceStaticLayerParams" for the description and an example of the functionality of the layer.
7435///
7436/// Requires 2 to 7 inputs and produces 1 output.
7437/// Rank of the output is same as the rank of the first input unless squeezeMask is set.
7438///
7439/// Value of beginIds, beginMasks, endIds, endMasks, strides can be passed in either
7440/// as dynamic inputs or as static parameters.
7441/// Lengths of all the parameters or inputs from 2-6 must equal the rank of the first input.
7442///
7443/// The 2nd input represents the "beginIds".
7444/// The 3rd input, if present, corresponds to "endIds". In this case the value of the "endIds" parameter is ignored.
7445/// The 4th input, if present, corresponds to "strides". In this case the value of the "strides" parameter is ignored.
7446/// The 5th input, if present, corresponds to "beginMasks". In this case the value of the "beginMasks" parameter is ignored.
7447/// The 6th input, if present, corresponds to "endMasks". In this case the value of the "endMasks" parameter is ignored.
7448/// The 7th input, if present, corresponds to "squeezeMasks". In this case the value of the "squeezeMasks" parameter is ignored.
7449///
7450#[allow(clippy::all)]
7451#[allow(clippy::pedantic)]
7452#[allow(clippy::nursery)]
7453#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
7454pub struct SliceDynamicLayerParams {
7455 #[prost(bool, repeated, tag = "2")]
7456 pub begin_masks: ::prost::alloc::vec::Vec<bool>,
7457 #[prost(int64, repeated, tag = "3")]
7458 pub end_ids: ::prost::alloc::vec::Vec<i64>,
7459 #[prost(bool, repeated, tag = "4")]
7460 pub end_masks: ::prost::alloc::vec::Vec<bool>,
7461 #[prost(int64, repeated, tag = "5")]
7462 pub strides: ::prost::alloc::vec::Vec<i64>,
7463 #[prost(bool, repeated, tag = "6")]
7464 pub squeeze_masks: ::prost::alloc::vec::Vec<bool>,
7465}
7466///
7467/// A layer that constructs a tensor by repeating the input tensor multiple
7468/// number of times.
7469///
7470/// Requires 1 or 2 inputs and produces 1 output.
7471/// Output rank is same as the input rank.
7472///
7473/// If two inputs are provided, second input is used as "reps"
7474/// and "reps" parameter is ignored.
7475///
7476/// If only one input is provided,
7477/// length of the "reps" parameter must be at least 1 and
7478/// not greater than the rank of the input.
7479/// If it is less than the input rank, it is made equal to the input rank by prepending 1's to it.
7480///
7481/// e.g.:
7482///
7483/// input shape = (2, 4, 2)
7484/// reps = (1, 2, 6)
7485/// output shape = (2, 8, 12)
7486///
7487/// input shape = (2, 4, 2)
7488/// reps = (6)
7489/// reps after prepending ones = (1, 1, 6)
7490/// output shape = (2, 4, 12)
7491///
7492/// input shape = (2, 4, 2)
7493/// second input = \[1, 2, 6\] -> shape: (3,)
7494/// reps = N/A \[Ignored\]
7495/// output shape = (2, 8, 12)
7496///
7497#[allow(clippy::all)]
7498#[allow(clippy::pedantic)]
7499#[allow(clippy::nursery)]
7500#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
7501pub struct TileLayerParams {
7502 #[prost(uint64, repeated, tag = "1")]
7503 pub reps: ::prost::alloc::vec::Vec<u64>,
7504}
7505///
7506/// A layer that returns the shape of an input tensor.
7507///
7508/// Requires 1 input and produces 1 output.
7509///
7510/// Input: a tensor.
7511/// Output: a vector of length R, where R is the rank of the input tensor
7512/// Output is always a rank 1 tensor.
7513#[allow(clippy::all)]
7514#[allow(clippy::pedantic)]
7515#[allow(clippy::nursery)]
7516#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7517pub struct GetShapeLayerParams {}
7518///
7519/// A layer that computes the Gauss error function,
7520/// which is defined as:
7521///
7522/// .. math::
7523/// f(x) = \dfrac{1}{\sqrt{\pi}}\int_{-x}^{x}{e^{-t^2}dt}
7524///
7525/// Requires 1 input and produces 1 output.
7526/// Output shape is same as the input.
7527#[allow(clippy::all)]
7528#[allow(clippy::pedantic)]
7529#[allow(clippy::nursery)]
7530#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7531pub struct ErfLayerParams {}
7532///
7533/// A layer that evaluates the Gaussian Error Linear Unit (GELU) activation.
7534/// Following equations are used to compute the activation based on the value of the "mode" parameter:
7535///
7536/// mode == 'EXACT':
7537/// .. math::
7538/// f(x) = 0.5x\left ( 1+\rm{erf}\left ( \frac{x}{\sqrt{2}} \right ) \right )
7539///
7540/// mode == 'TANH_APPROXIMATION':
7541/// .. math::
7542/// f(x) = 0.5x\left ( 1+\rm{tanh}\left ( \sqrt{2/\pi}\left ( x + 0.044715x^3 \right ) \right ) \right )
7543///
7544/// mode == 'SIGMOID_APPROXIMATION':
7545/// .. math::
7546/// f(x) = x*\rm{sigmoid}(1.702x)
7547///
7548/// Requires 1 input and produces 1 output.
7549/// Output shape is same as the input.
7550///
7551#[allow(clippy::all)]
7552#[allow(clippy::pedantic)]
7553#[allow(clippy::nursery)]
7554#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7555pub struct GeluLayerParams {
7556 /// mode of GELU operation.
7557 #[prost(enumeration = "gelu_layer_params::GeluMode", tag = "1")]
7558 pub mode: i32,
7559}
7560/// Nested message and enum types in `GeluLayerParams`.
7561pub mod gelu_layer_params {
7562 #[allow(clippy::all)]
7563 #[allow(clippy::pedantic)]
7564 #[allow(clippy::nursery)]
7565 #[derive(
7566 Clone,
7567 Copy,
7568 Debug,
7569 PartialEq,
7570 Eq,
7571 Hash,
7572 PartialOrd,
7573 Ord,
7574 ::prost::Enumeration
7575 )]
7576 #[repr(i32)]
7577 pub enum GeluMode {
7578 Exact = 0,
7579 TanhApproximation = 1,
7580 SigmoidApproximation = 2,
7581 }
7582 impl GeluMode {
7583 /// String value of the enum field names used in the ProtoBuf definition.
7584 ///
7585 /// The values are not transformed in any way and thus are considered stable
7586 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
7587 pub fn as_str_name(&self) -> &'static str {
7588 match self {
7589 Self::Exact => "EXACT",
7590 Self::TanhApproximation => "TANH_APPROXIMATION",
7591 Self::SigmoidApproximation => "SIGMOID_APPROXIMATION",
7592 }
7593 }
7594 /// Creates an enum from field names used in the ProtoBuf definition.
7595 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
7596 match value {
7597 "EXACT" => Some(Self::Exact),
7598 "TANH_APPROXIMATION" => Some(Self::TanhApproximation),
7599 "SIGMOID_APPROXIMATION" => Some(Self::SigmoidApproximation),
7600 _ => None,
7601 }
7602 }
7603 }
7604}
7605///
7606/// RangeStatic layer that returns a tensor that contains evenly spaced values.
7607/// It is similar in functionality to the numpy.arange method.
7608///
7609/// Requires no input and produces 1 output.
7610/// Output is a rank 1 tensor.
7611#[allow(clippy::all)]
7612#[allow(clippy::pedantic)]
7613#[allow(clippy::nursery)]
7614#[derive(Clone, Copy, PartialEq, ::prost::Message)]
7615pub struct RangeStaticLayerParams {
7616 #[prost(float, tag = "1")]
7617 pub end_value: f32,
7618 #[prost(float, tag = "2")]
7619 pub start_value: f32,
7620 #[prost(float, tag = "3")]
7621 pub step_size_value: f32,
7622}
7623///
7624/// A layer that returns a tensor that contains evenly spaced values.
7625/// Its functionality is similar to the numpy.arange method.
7626///
7627/// Requires at least 1 input, up to a maximum of 3 inputs.
7628/// Produces 1 output, which is a rank 1 tensor.
7629///
7630/// Each input must be a scalar, or rank 1 and shape (1,).
7631///
7632/// The first input represents the "endValue".
7633/// The second input, if present, corresponds to "startValue". In this case the value of the "startValue" parameter is ignored.
7634/// The third input, if present, corresponds to "stepSizeValue". In this case the value of the "stepSizeValue" parameter is ignored.
7635///
7636#[allow(clippy::all)]
7637#[allow(clippy::pedantic)]
7638#[allow(clippy::nursery)]
7639#[derive(Clone, Copy, PartialEq, ::prost::Message)]
7640pub struct RangeDynamicLayerParams {
7641 #[prost(float, tag = "2")]
7642 pub start_value: f32,
7643 #[prost(float, tag = "3")]
7644 pub step_size_value: f32,
7645}
7646///
7647/// A layer that returns a tensor containing all windows of size ``windowSize``
7648/// separated by ``step`` along the dimension ``axis``.
7649///
7650/// .. code::
7651///
7652/// y = SlidingWindows(x)
7653///
7654/// Requires 1 input and produces 1 output.
7655///
7656/// Input
7657/// An N-Dimensional tensor.
7658///
7659/// Output
7660/// An (N+1)-Dimensional tensor.
7661///
7662/// This operation behaves as following:
7663/// - if axis = 0 & input is rank 1 (L,). Output shape will be (M, W).
7664/// - if axis = 1 & input is rank 3 (B1, L, C1). Output shape will be (B1, M, W, C1)
7665/// - if axis = 2 & input is rank 5 (B1, B2, L, C1, C2) --> (B1 * B2, L, C1 * C2) --> (B1 * B2, M, W, C1 * C2). Output shape will be (B1, B2, M, W, C1, C2)
7666/// - etc.
7667/// where
7668/// - L, C, B refer to input length, feature dimension length & batch size respectively
7669/// - W is the window size.
7670/// - M is the number of windows/slices calculated as M = (L - W) / step + 1
7671#[allow(clippy::all)]
7672#[allow(clippy::pedantic)]
7673#[allow(clippy::nursery)]
7674#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7675pub struct SlidingWindowsLayerParams {
7676 #[prost(int64, tag = "1")]
7677 pub axis: i64,
7678 #[prost(uint64, tag = "2")]
7679 pub window_size: u64,
7680 #[prost(uint64, tag = "3")]
7681 pub step: u64,
7682}
7683///
7684/// A layer that applies layer normalization over the input tensor.
7685///
7686/// Requires 1 input and produces 1 output.
7687///
7688/// output = gamma * (input - computed_mean) / (sqrt(computed_variance + eps)) + beta
7689///
7690/// Parameters
7691/// normalizedShape: subset of the input shape, along with layer norm is performed, rest of the input shape is treated as the batch dimension. The mean and variance are computed for the input, over the last few dimensions as specified by the normalizedShape parameter.
7692/// gamma: must have shape = "normalizedShape"
7693/// beta: must have shape = "normalizedShape"
7694/// eps: small constant to avoid division by 0
7695///
7696/// Output shape is same as the input.
7697///
7698/// e.g.:
7699/// input shape = (10,5)
7700/// normalized shape = (5,) or (10,5)
7701///
7702/// input shape = (10,5,6,7)
7703/// normalized shape = (7,) or (6,7) or (5,6,7) or (10,5,6,7)
7704#[allow(clippy::all)]
7705#[allow(clippy::pedantic)]
7706#[allow(clippy::nursery)]
7707#[derive(Clone, PartialEq, ::prost::Message)]
7708pub struct LayerNormalizationLayerParams {
7709 #[prost(int64, repeated, tag = "1")]
7710 pub normalized_shape: ::prost::alloc::vec::Vec<i64>,
7711 #[prost(float, tag = "2")]
7712 pub eps: f32,
7713 #[prost(message, optional, tag = "3")]
7714 pub gamma: ::core::option::Option<WeightParams>,
7715 #[prost(message, optional, tag = "4")]
7716 pub beta: ::core::option::Option<WeightParams>,
7717}
7718///
7719/// Non maximum suppression (NMS) layer.
7720/// Applies the non maximum suppression algorithm to input bounding box coordinates.
7721/// The effect of this layer is similar to the functionality of the "NonMaximumSuppression"
7722/// model type (for details please see NonMaximumSuppression.proto) with a couple of differences.
7723/// One, this is a layer in a neural network model, whereas that is a different model type. Second,
7724/// this layer supports a batch of bounding boxes.
7725///
7726/// The NMS layer requires at least 2 inputs, and up to a maximum of 5 inputs. It produces 4 outputs.
7727/// Following is the description of inputs and outputs:
7728///
7729/// input 1, shape (B,N,4): coordinates of N boxes, for a batch size B.
7730/// input 2, shape (B,N,C): class scores for each box. C can be 1 when there is only 1 score per box, i.e., no class specific score.
7731///
7732/// input 3, optional, shape (1,): IoU threshold. When present, it overwrites the value provided in layer parameter "iouThreshold".
7733/// input 4, optional, shape (1,): Score threshold. When present, it overwrites the value provided in layer parameter "scoreThreshold".
7734/// input 5, optional, shape (1,): Maximum number of boxes. When present, it overwrites the value provided in layer parameter "maxBoxes".
7735///
7736/// output 1, shape (B,maxBoxes,4): box coordinates, corresponding to the surviving boxes.
7737/// output 2, shape (B,maxBoxes,C): box scores, corresponding to the surviving boxes.
7738/// output 3, shape (B,maxBoxes): indices of the surviving boxes. Hence it will have values in the range \[0,N-1\], except for padding.
7739/// output 4, shape (B,): number of boxes selected after the NMS algorithm, for each batch.
7740///
7741/// When surviving boxes are less than "maxBoxes", the first 3 outputs are padded.
7742/// For the first two outputs, the padding is done using values 0, whereas for the third output the
7743/// padding value used is -1, since the output values represent indices.
7744///
7745/// If no box survives, that is, all the scores are below the "scoreThreshold",
7746/// then for that batch, number of boxes (value of the fourth output) will be 1. The first 3 outputs will
7747/// correspond to the box with the highest score. This is to avoid generating an "empty" output.
7748///
7749/// The four values that describe the box dimensions are (in order):
7750///
7751/// - x (center location of the box along the horizontal axis)
7752/// - y (center location of the box along the vertical axis)
7753/// - width (size of box along the horizontal axis)
7754/// - height (size of box on along the vertical axis)
7755///
7756/// In each batch,
7757/// the N scores for N boxes, used for suppression, are generated by taking the max of the matrix (N,C)
7758/// along the columns.
7759/// If "perClassSuppression" flag is false, suppression happens across all classes.
7760/// If "perClassSuppression" flag is true, each box is assigned to the class with the highest
7761/// score and then the suppression happens separately for boxes within the same class.
7762///
7763/// Note that the 4th output can be used to dynamically slice the first 3 outputs, in case
7764/// the padded outputs are not required.
7765///
7766#[allow(clippy::all)]
7767#[allow(clippy::pedantic)]
7768#[allow(clippy::nursery)]
7769#[derive(Clone, Copy, PartialEq, ::prost::Message)]
7770pub struct NonMaximumSuppressionLayerParams {
7771 ///
7772 /// The intersection over union (IoU) threshold over which boxes are suppressed.
7773 #[prost(float, tag = "1")]
7774 pub iou_threshold: f32,
7775 ///
7776 /// Before IoU suppression is performed, boxes with class scores below this threshold are rejected.
7777 #[prost(float, tag = "2")]
7778 pub score_threshold: f32,
7779 ///
7780 /// The maximum number of boxes to be given out as output.
7781 /// If the number of surviving boxes are less, output is padded up to this number.
7782 #[prost(uint64, tag = "3")]
7783 pub max_boxes: u64,
7784 ///
7785 /// If true, suppression is performed independently within boxes of each class.
7786 #[prost(bool, tag = "4")]
7787 pub per_class_suppression: bool,
7788}
7789///
7790/// A layer that performs element-wise clamped ReLU operation.
7791///
7792/// Requires 1 input and produces 1 output.
7793///
7794/// This function has the following formula:
7795///
7796/// .. math::
7797/// f(x) = \begin{cases}
7798/// \text{min}(\text{beta},x) \;\; \text{if} \;\; x \geq 0\\
7799/// \text{min}(\text{beta} ,\text{alpha}\cdot x) \;\; \text{if} \;\; x<0
7800/// \end{cases}
7801///
7802/// Output shape is same as the input.
7803///
7804/// Available (iOS >= 14, macOS >= 11.0, watchOS >= 7)
7805#[allow(clippy::all)]
7806#[allow(clippy::pedantic)]
7807#[allow(clippy::nursery)]
7808#[derive(Clone, Copy, PartialEq, ::prost::Message)]
7809pub struct ClampedReLuLayerParams {
7810 #[prost(float, tag = "1")]
7811 pub alpha: f32,
7812 #[prost(float, tag = "2")]
7813 pub beta: f32,
7814}
7815///
7816/// A layer that returns the indices that would sort the input tensor, along a specified axis.
7817///
7818/// Requires 1 input and produces 1 output.
7819///
7820/// Output has the same rank and shape as the input.
7821///
7822/// Value of "axis" must be positive and less than the rank of the input.
7823///
7824/// e.g.:
7825///
7826/// input shape = (5,)
7827/// axis = 0
7828/// input values = \[3.1, 5.4, 32.9, 3.2, 77.0\]
7829/// output shape = (5,)
7830/// output values = \[0, 3, 1, 2, 4\], descending = False
7831/// output values = \[4, 2, 1, 3, 0\], descending = True
7832///
7833/// input shape = (2,3)
7834/// axis = 1
7835/// input values = \[[3, 5, 32\], \[3, 77, 6]\]
7836/// output shape = (2,3)
7837/// output values = \[[0, 1, 2\], \[0, 2, 1]\], descending = False
7838/// output values = \[[2, 1, 0\], \[1, 2, 0]\], descending = True
7839///
7840#[allow(clippy::all)]
7841#[allow(clippy::pedantic)]
7842#[allow(clippy::nursery)]
7843#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7844pub struct ArgSortLayerParams {
7845 /// must be between \[0, input_rank - 1\]
7846 #[prost(int64, tag = "1")]
7847 pub axis: i64,
7848 #[prost(bool, tag = "2")]
7849 pub descending: bool,
7850}
7851///
7852/// A layer that does slice operation by providing size to be extracted
7853/// from the given input tensor.
7854///
7855/// Requires 2 inputs and produces 1 output.
7856/// Rank of the output is same as the rank of the first input.
7857///
7858/// The 1st input represents the tensor to be sliced.
7859/// The 2nd input represents the beginning index to be sliced from.
7860///
7861/// Example:
7862/// Input 1: x (x.shape = (2, 3, 4))
7863/// Input 2: begin
7864/// size: 2
7865/// axis: 1
7866///
7867/// Output: x\[:, begin:begin+2, :\]
7868///
7869#[allow(clippy::all)]
7870#[allow(clippy::pedantic)]
7871#[allow(clippy::nursery)]
7872#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7873pub struct SliceBySizeLayerParams {
7874 #[prost(int64, tag = "2")]
7875 pub size: i64,
7876 #[prost(int64, tag = "3")]
7877 pub axis: i64,
7878}
7879///
7880/// A neural network specialized as a classifier.
7881#[allow(clippy::all)]
7882#[allow(clippy::pedantic)]
7883#[allow(clippy::nursery)]
7884#[derive(Clone, PartialEq, ::prost::Message)]
7885pub struct NeuralNetworkClassifier {
7886 #[prost(message, repeated, tag = "1")]
7887 pub layers: ::prost::alloc::vec::Vec<NeuralNetworkLayer>,
7888 #[prost(message, repeated, tag = "2")]
7889 pub preprocessing: ::prost::alloc::vec::Vec<NeuralNetworkPreprocessing>,
7890 /// use this enum value to determine the input tensor shapes to the neural network, for multiarray inputs
7891 #[prost(enumeration = "NeuralNetworkMultiArrayShapeMapping", tag = "5")]
7892 pub array_input_shape_mapping: i32,
7893 /// use this enum value to determine the input tensor shapes to the neural network, for image inputs
7894 #[prost(enumeration = "NeuralNetworkImageShapeMapping", tag = "6")]
7895 pub image_input_shape_mapping: i32,
7896 #[prost(message, optional, tag = "10")]
7897 pub update_params: ::core::option::Option<NetworkUpdateParameters>,
7898 /// The name of the output blob containing the probability of each class.
7899 /// In other words, the score vector. Must be a 1-D tensor with the same
7900 /// number and order of elements as ClassLabels.
7901 #[prost(string, tag = "200")]
7902 pub label_probability_layer_name: ::prost::alloc::string::String,
7903 /// The set of labels for every possible class.
7904 #[prost(oneof = "neural_network_classifier::ClassLabels", tags = "100, 101")]
7905 pub class_labels: ::core::option::Option<neural_network_classifier::ClassLabels>,
7906}
7907/// Nested message and enum types in `NeuralNetworkClassifier`.
7908pub mod neural_network_classifier {
7909 /// The set of labels for every possible class.
7910 #[allow(clippy::all)]
7911 #[allow(clippy::pedantic)]
7912 #[allow(clippy::nursery)]
7913 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
7914 pub enum ClassLabels {
7915 #[prost(message, tag = "100")]
7916 StringClassLabels(super::StringVector),
7917 #[prost(message, tag = "101")]
7918 Int64ClassLabels(super::Int64Vector),
7919 }
7920}
7921#[allow(clippy::all)]
7922#[allow(clippy::pedantic)]
7923#[allow(clippy::nursery)]
7924#[derive(Clone, Copy, PartialEq, ::prost::Message)]
7925pub struct OneHotLayerParams {
7926 /// size of the one hot vector
7927 #[prost(uint64, tag = "1")]
7928 pub one_hot_vector_size: u64,
7929 /// negative indexing is supported. It refers to the axis in the output tensor.
7930 #[prost(int64, tag = "2")]
7931 pub axis: i64,
7932 #[prost(float, tag = "3")]
7933 pub on_value: f32,
7934 #[prost(float, tag = "4")]
7935 pub off_value: f32,
7936}
7937#[allow(clippy::all)]
7938#[allow(clippy::pedantic)]
7939#[allow(clippy::nursery)]
7940#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
7941pub struct CumSumLayerParams {
7942 /// negative indexing is supported
7943 #[prost(int64, tag = "1")]
7944 pub axis: i64,
7945 /// if true, the first element of the output is 0, and the last element contains the sum of the input up to the penultimate value
7946 /// if false, the first element of the output is same as the input and the last element is the sum of all the input values
7947 /// (this behavior is reversed when "reverse" flag is True)
7948 #[prost(bool, tag = "2")]
7949 pub exclude_final_sum: bool,
7950 /// if true, cumsum is performed in the opposite direction
7951 #[prost(bool, tag = "3")]
7952 pub reverse: bool,
7953}
7954///
7955/// A neural network specialized as a regressor.
7956#[allow(clippy::all)]
7957#[allow(clippy::pedantic)]
7958#[allow(clippy::nursery)]
7959#[derive(Clone, PartialEq, ::prost::Message)]
7960pub struct NeuralNetworkRegressor {
7961 #[prost(message, repeated, tag = "1")]
7962 pub layers: ::prost::alloc::vec::Vec<NeuralNetworkLayer>,
7963 #[prost(message, repeated, tag = "2")]
7964 pub preprocessing: ::prost::alloc::vec::Vec<NeuralNetworkPreprocessing>,
7965 /// use this enum value to determine the input tensor shapes to the neural network, for multiarray inputs
7966 #[prost(enumeration = "NeuralNetworkMultiArrayShapeMapping", tag = "5")]
7967 pub array_input_shape_mapping: i32,
7968 /// use this enum value to determine the input tensor shapes to the neural network, for image inputs
7969 #[prost(enumeration = "NeuralNetworkImageShapeMapping", tag = "6")]
7970 pub image_input_shape_mapping: i32,
7971 #[prost(message, optional, tag = "10")]
7972 pub update_params: ::core::option::Option<NetworkUpdateParameters>,
7973}
7974///
7975/// Details on how the network will be updated
7976#[allow(clippy::all)]
7977#[allow(clippy::pedantic)]
7978#[allow(clippy::nursery)]
7979#[derive(Clone, PartialEq, ::prost::Message)]
7980pub struct NetworkUpdateParameters {
7981 #[prost(message, repeated, tag = "1")]
7982 pub loss_layers: ::prost::alloc::vec::Vec<LossLayer>,
7983 #[prost(message, optional, tag = "2")]
7984 pub optimizer: ::core::option::Option<Optimizer>,
7985 #[prost(message, optional, tag = "3")]
7986 pub epochs: ::core::option::Option<Int64Parameter>,
7987 ///
7988 /// Describes whether to shuffle the batch of data between epochs.
7989 #[prost(message, optional, tag = "10")]
7990 pub shuffle: ::core::option::Option<BoolParameter>,
7991 ///
7992 /// The seed to be used in an associated random number generator.
7993 #[prost(message, optional, tag = "20")]
7994 pub seed: ::core::option::Option<Int64Parameter>,
7995}
7996///
7997/// Loss layer - categorical cross entropy and mean squared error are the only supported loss functions currently
7998#[allow(clippy::all)]
7999#[allow(clippy::pedantic)]
8000#[allow(clippy::nursery)]
8001#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
8002pub struct LossLayer {
8003 #[prost(string, tag = "1")]
8004 pub name: ::prost::alloc::string::String,
8005 #[prost(oneof = "loss_layer::LossLayerType", tags = "10, 11")]
8006 pub loss_layer_type: ::core::option::Option<loss_layer::LossLayerType>,
8007}
8008/// Nested message and enum types in `LossLayer`.
8009pub mod loss_layer {
8010 #[allow(clippy::all)]
8011 #[allow(clippy::pedantic)]
8012 #[allow(clippy::nursery)]
8013 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
8014 pub enum LossLayerType {
8015 #[prost(message, tag = "10")]
8016 CategoricalCrossEntropyLossLayer(super::CategoricalCrossEntropyLossLayer),
8017 #[prost(message, tag = "11")]
8018 MeanSquaredErrorLossLayer(super::MeanSquaredErrorLossLayer),
8019 }
8020}
8021///
8022/// Categorical cross entropy loss layer
8023/// Categorical cross entropy is used for single label categorization (only one category is applicable for each data point).
8024///
8025/// The input is a vector of length N representing the distribution over N categories. It must be the output of a softmax.
8026///
8027/// The target is a single value representing the true category or class label. If the target is the predictedFeatureName of a neural network classifier it will be inverse mapped to the corresponding categorical index for you.
8028///
8029/// math:
8030/// Loss_{CCE}(input, target) = -\sum_{i=1}^{N} (target == i) log( input\[i\] ) = - log (input\[target\])
8031#[allow(clippy::all)]
8032#[allow(clippy::pedantic)]
8033#[allow(clippy::nursery)]
8034#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
8035pub struct CategoricalCrossEntropyLossLayer {
8036 #[prost(string, tag = "1")]
8037 pub input: ::prost::alloc::string::String,
8038 #[prost(string, tag = "2")]
8039 pub target: ::prost::alloc::string::String,
8040}
8041///
8042/// Mean squared error loss layer,
8043/// specifying input and target
8044#[allow(clippy::all)]
8045#[allow(clippy::pedantic)]
8046#[allow(clippy::nursery)]
8047#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
8048pub struct MeanSquaredErrorLossLayer {
8049 #[prost(string, tag = "1")]
8050 pub input: ::prost::alloc::string::String,
8051 #[prost(string, tag = "2")]
8052 pub target: ::prost::alloc::string::String,
8053}
8054///
8055/// Optimizer - stochastic gradient descent and adam are the only supported optimizers currently
8056#[allow(clippy::all)]
8057#[allow(clippy::pedantic)]
8058#[allow(clippy::nursery)]
8059#[derive(Clone, PartialEq, ::prost::Message)]
8060pub struct Optimizer {
8061 #[prost(oneof = "optimizer::OptimizerType", tags = "10, 11")]
8062 pub optimizer_type: ::core::option::Option<optimizer::OptimizerType>,
8063}
8064/// Nested message and enum types in `Optimizer`.
8065pub mod optimizer {
8066 #[allow(clippy::all)]
8067 #[allow(clippy::pedantic)]
8068 #[allow(clippy::nursery)]
8069 #[derive(Clone, PartialEq, ::prost::Oneof)]
8070 pub enum OptimizerType {
8071 #[prost(message, tag = "10")]
8072 SgdOptimizer(super::SgdOptimizer),
8073 #[prost(message, tag = "11")]
8074 AdamOptimizer(super::AdamOptimizer),
8075 }
8076}
8077///
8078/// Stochastic gradient descent optimizer,
8079/// specifying configurable learning rate, mini batch size, and momentum
8080#[allow(clippy::all)]
8081#[allow(clippy::pedantic)]
8082#[allow(clippy::nursery)]
8083#[derive(Clone, PartialEq, ::prost::Message)]
8084pub struct SgdOptimizer {
8085 #[prost(message, optional, tag = "1")]
8086 pub learning_rate: ::core::option::Option<DoubleParameter>,
8087 #[prost(message, optional, tag = "2")]
8088 pub mini_batch_size: ::core::option::Option<Int64Parameter>,
8089 #[prost(message, optional, tag = "3")]
8090 pub momentum: ::core::option::Option<DoubleParameter>,
8091}
8092///
8093/// Adam optimizer,
8094/// specifying configurable learning rate, mini batch size, betas, and eps
8095#[allow(clippy::all)]
8096#[allow(clippy::pedantic)]
8097#[allow(clippy::nursery)]
8098#[derive(Clone, PartialEq, ::prost::Message)]
8099pub struct AdamOptimizer {
8100 #[prost(message, optional, tag = "1")]
8101 pub learning_rate: ::core::option::Option<DoubleParameter>,
8102 #[prost(message, optional, tag = "2")]
8103 pub mini_batch_size: ::core::option::Option<Int64Parameter>,
8104 #[prost(message, optional, tag = "3")]
8105 pub beta1: ::core::option::Option<DoubleParameter>,
8106 #[prost(message, optional, tag = "4")]
8107 pub beta2: ::core::option::Option<DoubleParameter>,
8108 #[prost(message, optional, tag = "5")]
8109 pub eps: ::core::option::Option<DoubleParameter>,
8110}
8111#[allow(clippy::all)]
8112#[allow(clippy::pedantic)]
8113#[allow(clippy::nursery)]
8114#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
8115#[repr(i32)]
8116pub enum NeuralNetworkMultiArrayShapeMapping {
8117 ///
8118 /// Default legacy value. Only supported for Core ML Specification version <= 3.
8119 ///
8120 /// The default legacy shape mapping resolves all input shapes to a rank 5 equivalent
8121 /// with axis notation of \[Seq, Batch, Channel, Height, Width\].
8122 ///
8123 /// When this enum value is selected,
8124 /// the repeated shape field in the message "ArrayFeatureType" in feature types proto,
8125 /// must be either length 1 or length 3.
8126 ///
8127 /// The following rule is used to map the values in the shape field to the actual tensor shape:
8128 /// rank 1 shape is mapped to shape \[1,1,C,1,1\]
8129 /// rank 3 shape is mapped to shape \[1,1,C,H,W\]
8130 /// At runtime, the first two dimensions (Seq or Batch) can be presented as well, with non-1 values.
8131 ///
8132 /// It is invalid to use this enum value if any of the layers added
8133 /// Specification version 4 (iOS >= 13, macOS >= 10.15) onwards are used in the network.
8134 /// Validator will raise an error in that case.
8135 Rank5ArrayMapping = 0,
8136 ///
8137 /// The exact shape and rank (i.e. number of dimensions in the shape) of the input,
8138 /// as specified in the message "ArrayFeatureType", is passed through to the layers.
8139 /// Supported only for Specification version >= 4 (iOS >= 13, macOS >= 10.15).
8140 ExactArrayMapping = 1,
8141}
8142impl NeuralNetworkMultiArrayShapeMapping {
8143 /// String value of the enum field names used in the ProtoBuf definition.
8144 ///
8145 /// The values are not transformed in any way and thus are considered stable
8146 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
8147 pub fn as_str_name(&self) -> &'static str {
8148 match self {
8149 Self::Rank5ArrayMapping => "RANK5_ARRAY_MAPPING",
8150 Self::ExactArrayMapping => "EXACT_ARRAY_MAPPING",
8151 }
8152 }
8153 /// Creates an enum from field names used in the ProtoBuf definition.
8154 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
8155 match value {
8156 "RANK5_ARRAY_MAPPING" => Some(Self::Rank5ArrayMapping),
8157 "EXACT_ARRAY_MAPPING" => Some(Self::ExactArrayMapping),
8158 _ => None,
8159 }
8160 }
8161}
8162#[allow(clippy::all)]
8163#[allow(clippy::pedantic)]
8164#[allow(clippy::nursery)]
8165#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
8166#[repr(i32)]
8167pub enum NeuralNetworkImageShapeMapping {
8168 ///
8169 /// In this case, image input is mapped to a rank 5 tensor.
8170 /// For Color images, input tensor is shaped as \[1,1,3,H,W\].
8171 /// For Gray images, input tensor is shaped as \[1,1,1,H,W\].
8172 Rank5ImageMapping = 0,
8173 ///
8174 /// For Color images, input tensor is shaped as \[1,3,H,W\].
8175 /// For Gray images, input tensor is shaped as \[1,1,H,W\].
8176 /// Supported only for Specification version >= 4 (iOS >= 13, macOS >= 10.15).
8177 Rank4ImageMapping = 1,
8178}
8179impl NeuralNetworkImageShapeMapping {
8180 /// String value of the enum field names used in the ProtoBuf definition.
8181 ///
8182 /// The values are not transformed in any way and thus are considered stable
8183 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
8184 pub fn as_str_name(&self) -> &'static str {
8185 match self {
8186 Self::Rank5ImageMapping => "RANK5_IMAGE_MAPPING",
8187 Self::Rank4ImageMapping => "RANK4_IMAGE_MAPPING",
8188 }
8189 }
8190 /// Creates an enum from field names used in the ProtoBuf definition.
8191 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
8192 match value {
8193 "RANK5_IMAGE_MAPPING" => Some(Self::Rank5ImageMapping),
8194 "RANK4_IMAGE_MAPPING" => Some(Self::Rank4ImageMapping),
8195 _ => None,
8196 }
8197 }
8198}
8199///
8200/// Scatter accumulation mode.
8201#[allow(clippy::all)]
8202#[allow(clippy::pedantic)]
8203#[allow(clippy::nursery)]
8204#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
8205#[repr(i32)]
8206pub enum ScatterMode {
8207 ScatterUpdate = 0,
8208 /// add
8209 ScatterAdd = 1,
8210 /// subtract
8211 ScatterSub = 2,
8212 /// multiply
8213 ScatterMul = 3,
8214 /// divide
8215 ScatterDiv = 4,
8216 /// maximum
8217 ScatterMax = 5,
8218 /// minimum
8219 ScatterMin = 6,
8220}
8221impl ScatterMode {
8222 /// String value of the enum field names used in the ProtoBuf definition.
8223 ///
8224 /// The values are not transformed in any way and thus are considered stable
8225 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
8226 pub fn as_str_name(&self) -> &'static str {
8227 match self {
8228 Self::ScatterUpdate => "SCATTER_UPDATE",
8229 Self::ScatterAdd => "SCATTER_ADD",
8230 Self::ScatterSub => "SCATTER_SUB",
8231 Self::ScatterMul => "SCATTER_MUL",
8232 Self::ScatterDiv => "SCATTER_DIV",
8233 Self::ScatterMax => "SCATTER_MAX",
8234 Self::ScatterMin => "SCATTER_MIN",
8235 }
8236 }
8237 /// Creates an enum from field names used in the ProtoBuf definition.
8238 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
8239 match value {
8240 "SCATTER_UPDATE" => Some(Self::ScatterUpdate),
8241 "SCATTER_ADD" => Some(Self::ScatterAdd),
8242 "SCATTER_SUB" => Some(Self::ScatterSub),
8243 "SCATTER_MUL" => Some(Self::ScatterMul),
8244 "SCATTER_DIV" => Some(Self::ScatterDiv),
8245 "SCATTER_MAX" => Some(Self::ScatterMax),
8246 "SCATTER_MIN" => Some(Self::ScatterMin),
8247 _ => None,
8248 }
8249 }
8250}
8251///
8252/// A FeatureVectorizer puts one or more features into a single array.
8253///
8254/// The ordering of features in the output array is determined by
8255/// ``inputList``.
8256///
8257/// ``inputDimensions`` is a zero based index.
8258#[allow(clippy::all)]
8259#[allow(clippy::pedantic)]
8260#[allow(clippy::nursery)]
8261#[derive(Clone, PartialEq, ::prost::Message)]
8262pub struct FeatureVectorizer {
8263 #[prost(message, repeated, tag = "1")]
8264 pub input_list: ::prost::alloc::vec::Vec<feature_vectorizer::InputColumn>,
8265}
8266/// Nested message and enum types in `FeatureVectorizer`.
8267pub mod feature_vectorizer {
8268 #[allow(clippy::all)]
8269 #[allow(clippy::pedantic)]
8270 #[allow(clippy::nursery)]
8271 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
8272 pub struct InputColumn {
8273 #[prost(string, tag = "1")]
8274 pub input_column: ::prost::alloc::string::String,
8275 #[prost(uint64, tag = "2")]
8276 pub input_dimensions: u64,
8277 }
8278}
8279#[allow(clippy::all)]
8280#[allow(clippy::pedantic)]
8281#[allow(clippy::nursery)]
8282#[derive(Clone, PartialEq, ::prost::Message)]
8283pub struct ClassConfidenceThresholding {
8284 /// *
8285 /// The precision-recall curve for each class label.
8286 ///
8287 /// The field is optional. When it exists, the number of curves
8288 /// must match the number of class labels.
8289 #[prost(message, repeated, tag = "100")]
8290 pub precision_recall_curves: ::prost::alloc::vec::Vec<PrecisionRecallCurve>,
8291}
8292#[allow(clippy::all)]
8293#[allow(clippy::pedantic)]
8294#[allow(clippy::nursery)]
8295#[derive(Clone, PartialEq, ::prost::Message)]
8296pub struct BayesianProbitRegressor {
8297 #[prost(uint32, tag = "1")]
8298 pub number_of_features: u32,
8299 /// bias term
8300 #[prost(message, optional, tag = "2")]
8301 pub bias: ::core::option::Option<bayesian_probit_regressor::Gaussian>,
8302 ///
8303 /// Set of features with associated weights
8304 ///
8305 /// feature weights
8306 #[prost(message, repeated, tag = "3")]
8307 pub features: ::prost::alloc::vec::Vec<bayesian_probit_regressor::FeatureWeight>,
8308 ///
8309 /// Set this name to be the same as input feature of type multi-array (1D)
8310 /// in the model description you want to use as the regression input
8311 #[prost(string, tag = "10")]
8312 pub regression_input_feature_name: ::prost::alloc::string::String,
8313 ///
8314 /// Set this name to be the same as optional input feature of type double
8315 /// in the model description you want to use as the optimism input
8316 #[prost(string, tag = "11")]
8317 pub optimism_input_feature_name: ::prost::alloc::string::String,
8318 ///
8319 /// Set this name to be the same as optional input feature of type double
8320 /// in the model description you want to use as the samplingScale input
8321 #[prost(string, tag = "12")]
8322 pub sampling_scale_input_feature_name: ::prost::alloc::string::String,
8323 ///
8324 /// Set this name to be the same as optional input feature of type double
8325 /// in the model description you want to use as the samplingBounds input
8326 #[prost(string, tag = "13")]
8327 pub sampling_truncation_input_feature_name: ::prost::alloc::string::String,
8328 ///
8329 /// name of 'mean' output feature
8330 #[prost(string, tag = "20")]
8331 pub mean_output_feature_name: ::prost::alloc::string::String,
8332 ///
8333 /// name of 'variance' output feature
8334 #[prost(string, tag = "21")]
8335 pub variance_output_feature_name: ::prost::alloc::string::String,
8336 ///
8337 /// name of 'pessimistic' output feature
8338 #[prost(string, tag = "22")]
8339 pub pessimistic_probability_output_feature_name: ::prost::alloc::string::String,
8340 ///
8341 /// name of 'sampled' output feature: samples from the scaled posterior probability distribuiton
8342 #[prost(string, tag = "23")]
8343 pub sampled_probability_output_feature_name: ::prost::alloc::string::String,
8344}
8345/// Nested message and enum types in `BayesianProbitRegressor`.
8346pub mod bayesian_probit_regressor {
8347 ///
8348 /// Parameterization of a Gaussian distribution
8349 #[allow(clippy::all)]
8350 #[allow(clippy::pedantic)]
8351 #[allow(clippy::nursery)]
8352 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
8353 pub struct Gaussian {
8354 #[prost(double, tag = "1")]
8355 pub mean: f64,
8356 /// inverse of the variance
8357 #[prost(double, tag = "2")]
8358 pub precision: f64,
8359 }
8360 ///
8361 /// Weight for a specific feature value
8362 /// The weight is represented as a Gaussian distribution
8363 /// with a mean and precision (1/variance) to capture
8364 /// uncertainty in the weight
8365 #[allow(clippy::all)]
8366 #[allow(clippy::pedantic)]
8367 #[allow(clippy::nursery)]
8368 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
8369 pub struct FeatureValueWeight {
8370 #[prost(uint32, tag = "1")]
8371 pub feature_value: u32,
8372 #[prost(message, optional, tag = "2")]
8373 pub feature_weight: ::core::option::Option<Gaussian>,
8374 }
8375 ///
8376 /// Feature with associated weights (for different values)
8377 /// Each feature has a set of weights for the (discrete) values
8378 /// it can take
8379 #[allow(clippy::all)]
8380 #[allow(clippy::pedantic)]
8381 #[allow(clippy::nursery)]
8382 #[derive(Clone, PartialEq, ::prost::Message)]
8383 pub struct FeatureWeight {
8384 #[prost(uint32, tag = "1")]
8385 pub feature_id: u32,
8386 #[prost(message, repeated, tag = "2")]
8387 pub weights: ::prost::alloc::vec::Vec<FeatureValueWeight>,
8388 }
8389}
8390///
8391/// Tree ensemble parameters.
8392#[allow(clippy::all)]
8393#[allow(clippy::pedantic)]
8394#[allow(clippy::nursery)]
8395#[derive(Clone, PartialEq, ::prost::Message)]
8396pub struct TreeEnsembleParameters {
8397 #[prost(message, repeated, tag = "1")]
8398 pub nodes: ::prost::alloc::vec::Vec<tree_ensemble_parameters::TreeNode>,
8399 ///
8400 /// The number of prediction dimensions or classes in the model.
8401 ///
8402 /// All instances of ``evaluationIndex`` in a leaf node
8403 /// must be less than this value,
8404 /// and the number of values in the ``basePredictionValue`` field
8405 /// must be equal to this value.
8406 ///
8407 /// For regression,
8408 /// this is the dimension of the prediction.
8409 /// For classification,
8410 /// this is the number of classes.
8411 #[prost(uint64, tag = "2")]
8412 pub num_prediction_dimensions: u64,
8413 ///
8414 /// The base prediction value.
8415 ///
8416 /// The number of values in this must match
8417 /// the default values of the tree model.
8418 #[prost(double, repeated, tag = "3")]
8419 pub base_prediction_value: ::prost::alloc::vec::Vec<f64>,
8420}
8421/// Nested message and enum types in `TreeEnsembleParameters`.
8422pub mod tree_ensemble_parameters {
8423 #[allow(clippy::all)]
8424 #[allow(clippy::pedantic)]
8425 #[allow(clippy::nursery)]
8426 #[derive(Clone, PartialEq, ::prost::Message)]
8427 pub struct TreeNode {
8428 #[prost(uint64, tag = "1")]
8429 pub tree_id: u64,
8430 #[prost(uint64, tag = "2")]
8431 pub node_id: u64,
8432 ///
8433 /// The branch mode parameters.
8434 ///
8435 /// If branch is false,
8436 /// then the parameters in this section must be filled in
8437 /// to determine how the branching functions.
8438 #[prost(enumeration = "tree_node::TreeNodeBehavior", tag = "3")]
8439 pub node_behavior: i32,
8440 ///
8441 /// If the node behavior mode is a branch mode,
8442 /// then these values must be filled in.
8443 #[prost(uint64, tag = "10")]
8444 pub branch_feature_index: u64,
8445 #[prost(double, tag = "11")]
8446 pub branch_feature_value: f64,
8447 #[prost(uint64, tag = "12")]
8448 pub true_child_node_id: u64,
8449 #[prost(uint64, tag = "13")]
8450 pub false_child_node_id: u64,
8451 #[prost(bool, tag = "14")]
8452 pub missing_value_tracks_true_child: bool,
8453 #[prost(message, repeated, tag = "20")]
8454 pub evaluation_info: ::prost::alloc::vec::Vec<tree_node::EvaluationInfo>,
8455 ///
8456 /// The relative hit rate of a node for optimization purposes.
8457 ///
8458 /// This value has no effect on the accuracy of the result;
8459 /// it allows the tree to optimize for frequent branches.
8460 /// The value is relative,
8461 /// compared to the hit rates of other branch nodes.
8462 ///
8463 /// You typically use a proportion of training samples
8464 /// that reached this node
8465 /// or some similar metric to derive this value.
8466 #[prost(double, tag = "30")]
8467 pub relative_hit_rate: f64,
8468 }
8469 /// Nested message and enum types in `TreeNode`.
8470 pub mod tree_node {
8471 ///
8472 /// The leaf mode.
8473 ///
8474 /// If ``nodeBahavior`` == ``LeafNode``,
8475 /// then the evaluationValue is added to the base prediction value
8476 /// in order to get the final prediction.
8477 /// To support multiclass classification
8478 /// as well as regression and binary classification,
8479 /// the evaluation value is encoded here as a sparse vector,
8480 /// with evaluationIndex being the index of the base vector
8481 /// that evaluation value is added to.
8482 /// In the single class case,
8483 /// it is expected that evaluationIndex is exactly 0.
8484 #[allow(clippy::all)]
8485 #[allow(clippy::pedantic)]
8486 #[allow(clippy::nursery)]
8487 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
8488 pub struct EvaluationInfo {
8489 #[prost(uint64, tag = "1")]
8490 pub evaluation_index: u64,
8491 #[prost(double, tag = "2")]
8492 pub evaluation_value: f64,
8493 }
8494 #[allow(clippy::all)]
8495 #[allow(clippy::pedantic)]
8496 #[allow(clippy::nursery)]
8497 #[derive(
8498 Clone,
8499 Copy,
8500 Debug,
8501 PartialEq,
8502 Eq,
8503 Hash,
8504 PartialOrd,
8505 Ord,
8506 ::prost::Enumeration
8507 )]
8508 #[repr(i32)]
8509 pub enum TreeNodeBehavior {
8510 BranchOnValueLessThanEqual = 0,
8511 BranchOnValueLessThan = 1,
8512 BranchOnValueGreaterThanEqual = 2,
8513 BranchOnValueGreaterThan = 3,
8514 BranchOnValueEqual = 4,
8515 BranchOnValueNotEqual = 5,
8516 LeafNode = 6,
8517 }
8518 impl TreeNodeBehavior {
8519 /// String value of the enum field names used in the ProtoBuf definition.
8520 ///
8521 /// The values are not transformed in any way and thus are considered stable
8522 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
8523 pub fn as_str_name(&self) -> &'static str {
8524 match self {
8525 Self::BranchOnValueLessThanEqual => "BranchOnValueLessThanEqual",
8526 Self::BranchOnValueLessThan => "BranchOnValueLessThan",
8527 Self::BranchOnValueGreaterThanEqual => {
8528 "BranchOnValueGreaterThanEqual"
8529 }
8530 Self::BranchOnValueGreaterThan => "BranchOnValueGreaterThan",
8531 Self::BranchOnValueEqual => "BranchOnValueEqual",
8532 Self::BranchOnValueNotEqual => "BranchOnValueNotEqual",
8533 Self::LeafNode => "LeafNode",
8534 }
8535 }
8536 /// Creates an enum from field names used in the ProtoBuf definition.
8537 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
8538 match value {
8539 "BranchOnValueLessThanEqual" => {
8540 Some(Self::BranchOnValueLessThanEqual)
8541 }
8542 "BranchOnValueLessThan" => Some(Self::BranchOnValueLessThan),
8543 "BranchOnValueGreaterThanEqual" => {
8544 Some(Self::BranchOnValueGreaterThanEqual)
8545 }
8546 "BranchOnValueGreaterThan" => Some(Self::BranchOnValueGreaterThan),
8547 "BranchOnValueEqual" => Some(Self::BranchOnValueEqual),
8548 "BranchOnValueNotEqual" => Some(Self::BranchOnValueNotEqual),
8549 "LeafNode" => Some(Self::LeafNode),
8550 _ => None,
8551 }
8552 }
8553 }
8554 }
8555}
8556///
8557/// A tree ensemble classifier.
8558#[allow(clippy::all)]
8559#[allow(clippy::pedantic)]
8560#[allow(clippy::nursery)]
8561#[derive(Clone, PartialEq, ::prost::Message)]
8562pub struct TreeEnsembleClassifier {
8563 #[prost(message, optional, tag = "1")]
8564 pub tree_ensemble: ::core::option::Option<TreeEnsembleParameters>,
8565 #[prost(enumeration = "TreeEnsemblePostEvaluationTransform", tag = "2")]
8566 pub post_evaluation_transform: i32,
8567 /// Required class label mapping
8568 #[prost(oneof = "tree_ensemble_classifier::ClassLabels", tags = "100, 101")]
8569 pub class_labels: ::core::option::Option<tree_ensemble_classifier::ClassLabels>,
8570}
8571/// Nested message and enum types in `TreeEnsembleClassifier`.
8572pub mod tree_ensemble_classifier {
8573 /// Required class label mapping
8574 #[allow(clippy::all)]
8575 #[allow(clippy::pedantic)]
8576 #[allow(clippy::nursery)]
8577 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
8578 pub enum ClassLabels {
8579 #[prost(message, tag = "100")]
8580 StringClassLabels(super::StringVector),
8581 #[prost(message, tag = "101")]
8582 Int64ClassLabels(super::Int64Vector),
8583 }
8584}
8585///
8586/// A tree ensemble regressor.
8587#[allow(clippy::all)]
8588#[allow(clippy::pedantic)]
8589#[allow(clippy::nursery)]
8590#[derive(Clone, PartialEq, ::prost::Message)]
8591pub struct TreeEnsembleRegressor {
8592 #[prost(message, optional, tag = "1")]
8593 pub tree_ensemble: ::core::option::Option<TreeEnsembleParameters>,
8594 #[prost(enumeration = "TreeEnsemblePostEvaluationTransform", tag = "2")]
8595 pub post_evaluation_transform: i32,
8596}
8597///
8598/// A tree ensemble post-evaluation transform.
8599#[allow(clippy::all)]
8600#[allow(clippy::pedantic)]
8601#[allow(clippy::nursery)]
8602#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
8603#[repr(i32)]
8604pub enum TreeEnsemblePostEvaluationTransform {
8605 NoTransform = 0,
8606 ClassificationSoftMax = 1,
8607 RegressionLogistic = 2,
8608 ClassificationSoftMaxWithZeroClassReference = 3,
8609}
8610impl TreeEnsemblePostEvaluationTransform {
8611 /// String value of the enum field names used in the ProtoBuf definition.
8612 ///
8613 /// The values are not transformed in any way and thus are considered stable
8614 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
8615 pub fn as_str_name(&self) -> &'static str {
8616 match self {
8617 Self::NoTransform => "NoTransform",
8618 Self::ClassificationSoftMax => "Classification_SoftMax",
8619 Self::RegressionLogistic => "Regression_Logistic",
8620 Self::ClassificationSoftMaxWithZeroClassReference => {
8621 "Classification_SoftMaxWithZeroClassReference"
8622 }
8623 }
8624 }
8625 /// Creates an enum from field names used in the ProtoBuf definition.
8626 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
8627 match value {
8628 "NoTransform" => Some(Self::NoTransform),
8629 "Classification_SoftMax" => Some(Self::ClassificationSoftMax),
8630 "Regression_Logistic" => Some(Self::RegressionLogistic),
8631 "Classification_SoftMaxWithZeroClassReference" => {
8632 Some(Self::ClassificationSoftMaxWithZeroClassReference)
8633 }
8634 _ => None,
8635 }
8636 }
8637}
8638///
8639/// A scaling operation.
8640///
8641/// This function has the following formula:
8642///
8643/// .. math::
8644/// f(x) = scaleValue \cdot (x + shiftValue)
8645///
8646/// If the ``scaleValue`` is not given, the default value 1 is used.
8647/// If the ``shiftValue`` is not given, the default value 0 is used.
8648///
8649/// If ``scaleValue`` and ``shiftValue`` are each a single value
8650/// and the input is an array, then the scale and shift are applied
8651/// to each element of the array.
8652///
8653/// If the input is an integer, then it is converted to a double to
8654/// perform the scaling operation. If the output type is an integer,
8655/// then it is cast to an integer. If that cast is lossy, then an
8656/// error is generated.
8657#[allow(clippy::all)]
8658#[allow(clippy::pedantic)]
8659#[allow(clippy::nursery)]
8660#[derive(Clone, PartialEq, ::prost::Message)]
8661pub struct Scaler {
8662 #[prost(double, repeated, tag = "1")]
8663 pub shift_value: ::prost::alloc::vec::Vec<f64>,
8664 #[prost(double, repeated, tag = "2")]
8665 pub scale_value: ::prost::alloc::vec::Vec<f64>,
8666}
8667///
8668/// An array feature extractor.
8669///
8670/// Given an index, extracts the value at that index from its array input.
8671/// Indexes are zero-based.
8672#[allow(clippy::all)]
8673#[allow(clippy::pedantic)]
8674#[allow(clippy::nursery)]
8675#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
8676pub struct ArrayFeatureExtractor {
8677 #[prost(uint64, repeated, tag = "1")]
8678 pub extract_index: ::prost::alloc::vec::Vec<u64>,
8679}
8680///
8681/// A parameterized model whose function is defined in code
8682#[allow(clippy::all)]
8683#[allow(clippy::pedantic)]
8684#[allow(clippy::nursery)]
8685#[derive(Clone, PartialEq, ::prost::Message)]
8686pub struct CustomModel {
8687 /// The name of the class (conforming to MLCustomModel) corresponding to this model
8688 #[prost(string, tag = "10")]
8689 pub class_name: ::prost::alloc::string::String,
8690 #[prost(map = "string, message", tag = "30")]
8691 pub parameters: ::std::collections::HashMap<
8692 ::prost::alloc::string::String,
8693 custom_model::CustomModelParamValue,
8694 >,
8695 /// An (optional) description provided by the model creator. This information is displayed when viewing the model, but does not affect the model's execution on device.
8696 #[prost(string, tag = "40")]
8697 pub description: ::prost::alloc::string::String,
8698}
8699/// Nested message and enum types in `CustomModel`.
8700pub mod custom_model {
8701 #[allow(clippy::all)]
8702 #[allow(clippy::pedantic)]
8703 #[allow(clippy::nursery)]
8704 #[derive(Clone, PartialEq, ::prost::Message)]
8705 pub struct CustomModelParamValue {
8706 #[prost(
8707 oneof = "custom_model_param_value::Value",
8708 tags = "10, 20, 30, 40, 50, 60"
8709 )]
8710 pub value: ::core::option::Option<custom_model_param_value::Value>,
8711 }
8712 /// Nested message and enum types in `CustomModelParamValue`.
8713 pub mod custom_model_param_value {
8714 #[allow(clippy::all)]
8715 #[allow(clippy::pedantic)]
8716 #[allow(clippy::nursery)]
8717 #[derive(Clone, PartialEq, ::prost::Oneof)]
8718 pub enum Value {
8719 #[prost(double, tag = "10")]
8720 DoubleValue(f64),
8721 #[prost(string, tag = "20")]
8722 StringValue(::prost::alloc::string::String),
8723 #[prost(int32, tag = "30")]
8724 IntValue(i32),
8725 #[prost(int64, tag = "40")]
8726 LongValue(i64),
8727 #[prost(bool, tag = "50")]
8728 BoolValue(bool),
8729 #[prost(bytes, tag = "60")]
8730 BytesValue(::prost::alloc::vec::Vec<u8>),
8731 }
8732 }
8733}
8734///
8735/// A normalization preprocessor.
8736#[allow(clippy::all)]
8737#[allow(clippy::pedantic)]
8738#[allow(clippy::nursery)]
8739#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
8740pub struct Normalizer {
8741 #[prost(enumeration = "normalizer::NormType", tag = "1")]
8742 pub norm_type: i32,
8743}
8744/// Nested message and enum types in `Normalizer`.
8745pub mod normalizer {
8746 ///
8747 /// There are three normalization modes,
8748 /// which have the corresponding formulas:
8749 ///
8750 /// Max
8751 /// .. math::
8752 /// max(x_i)
8753 ///
8754 /// L1
8755 /// .. math::
8756 /// z = ||x||_1 = \sum_{i=1}^{n} |x_i|
8757 ///
8758 /// L2
8759 /// .. math::
8760 /// z = ||x||_2 = \sqrt{\sum_{i=1}^{n} x_i^2}
8761 #[allow(clippy::all)]
8762 #[allow(clippy::pedantic)]
8763 #[allow(clippy::nursery)]
8764 #[derive(
8765 Clone,
8766 Copy,
8767 Debug,
8768 PartialEq,
8769 Eq,
8770 Hash,
8771 PartialOrd,
8772 Ord,
8773 ::prost::Enumeration
8774 )]
8775 #[repr(i32)]
8776 pub enum NormType {
8777 LMax = 0,
8778 L1 = 1,
8779 L2 = 2,
8780 }
8781 impl NormType {
8782 /// String value of the enum field names used in the ProtoBuf definition.
8783 ///
8784 /// The values are not transformed in any way and thus are considered stable
8785 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
8786 pub fn as_str_name(&self) -> &'static str {
8787 match self {
8788 Self::LMax => "LMax",
8789 Self::L1 => "L1",
8790 Self::L2 => "L2",
8791 }
8792 }
8793 /// Creates an enum from field names used in the ProtoBuf definition.
8794 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
8795 match value {
8796 "LMax" => Some(Self::LMax),
8797 "L1" => Some(Self::L1),
8798 "L2" => Some(Self::L2),
8799 _ => None,
8800 }
8801 }
8802 }
8803}
8804///
8805/// Non-maximum suppression of axis-aligned bounding boxes.
8806///
8807/// This is used primarily for object detectors that tend to produce multiple
8808/// boxes around a single object. This is a byproduct of the detector's
8809/// robustness to spatial translation. If there are two or more bounding boxes
8810/// that are very similar to one another, the algorithm should return only a
8811/// single representative.
8812///
8813/// Similarity between two bounding boxes is measured by intersection-over-union
8814/// (IOU), the fraction between the area of intersection and area of the union.
8815/// Here is an example where the areas can be calculated by hand by counting glyphs::
8816///
8817/// +-------+ +-------+
8818/// | | | |
8819/// | +------+ +--+ | +---+
8820/// | | | | | | | |
8821/// +-------+ | +--+ +----+ |
8822/// | | | |
8823/// +------+ +------+
8824/// Intersection Union
8825/// IOU: 0.16 = 12 / 73
8826///
8827/// All IOU scores are fractions between 0.0 (fully disjoint) and 1.0 (perfect
8828/// overlap). The standard algorithm (PickTop) is defined as follows:
8829///
8830/// 1. Sort boxes by descending order of confidence
8831/// 2. Take the top one and mark it as keep
8832/// 3. Suppress (mark it as discard) all boxes within a fixed IOU radius of the
8833/// keep box
8834/// 4. Go to 2 and repeat on the subset of boxes not already kept or discarded
8835/// 5. When all boxes are processed, output only the ones marked as keep
8836///
8837/// Before the algorithm, boxes that fall below the confidence threshold are
8838/// discarded.
8839///
8840/// Suppression methods:
8841#[allow(clippy::all)]
8842#[allow(clippy::pedantic)]
8843#[allow(clippy::nursery)]
8844#[derive(Clone, PartialEq, ::prost::Message)]
8845pub struct NonMaximumSuppression {
8846 ///
8847 /// This defines the radius of suppression. A box is considered to be within
8848 /// the radius of another box if their IOU score is less than this value.
8849 #[prost(double, tag = "110")]
8850 pub iou_threshold: f64,
8851 ///
8852 /// Remove bounding boxes below this threshold. The algorithm run-time is
8853 /// proportional to the square of the number of incoming bounding boxes
8854 /// (O(N^2)). This threshold is a way to reduce N to make the algorithm
8855 /// faster. The confidence threshold can be any non-negative value. Negative
8856 /// confidences are not allowed, since if the output shape is specified to be
8857 /// larger than boxes after suppression, the unused boxes are filled with
8858 /// zero confidence. If the prediction is handled by Core Vision, it is also
8859 /// important that confidences are defined with the following semantics:
8860 ///
8861 /// 1. Confidences should be between 0 and 1
8862 /// 2. The sum of the confidences for a prediction should not exceed 1, but is
8863 /// allowed to be less than 1
8864 /// 3. The sum of the confidences will be interpreted as the confidence of
8865 /// any object (e.g. if the confidences for two classes are 0.2 and 0.4,
8866 /// it means there is a 60% (0.2 + 0.4) confidence that an object is
8867 /// present)
8868 #[prost(double, tag = "111")]
8869 pub confidence_threshold: f64,
8870 ///
8871 /// Set the name of the confidence input.
8872 ///
8873 /// The input should be a multi-array of type double and shape N x C. N is
8874 /// the number of boxes and C the number of classes. Each row describes the
8875 /// confidences of each object category being present at that particular
8876 /// location. Confidences should be nonnegative, where 0.0 means the highest
8877 /// certainty the object is not present.
8878 ///
8879 /// Specifying shape is optional.
8880 #[prost(string, tag = "200")]
8881 pub confidence_input_feature_name: ::prost::alloc::string::String,
8882 ///
8883 /// Set the name of the coordinates input.
8884 ///
8885 /// The input should be a multi-array of type double and shape N x 4. The
8886 /// rows correspond to the rows of the confidence matrix. The four values
8887 /// describe (in order):
8888 ///
8889 /// - x (center location of the box along the horizontal axis)
8890 /// - y (center location of the box along the vertical axis)
8891 /// - width (size of box along the horizontal axis)
8892 /// - height (size of box on along the vertical axis)
8893 ///
8894 /// Specifying shape is optional.
8895 #[prost(string, tag = "201")]
8896 pub coordinates_input_feature_name: ::prost::alloc::string::String,
8897 ///
8898 /// The iouThreshold can be optionally overridden by specifying this string
8899 /// and providing a corresponding input of type double. This allows changing
8900 /// the value of the parameter during run-time.
8901 ///
8902 /// The input should be a scalar double between 0.0 and 1.0. Setting it to 1.0
8903 /// means there will be no suppression based on IOU.
8904 #[prost(string, tag = "202")]
8905 pub iou_threshold_input_feature_name: ::prost::alloc::string::String,
8906 ///
8907 /// The confidenceThreshold can be optionally overridden by specifying this
8908 /// string and providing a corresponding input. This allows changing the
8909 /// value of the parameter during run-time, which can aid setting it just
8910 /// right for a particular use case.
8911 ///
8912 /// The input should be a scalar double with nonnegative value.
8913 #[prost(string, tag = "203")]
8914 pub confidence_threshold_input_feature_name: ::prost::alloc::string::String,
8915 ///
8916 /// Set the name of the confidence output. The output will be the same type
8917 /// and shape as the corresponding input. The only difference is that the
8918 /// number of rows may have been reduced.
8919 ///
8920 /// Specifying shape is optional. One reason to specify shape is to limit
8921 /// the number of output boxes. This can be done is several ways:
8922 ///
8923 /// Fixed shape:
8924 /// The output can be pinned to a fixed set of boxes. If this number is larger
8925 /// than the number of boxes that would have been returned, the output is padded
8926 /// with zeros for both confidence and coordinates. Specifying a fixed shape
8927 /// can be done by setting either shape (deprecated) or allowedShapes set to
8928 /// fixedsize.
8929 ///
8930 /// Min/max:
8931 /// It is also possible to set both a minimum and a maximum. The same zero-padding
8932 /// as for fixed shape is applied when necessary. Setting min/max is done by defining
8933 /// two allowedShapes, where the first dimension uses a rangeofsizes defining lowerbound
8934 /// and upperbound.
8935 #[prost(string, tag = "210")]
8936 pub confidence_output_feature_name: ::prost::alloc::string::String,
8937 ///
8938 /// Set the name of the coordinates output. The output will be the same type
8939 /// and shape as the corresponding input. The only difference is that the
8940 /// number of rows may have been reduced.
8941 ///
8942 /// Specifying shape is optional. See confidence output for a more detailed
8943 /// description. Note that to achieve either fixed shape output or a
8944 /// constraint range of boxes, only one of confidence or coordinates need to
8945 /// set a shape. Both shapes are allowed to be defined, but in such case they
8946 /// have to be consistent along dimension 0.
8947 #[prost(string, tag = "211")]
8948 pub coordinates_output_feature_name: ::prost::alloc::string::String,
8949 ///
8950 /// Choose which underlying suppression method to use
8951 #[prost(oneof = "non_maximum_suppression::SuppressionMethod", tags = "1")]
8952 pub suppression_method: ::core::option::Option<
8953 non_maximum_suppression::SuppressionMethod,
8954 >,
8955 ///
8956 /// Optional class label mapping.
8957 #[prost(oneof = "non_maximum_suppression::ClassLabels", tags = "100, 101")]
8958 pub class_labels: ::core::option::Option<non_maximum_suppression::ClassLabels>,
8959}
8960/// Nested message and enum types in `NonMaximumSuppression`.
8961pub mod non_maximum_suppression {
8962 ///
8963 /// Pick the bounding box of the top confidence, suppress all within a radius.
8964 #[allow(clippy::all)]
8965 #[allow(clippy::pedantic)]
8966 #[allow(clippy::nursery)]
8967 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
8968 pub struct PickTop {
8969 ///
8970 /// Suppression is only done among predictions with the same label
8971 /// (argmax of the confidence).
8972 #[prost(bool, tag = "1")]
8973 pub per_class: bool,
8974 }
8975 ///
8976 /// Choose which underlying suppression method to use
8977 #[allow(clippy::all)]
8978 #[allow(clippy::pedantic)]
8979 #[allow(clippy::nursery)]
8980 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
8981 pub enum SuppressionMethod {
8982 #[prost(message, tag = "1")]
8983 PickTop(PickTop),
8984 }
8985 ///
8986 /// Optional class label mapping.
8987 #[allow(clippy::all)]
8988 #[allow(clippy::pedantic)]
8989 #[allow(clippy::nursery)]
8990 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
8991 pub enum ClassLabels {
8992 #[prost(message, tag = "100")]
8993 StringClassLabels(super::StringVector),
8994 #[prost(message, tag = "101")]
8995 Int64ClassLabels(super::Int64Vector),
8996 }
8997}
8998///
8999/// Transforms a categorical feature into an array. The array will be all
9000/// zeros expect a single entry of one.
9001///
9002/// Each categorical value will map to an index, this mapping is given by
9003/// either the ``stringCategories`` parameter or the ``int64Categories``
9004/// parameter.
9005#[allow(clippy::all)]
9006#[allow(clippy::pedantic)]
9007#[allow(clippy::nursery)]
9008#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
9009pub struct OneHotEncoder {
9010 /// Output can be a dictionary with only one entry, instead of an array.
9011 #[prost(bool, tag = "10")]
9012 pub output_sparse: bool,
9013 #[prost(enumeration = "one_hot_encoder::HandleUnknown", tag = "11")]
9014 pub handle_unknown: i32,
9015 ///
9016 /// Mapping to be used for the encoding. The position of the category in
9017 /// the below vector determines where the single one entry will be in the
9018 /// output.
9019 #[prost(oneof = "one_hot_encoder::CategoryType", tags = "1, 2")]
9020 pub category_type: ::core::option::Option<one_hot_encoder::CategoryType>,
9021}
9022/// Nested message and enum types in `OneHotEncoder`.
9023pub mod one_hot_encoder {
9024 #[allow(clippy::all)]
9025 #[allow(clippy::pedantic)]
9026 #[allow(clippy::nursery)]
9027 #[derive(
9028 Clone,
9029 Copy,
9030 Debug,
9031 PartialEq,
9032 Eq,
9033 Hash,
9034 PartialOrd,
9035 Ord,
9036 ::prost::Enumeration
9037 )]
9038 #[repr(i32)]
9039 pub enum HandleUnknown {
9040 ErrorOnUnknown = 0,
9041 /// Output will be all zeros for unknown values.
9042 IgnoreUnknown = 1,
9043 }
9044 impl HandleUnknown {
9045 /// String value of the enum field names used in the ProtoBuf definition.
9046 ///
9047 /// The values are not transformed in any way and thus are considered stable
9048 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
9049 pub fn as_str_name(&self) -> &'static str {
9050 match self {
9051 Self::ErrorOnUnknown => "ErrorOnUnknown",
9052 Self::IgnoreUnknown => "IgnoreUnknown",
9053 }
9054 }
9055 /// Creates an enum from field names used in the ProtoBuf definition.
9056 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
9057 match value {
9058 "ErrorOnUnknown" => Some(Self::ErrorOnUnknown),
9059 "IgnoreUnknown" => Some(Self::IgnoreUnknown),
9060 _ => None,
9061 }
9062 }
9063 }
9064 ///
9065 /// Mapping to be used for the encoding. The position of the category in
9066 /// the below vector determines where the single one entry will be in the
9067 /// output.
9068 #[allow(clippy::all)]
9069 #[allow(clippy::pedantic)]
9070 #[allow(clippy::nursery)]
9071 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
9072 pub enum CategoryType {
9073 #[prost(message, tag = "1")]
9074 StringCategories(super::StringVector),
9075 #[prost(message, tag = "2")]
9076 Int64Categories(super::Int64Vector),
9077 }
9078}
9079///
9080/// Uses an index mapping to convert a dictionary to an array.
9081///
9082/// The output array will be equal in length to the index mapping vector parameter.
9083/// All keys in the input dictionary must be present in the index mapping vector.
9084///
9085/// For each item in the input dictionary, insert its value in the output array.
9086/// The position of the insertion is determined by the position of the item's key
9087/// in the index mapping. Any keys not present in the input dictionary, will be
9088/// zero in the output array.
9089///
9090/// For example: if the ``stringToIndex`` parameter is set to ``\["a", "c", "b", "z"\]``,
9091/// then an input of ``{"a": 4, "c": 8}`` will produce an output of ``\[4, 8, 0, 0\]``.
9092///
9093#[allow(clippy::all)]
9094#[allow(clippy::pedantic)]
9095#[allow(clippy::nursery)]
9096#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
9097pub struct DictVectorizer {
9098 #[prost(oneof = "dict_vectorizer::Map", tags = "1, 2")]
9099 pub map: ::core::option::Option<dict_vectorizer::Map>,
9100}
9101/// Nested message and enum types in `DictVectorizer`.
9102pub mod dict_vectorizer {
9103 #[allow(clippy::all)]
9104 #[allow(clippy::pedantic)]
9105 #[allow(clippy::nursery)]
9106 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
9107 pub enum Map {
9108 /// String keys to indexes
9109 #[prost(message, tag = "1")]
9110 StringToIndex(super::StringVector),
9111 /// Int keys to indexes
9112 #[prost(message, tag = "2")]
9113 Int64ToIndex(super::Int64Vector),
9114 }
9115}
9116///
9117/// A generalized linear model regressor.
9118#[allow(clippy::all)]
9119#[allow(clippy::pedantic)]
9120#[allow(clippy::nursery)]
9121#[derive(Clone, PartialEq, ::prost::Message)]
9122pub struct GlmRegressor {
9123 #[prost(message, repeated, tag = "1")]
9124 pub weights: ::prost::alloc::vec::Vec<glm_regressor::DoubleArray>,
9125 #[prost(double, repeated, tag = "2")]
9126 pub offset: ::prost::alloc::vec::Vec<f64>,
9127 #[prost(enumeration = "glm_regressor::PostEvaluationTransform", tag = "3")]
9128 pub post_evaluation_transform: i32,
9129}
9130/// Nested message and enum types in `GLMRegressor`.
9131pub mod glm_regressor {
9132 #[allow(clippy::all)]
9133 #[allow(clippy::pedantic)]
9134 #[allow(clippy::nursery)]
9135 #[derive(Clone, PartialEq, ::prost::Message)]
9136 pub struct DoubleArray {
9137 #[prost(double, repeated, tag = "1")]
9138 pub value: ::prost::alloc::vec::Vec<f64>,
9139 }
9140 #[allow(clippy::all)]
9141 #[allow(clippy::pedantic)]
9142 #[allow(clippy::nursery)]
9143 #[derive(
9144 Clone,
9145 Copy,
9146 Debug,
9147 PartialEq,
9148 Eq,
9149 Hash,
9150 PartialOrd,
9151 Ord,
9152 ::prost::Enumeration
9153 )]
9154 #[repr(i32)]
9155 pub enum PostEvaluationTransform {
9156 NoTransform = 0,
9157 Logit = 1,
9158 Probit = 2,
9159 }
9160 impl PostEvaluationTransform {
9161 /// String value of the enum field names used in the ProtoBuf definition.
9162 ///
9163 /// The values are not transformed in any way and thus are considered stable
9164 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
9165 pub fn as_str_name(&self) -> &'static str {
9166 match self {
9167 Self::NoTransform => "NoTransform",
9168 Self::Logit => "Logit",
9169 Self::Probit => "Probit",
9170 }
9171 }
9172 /// Creates an enum from field names used in the ProtoBuf definition.
9173 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
9174 match value {
9175 "NoTransform" => Some(Self::NoTransform),
9176 "Logit" => Some(Self::Logit),
9177 "Probit" => Some(Self::Probit),
9178 _ => None,
9179 }
9180 }
9181 }
9182}
9183///
9184/// A linear kernel.
9185///
9186/// This function has the following formula:
9187///
9188/// .. math::
9189/// K(\boldsymbol{x}, \boldsymbol{x'}) = \boldsymbol{x}^T \boldsymbol{x'}
9190#[allow(clippy::all)]
9191#[allow(clippy::pedantic)]
9192#[allow(clippy::nursery)]
9193#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
9194pub struct LinearKernel {}
9195///
9196/// A Gaussian radial basis function (RBF) kernel.
9197///
9198/// This function has the following formula:
9199///
9200/// .. math::
9201/// K(\boldsymbol{x}, \boldsymbol{x'}) = \
9202/// \exp(-\gamma || \boldsymbol{x} - \boldsymbol{x'} ||^2 )
9203///
9204#[allow(clippy::all)]
9205#[allow(clippy::pedantic)]
9206#[allow(clippy::nursery)]
9207#[derive(Clone, Copy, PartialEq, ::prost::Message)]
9208pub struct RbfKernel {
9209 #[prost(double, tag = "1")]
9210 pub gamma: f64,
9211}
9212///
9213/// A polynomial kernel.
9214///
9215/// This function has the following formula:
9216///
9217/// .. math::
9218/// K(\boldsymbol{x}, \boldsymbol{x'}) = \
9219/// (\gamma \boldsymbol{x}^T \boldsymbol{x'} + c)^{degree}
9220#[allow(clippy::all)]
9221#[allow(clippy::pedantic)]
9222#[allow(clippy::nursery)]
9223#[derive(Clone, Copy, PartialEq, ::prost::Message)]
9224pub struct PolyKernel {
9225 #[prost(int32, tag = "1")]
9226 pub degree: i32,
9227 #[prost(double, tag = "2")]
9228 pub c: f64,
9229 #[prost(double, tag = "3")]
9230 pub gamma: f64,
9231}
9232///
9233/// A sigmoid kernel.
9234///
9235/// This function has the following formula:
9236///
9237/// .. math::
9238/// K(\boldsymbol{x}, \boldsymbol{x'}) = \
9239/// \tanh(\gamma \boldsymbol{x}^T \boldsymbol{x'} + c)
9240#[allow(clippy::all)]
9241#[allow(clippy::pedantic)]
9242#[allow(clippy::nursery)]
9243#[derive(Clone, Copy, PartialEq, ::prost::Message)]
9244pub struct SigmoidKernel {
9245 #[prost(double, tag = "1")]
9246 pub gamma: f64,
9247 #[prost(double, tag = "2")]
9248 pub c: f64,
9249}
9250///
9251/// A kernel.
9252#[allow(clippy::all)]
9253#[allow(clippy::pedantic)]
9254#[allow(clippy::nursery)]
9255#[derive(Clone, Copy, PartialEq, ::prost::Message)]
9256pub struct Kernel {
9257 #[prost(oneof = "kernel::Kernel", tags = "1, 2, 3, 4")]
9258 pub kernel: ::core::option::Option<kernel::Kernel>,
9259}
9260/// Nested message and enum types in `Kernel`.
9261pub mod kernel {
9262 #[allow(clippy::all)]
9263 #[allow(clippy::pedantic)]
9264 #[allow(clippy::nursery)]
9265 #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
9266 pub enum Kernel {
9267 #[prost(message, tag = "1")]
9268 LinearKernel(super::LinearKernel),
9269 #[prost(message, tag = "2")]
9270 RbfKernel(super::RbfKernel),
9271 #[prost(message, tag = "3")]
9272 PolyKernel(super::PolyKernel),
9273 #[prost(message, tag = "4")]
9274 SigmoidKernel(super::SigmoidKernel),
9275 }
9276}
9277///
9278/// A sparse node.
9279#[allow(clippy::all)]
9280#[allow(clippy::pedantic)]
9281#[allow(clippy::nursery)]
9282#[derive(Clone, Copy, PartialEq, ::prost::Message)]
9283pub struct SparseNode {
9284 /// 1-based indexes, like libsvm
9285 #[prost(int32, tag = "1")]
9286 pub index: i32,
9287 #[prost(double, tag = "2")]
9288 pub value: f64,
9289}
9290///
9291/// A sparse vector.
9292#[allow(clippy::all)]
9293#[allow(clippy::pedantic)]
9294#[allow(clippy::nursery)]
9295#[derive(Clone, PartialEq, ::prost::Message)]
9296pub struct SparseVector {
9297 #[prost(message, repeated, tag = "1")]
9298 pub nodes: ::prost::alloc::vec::Vec<SparseNode>,
9299}
9300///
9301/// One or more sparse support vectors.
9302#[allow(clippy::all)]
9303#[allow(clippy::pedantic)]
9304#[allow(clippy::nursery)]
9305#[derive(Clone, PartialEq, ::prost::Message)]
9306pub struct SparseSupportVectors {
9307 #[prost(message, repeated, tag = "1")]
9308 pub vectors: ::prost::alloc::vec::Vec<SparseVector>,
9309}
9310///
9311/// A dense vector.
9312#[allow(clippy::all)]
9313#[allow(clippy::pedantic)]
9314#[allow(clippy::nursery)]
9315#[derive(Clone, PartialEq, ::prost::Message)]
9316pub struct DenseVector {
9317 #[prost(double, repeated, tag = "1")]
9318 pub values: ::prost::alloc::vec::Vec<f64>,
9319}
9320///
9321/// One or more dense support vectors.
9322#[allow(clippy::all)]
9323#[allow(clippy::pedantic)]
9324#[allow(clippy::nursery)]
9325#[derive(Clone, PartialEq, ::prost::Message)]
9326pub struct DenseSupportVectors {
9327 #[prost(message, repeated, tag = "1")]
9328 pub vectors: ::prost::alloc::vec::Vec<DenseVector>,
9329}
9330///
9331/// One or more coefficients.
9332#[allow(clippy::all)]
9333#[allow(clippy::pedantic)]
9334#[allow(clippy::nursery)]
9335#[derive(Clone, PartialEq, ::prost::Message)]
9336pub struct Coefficients {
9337 #[prost(double, repeated, tag = "1")]
9338 pub alpha: ::prost::alloc::vec::Vec<f64>,
9339}
9340///
9341/// A support vector regressor.
9342#[allow(clippy::all)]
9343#[allow(clippy::pedantic)]
9344#[allow(clippy::nursery)]
9345#[derive(Clone, PartialEq, ::prost::Message)]
9346pub struct SupportVectorRegressor {
9347 #[prost(message, optional, tag = "1")]
9348 pub kernel: ::core::option::Option<Kernel>,
9349 /// Coefficients, one for each support vector
9350 #[prost(message, optional, tag = "4")]
9351 pub coefficients: ::core::option::Option<Coefficients>,
9352 #[prost(double, tag = "5")]
9353 pub rho: f64,
9354 /// Support vectors, either sparse or dense format
9355 #[prost(oneof = "support_vector_regressor::SupportVectors", tags = "2, 3")]
9356 pub support_vectors: ::core::option::Option<
9357 support_vector_regressor::SupportVectors,
9358 >,
9359}
9360/// Nested message and enum types in `SupportVectorRegressor`.
9361pub mod support_vector_regressor {
9362 /// Support vectors, either sparse or dense format
9363 #[allow(clippy::all)]
9364 #[allow(clippy::pedantic)]
9365 #[allow(clippy::nursery)]
9366 #[derive(Clone, PartialEq, ::prost::Oneof)]
9367 pub enum SupportVectors {
9368 #[prost(message, tag = "2")]
9369 SparseSupportVectors(super::SparseSupportVectors),
9370 #[prost(message, tag = "3")]
9371 DenseSupportVectors(super::DenseSupportVectors),
9372 }
9373}
9374///
9375/// A support vector classifier
9376#[allow(clippy::all)]
9377#[allow(clippy::pedantic)]
9378#[allow(clippy::nursery)]
9379#[derive(Clone, PartialEq, ::prost::Message)]
9380pub struct SupportVectorClassifier {
9381 #[prost(message, optional, tag = "1")]
9382 pub kernel: ::core::option::Option<Kernel>,
9383 ///
9384 /// The number of support vectors for each class.
9385 #[prost(int32, repeated, tag = "2")]
9386 pub number_of_support_vectors_per_class: ::prost::alloc::vec::Vec<i32>,
9387 ///
9388 /// The coefficients, essentially a two dimensional array of
9389 /// size: (numberOfClasses-1) by (total number of support vectors)
9390 #[prost(message, repeated, tag = "5")]
9391 pub coefficients: ::prost::alloc::vec::Vec<Coefficients>,
9392 ///
9393 /// Constants for decision function,
9394 /// with K*(K-1) / 2 elements,
9395 /// where K is the number of classes.
9396 #[prost(double, repeated, tag = "6")]
9397 pub rho: ::prost::alloc::vec::Vec<f64>,
9398 ///
9399 /// Pairwise probability information for A vs B classifier.
9400 /// Total of K*(K-1)/2 elements where K is the number of classes.
9401 /// These fields are optional,
9402 /// and only required if you want probabilities or multi class predictions.
9403 #[prost(double, repeated, tag = "7")]
9404 pub prob_a: ::prost::alloc::vec::Vec<f64>,
9405 #[prost(double, repeated, tag = "8")]
9406 pub prob_b: ::prost::alloc::vec::Vec<f64>,
9407 ///
9408 /// The support vectors, in either sparse or dense format.
9409 #[prost(oneof = "support_vector_classifier::SupportVectors", tags = "3, 4")]
9410 pub support_vectors: ::core::option::Option<
9411 support_vector_classifier::SupportVectors,
9412 >,
9413 ///
9414 /// Class label mapping.
9415 #[prost(oneof = "support_vector_classifier::ClassLabels", tags = "100, 101")]
9416 pub class_labels: ::core::option::Option<support_vector_classifier::ClassLabels>,
9417}
9418/// Nested message and enum types in `SupportVectorClassifier`.
9419pub mod support_vector_classifier {
9420 ///
9421 /// The support vectors, in either sparse or dense format.
9422 #[allow(clippy::all)]
9423 #[allow(clippy::pedantic)]
9424 #[allow(clippy::nursery)]
9425 #[derive(Clone, PartialEq, ::prost::Oneof)]
9426 pub enum SupportVectors {
9427 #[prost(message, tag = "3")]
9428 SparseSupportVectors(super::SparseSupportVectors),
9429 #[prost(message, tag = "4")]
9430 DenseSupportVectors(super::DenseSupportVectors),
9431 }
9432 ///
9433 /// Class label mapping.
9434 #[allow(clippy::all)]
9435 #[allow(clippy::pedantic)]
9436 #[allow(clippy::nursery)]
9437 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
9438 pub enum ClassLabels {
9439 #[prost(message, tag = "100")]
9440 StringClassLabels(super::StringVector),
9441 #[prost(message, tag = "101")]
9442 Int64ClassLabels(super::Int64Vector),
9443 }
9444}
9445///
9446/// A categorical mapping.
9447///
9448/// This allows conversion from integers to strings, or from strings to integers.
9449#[allow(clippy::all)]
9450#[allow(clippy::pedantic)]
9451#[allow(clippy::nursery)]
9452#[derive(Clone, PartialEq, ::prost::Message)]
9453pub struct CategoricalMapping {
9454 #[prost(oneof = "categorical_mapping::MappingType", tags = "1, 2")]
9455 pub mapping_type: ::core::option::Option<categorical_mapping::MappingType>,
9456 ///
9457 /// The value returned if an input is not contained in the map above.
9458 /// If one of these is not set, then an error is raised on an unknown input.
9459 #[prost(oneof = "categorical_mapping::ValueOnUnknown", tags = "101, 102")]
9460 pub value_on_unknown: ::core::option::Option<categorical_mapping::ValueOnUnknown>,
9461}
9462/// Nested message and enum types in `CategoricalMapping`.
9463pub mod categorical_mapping {
9464 #[allow(clippy::all)]
9465 #[allow(clippy::pedantic)]
9466 #[allow(clippy::nursery)]
9467 #[derive(Clone, PartialEq, ::prost::Oneof)]
9468 pub enum MappingType {
9469 /// Conversion from strings to integers
9470 #[prost(message, tag = "1")]
9471 StringToInt64Map(super::StringToInt64Map),
9472 /// Conversion from integer to string
9473 #[prost(message, tag = "2")]
9474 Int64ToStringMap(super::Int64ToStringMap),
9475 }
9476 ///
9477 /// The value returned if an input is not contained in the map above.
9478 /// If one of these is not set, then an error is raised on an unknown input.
9479 #[allow(clippy::all)]
9480 #[allow(clippy::pedantic)]
9481 #[allow(clippy::nursery)]
9482 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
9483 pub enum ValueOnUnknown {
9484 /// Default output when converting from an integer to a string.
9485 #[prost(string, tag = "101")]
9486 StrValue(::prost::alloc::string::String),
9487 /// Default output when converting from a string to an integer.
9488 #[prost(int64, tag = "102")]
9489 Int64Value(i64),
9490 }
9491}
9492///
9493/// A generalized linear model classifier.
9494#[allow(clippy::all)]
9495#[allow(clippy::pedantic)]
9496#[allow(clippy::nursery)]
9497#[derive(Clone, PartialEq, ::prost::Message)]
9498pub struct GlmClassifier {
9499 #[prost(message, repeated, tag = "1")]
9500 pub weights: ::prost::alloc::vec::Vec<glm_classifier::DoubleArray>,
9501 #[prost(double, repeated, tag = "2")]
9502 pub offset: ::prost::alloc::vec::Vec<f64>,
9503 #[prost(enumeration = "glm_classifier::PostEvaluationTransform", tag = "3")]
9504 pub post_evaluation_transform: i32,
9505 #[prost(enumeration = "glm_classifier::ClassEncoding", tag = "4")]
9506 pub class_encoding: i32,
9507 ///
9508 /// Required class label mapping.
9509 #[prost(oneof = "glm_classifier::ClassLabels", tags = "100, 101")]
9510 pub class_labels: ::core::option::Option<glm_classifier::ClassLabels>,
9511}
9512/// Nested message and enum types in `GLMClassifier`.
9513pub mod glm_classifier {
9514 #[allow(clippy::all)]
9515 #[allow(clippy::pedantic)]
9516 #[allow(clippy::nursery)]
9517 #[derive(Clone, PartialEq, ::prost::Message)]
9518 pub struct DoubleArray {
9519 #[prost(double, repeated, tag = "1")]
9520 pub value: ::prost::alloc::vec::Vec<f64>,
9521 }
9522 #[allow(clippy::all)]
9523 #[allow(clippy::pedantic)]
9524 #[allow(clippy::nursery)]
9525 #[derive(
9526 Clone,
9527 Copy,
9528 Debug,
9529 PartialEq,
9530 Eq,
9531 Hash,
9532 PartialOrd,
9533 Ord,
9534 ::prost::Enumeration
9535 )]
9536 #[repr(i32)]
9537 pub enum PostEvaluationTransform {
9538 Logit = 0,
9539 /// Only binary classification is supported for probit
9540 Probit = 1,
9541 }
9542 impl PostEvaluationTransform {
9543 /// String value of the enum field names used in the ProtoBuf definition.
9544 ///
9545 /// The values are not transformed in any way and thus are considered stable
9546 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
9547 pub fn as_str_name(&self) -> &'static str {
9548 match self {
9549 Self::Logit => "Logit",
9550 Self::Probit => "Probit",
9551 }
9552 }
9553 /// Creates an enum from field names used in the ProtoBuf definition.
9554 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
9555 match value {
9556 "Logit" => Some(Self::Logit),
9557 "Probit" => Some(Self::Probit),
9558 _ => None,
9559 }
9560 }
9561 }
9562 #[allow(clippy::all)]
9563 #[allow(clippy::pedantic)]
9564 #[allow(clippy::nursery)]
9565 #[derive(
9566 Clone,
9567 Copy,
9568 Debug,
9569 PartialEq,
9570 Eq,
9571 Hash,
9572 PartialOrd,
9573 Ord,
9574 ::prost::Enumeration
9575 )]
9576 #[repr(i32)]
9577 pub enum ClassEncoding {
9578 /// First class is the reference class
9579 ReferenceClass = 0,
9580 /// Also called One vs All
9581 OneVsRest = 1,
9582 }
9583 impl ClassEncoding {
9584 /// String value of the enum field names used in the ProtoBuf definition.
9585 ///
9586 /// The values are not transformed in any way and thus are considered stable
9587 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
9588 pub fn as_str_name(&self) -> &'static str {
9589 match self {
9590 Self::ReferenceClass => "ReferenceClass",
9591 Self::OneVsRest => "OneVsRest",
9592 }
9593 }
9594 /// Creates an enum from field names used in the ProtoBuf definition.
9595 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
9596 match value {
9597 "ReferenceClass" => Some(Self::ReferenceClass),
9598 "OneVsRest" => Some(Self::OneVsRest),
9599 _ => None,
9600 }
9601 }
9602 }
9603 ///
9604 /// Required class label mapping.
9605 #[allow(clippy::all)]
9606 #[allow(clippy::pedantic)]
9607 #[allow(clippy::nursery)]
9608 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
9609 pub enum ClassLabels {
9610 #[prost(message, tag = "100")]
9611 StringClassLabels(super::StringVector),
9612 #[prost(message, tag = "101")]
9613 Int64ClassLabels(super::Int64Vector),
9614 }
9615}
9616///
9617/// A k-Nearest-Neighbor classifier
9618#[allow(clippy::all)]
9619#[allow(clippy::pedantic)]
9620#[allow(clippy::nursery)]
9621#[derive(Clone, PartialEq, ::prost::Message)]
9622pub struct KNearestNeighborsClassifier {
9623 ///
9624 /// The "core" nearest neighbor model attributes.
9625 #[prost(message, optional, tag = "1")]
9626 pub nearest_neighbors_index: ::core::option::Option<NearestNeighborsIndex>,
9627 ///
9628 /// Number of neighbors to use for classification.
9629 #[prost(message, optional, tag = "3")]
9630 pub number_of_neighbors: ::core::option::Option<Int64Parameter>,
9631 ///
9632 /// Type of labels supported by the model. Currently supports String or Int64
9633 /// labels.
9634 #[prost(oneof = "k_nearest_neighbors_classifier::ClassLabels", tags = "100, 101")]
9635 pub class_labels: ::core::option::Option<
9636 k_nearest_neighbors_classifier::ClassLabels,
9637 >,
9638 ///
9639 /// Default value of class label (useful when prediction is called on an empty kNN classifier)
9640 #[prost(
9641 oneof = "k_nearest_neighbors_classifier::DefaultClassLabel",
9642 tags = "110, 111"
9643 )]
9644 pub default_class_label: ::core::option::Option<
9645 k_nearest_neighbors_classifier::DefaultClassLabel,
9646 >,
9647 ///
9648 /// Weighting scheme to be used when computing the majority label of a
9649 /// new data point.
9650 #[prost(
9651 oneof = "k_nearest_neighbors_classifier::WeightingScheme",
9652 tags = "200, 210"
9653 )]
9654 pub weighting_scheme: ::core::option::Option<
9655 k_nearest_neighbors_classifier::WeightingScheme,
9656 >,
9657}
9658/// Nested message and enum types in `KNearestNeighborsClassifier`.
9659pub mod k_nearest_neighbors_classifier {
9660 ///
9661 /// Type of labels supported by the model. Currently supports String or Int64
9662 /// labels.
9663 #[allow(clippy::all)]
9664 #[allow(clippy::pedantic)]
9665 #[allow(clippy::nursery)]
9666 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
9667 pub enum ClassLabels {
9668 #[prost(message, tag = "100")]
9669 StringClassLabels(super::StringVector),
9670 #[prost(message, tag = "101")]
9671 Int64ClassLabels(super::Int64Vector),
9672 }
9673 ///
9674 /// Default value of class label (useful when prediction is called on an empty kNN classifier)
9675 #[allow(clippy::all)]
9676 #[allow(clippy::pedantic)]
9677 #[allow(clippy::nursery)]
9678 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
9679 pub enum DefaultClassLabel {
9680 #[prost(string, tag = "110")]
9681 DefaultStringLabel(::prost::alloc::string::String),
9682 #[prost(int64, tag = "111")]
9683 DefaultInt64Label(i64),
9684 }
9685 ///
9686 /// Weighting scheme to be used when computing the majority label of a
9687 /// new data point.
9688 #[allow(clippy::all)]
9689 #[allow(clippy::pedantic)]
9690 #[allow(clippy::nursery)]
9691 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
9692 pub enum WeightingScheme {
9693 #[prost(message, tag = "200")]
9694 UniformWeighting(super::UniformWeighting),
9695 #[prost(message, tag = "210")]
9696 InverseDistanceWeighting(super::InverseDistanceWeighting),
9697 }
9698}
9699///
9700/// The "core" attributes of a Nearest Neighbors model.
9701#[allow(clippy::all)]
9702#[allow(clippy::pedantic)]
9703#[allow(clippy::nursery)]
9704#[derive(Clone, PartialEq, ::prost::Message)]
9705pub struct NearestNeighborsIndex {
9706 ///
9707 /// Number of dimensions of the input data.
9708 #[prost(int32, tag = "1")]
9709 pub number_of_dimensions: i32,
9710 ///
9711 /// Vector of floating point data that makes up the model. Each data point must have 'numberOfDimensions'
9712 /// dimensions.
9713 #[prost(message, repeated, tag = "2")]
9714 pub float_samples: ::prost::alloc::vec::Vec<FloatVector>,
9715 ///
9716 /// Backing data structure for the Nearest Neighbors Index. Currently supports
9717 /// a linear index or a kd-tree index.
9718 #[prost(oneof = "nearest_neighbors_index::IndexType", tags = "100, 110")]
9719 pub index_type: ::core::option::Option<nearest_neighbors_index::IndexType>,
9720 ///
9721 /// Distance function to be used to find neighbors. Currently only Squared Euclidean
9722 /// Distance is supported.
9723 #[prost(oneof = "nearest_neighbors_index::DistanceFunction", tags = "200")]
9724 pub distance_function: ::core::option::Option<
9725 nearest_neighbors_index::DistanceFunction,
9726 >,
9727}
9728/// Nested message and enum types in `NearestNeighborsIndex`.
9729pub mod nearest_neighbors_index {
9730 ///
9731 /// Backing data structure for the Nearest Neighbors Index. Currently supports
9732 /// a linear index or a kd-tree index.
9733 #[allow(clippy::all)]
9734 #[allow(clippy::pedantic)]
9735 #[allow(clippy::nursery)]
9736 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
9737 pub enum IndexType {
9738 #[prost(message, tag = "100")]
9739 LinearIndex(super::LinearIndex),
9740 #[prost(message, tag = "110")]
9741 SingleKdTreeIndex(super::SingleKdTreeIndex),
9742 }
9743 ///
9744 /// Distance function to be used to find neighbors. Currently only Squared Euclidean
9745 /// Distance is supported.
9746 #[allow(clippy::all)]
9747 #[allow(clippy::pedantic)]
9748 #[allow(clippy::nursery)]
9749 #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
9750 pub enum DistanceFunction {
9751 #[prost(message, tag = "200")]
9752 SquaredEuclideanDistance(super::SquaredEuclideanDistance),
9753 }
9754}
9755///
9756/// Specifies a uniform weighting scheme (i.e. each neighbor receives equal
9757/// voting power).
9758#[allow(clippy::all)]
9759#[allow(clippy::pedantic)]
9760#[allow(clippy::nursery)]
9761#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
9762pub struct UniformWeighting {}
9763///
9764/// Specifies a inverse-distance weighting scheme (i.e. closest neighbors receives higher
9765/// voting power). A nearest neighbor with highest sum of (1 / distance) is picked.
9766#[allow(clippy::all)]
9767#[allow(clippy::pedantic)]
9768#[allow(clippy::nursery)]
9769#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
9770pub struct InverseDistanceWeighting {}
9771///
9772/// Specifies a flat index of data points to be searched by brute force.
9773#[allow(clippy::all)]
9774#[allow(clippy::pedantic)]
9775#[allow(clippy::nursery)]
9776#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
9777pub struct LinearIndex {}
9778///
9779/// Specifies a kd-tree backend for the nearest neighbors model.
9780#[allow(clippy::all)]
9781#[allow(clippy::pedantic)]
9782#[allow(clippy::nursery)]
9783#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
9784pub struct SingleKdTreeIndex {
9785 ///
9786 /// Number of data points contained within a leaf node of the kd-tree.
9787 #[prost(int32, tag = "1")]
9788 pub leaf_size: i32,
9789}
9790///
9791/// Specifies the Squared Euclidean Distance function.
9792#[allow(clippy::all)]
9793#[allow(clippy::pedantic)]
9794#[allow(clippy::nursery)]
9795#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
9796pub struct SquaredEuclideanDistance {}
9797///
9798/// An identity model.
9799///
9800/// This model returns given inputs as outputs, unchanged.
9801/// Intended to be used for testing purposes.
9802#[allow(clippy::all)]
9803#[allow(clippy::pedantic)]
9804#[allow(clippy::nursery)]
9805#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
9806pub struct Identity {}
9807///
9808/// Item Similarity Recommender
9809///
9810/// The Item Similarity recommender takes as input a list of items and scores,
9811/// then uses that information and a table of item similarities to predict similarity
9812/// scores for all items. By default, the items predicted are most similar to the given
9813/// items but not part of that item set.
9814///
9815/// The predicted score for a given item k is
9816/// sum_(i in observed items) sim_(k,i) * (score_i - shift_k)
9817///
9818/// Because only the most similar scores for each item i are stored,
9819/// sim_(k,i) is often zero.
9820///
9821/// For many models, the score adjustment parameter shift_j is zero -- it's occasionally used
9822/// to counteract global biases for popular items.
9823///
9824///
9825/// References:
9826#[allow(clippy::all)]
9827#[allow(clippy::pedantic)]
9828#[allow(clippy::nursery)]
9829#[derive(Clone, PartialEq, ::prost::Message)]
9830pub struct ItemSimilarityRecommender {
9831 #[prost(message, repeated, tag = "1")]
9832 pub item_item_similarities: ::prost::alloc::vec::Vec<
9833 item_similarity_recommender::SimilarItems,
9834 >,
9835 /// One or none of these are given. If none are given, then the items must number 0, 1, ..., num_items - 1.
9836 /// If either is given, the length must be exactly num_items.
9837 #[prost(message, optional, tag = "2")]
9838 pub item_string_ids: ::core::option::Option<StringVector>,
9839 #[prost(message, optional, tag = "3")]
9840 pub item_int64_ids: ::core::option::Option<Int64Vector>,
9841 /// Input parameter names specifying different possible inputs to the recommender.
9842 ///
9843 /// Required
9844 #[prost(string, tag = "10")]
9845 pub item_input_feature_name: ::prost::alloc::string::String,
9846 /// Optional; defaults to all items if not given.
9847 #[prost(string, tag = "11")]
9848 pub num_recommendations_input_feature_name: ::prost::alloc::string::String,
9849 /// Optional.
9850 #[prost(string, tag = "12")]
9851 pub item_restriction_input_feature_name: ::prost::alloc::string::String,
9852 /// Optional; defaults to input item list if not given.
9853 #[prost(string, tag = "13")]
9854 pub item_exclusion_input_feature_name: ::prost::alloc::string::String,
9855 /// The predicted outputs. At least one of these must be specified.
9856 #[prost(string, tag = "20")]
9857 pub recommended_item_list_output_feature_name: ::prost::alloc::string::String,
9858 #[prost(string, tag = "21")]
9859 pub recommended_item_score_output_feature_name: ::prost::alloc::string::String,
9860}
9861/// Nested message and enum types in `ItemSimilarityRecommender`.
9862pub mod item_similarity_recommender {
9863 /// The items similar to a given base item.
9864 #[allow(clippy::all)]
9865 #[allow(clippy::pedantic)]
9866 #[allow(clippy::nursery)]
9867 #[derive(Clone, Copy, PartialEq, ::prost::Message)]
9868 pub struct ConnectedItem {
9869 #[prost(uint64, tag = "1")]
9870 pub item_id: u64,
9871 #[prost(double, tag = "2")]
9872 pub similarity_score: f64,
9873 }
9874 /// The formula for the score of a given model as given above, with shift_k
9875 /// parameter given by itemScoreAdjustment, and the similar item list filling in
9876 /// all the known sim(k,i) scores for i given by itemID and k given by the itemID parameter in
9877 /// the similarItemList.
9878 #[allow(clippy::all)]
9879 #[allow(clippy::pedantic)]
9880 #[allow(clippy::nursery)]
9881 #[derive(Clone, PartialEq, ::prost::Message)]
9882 pub struct SimilarItems {
9883 #[prost(uint64, tag = "1")]
9884 pub item_id: u64,
9885 #[prost(message, repeated, tag = "2")]
9886 pub similar_item_list: ::prost::alloc::vec::Vec<ConnectedItem>,
9887 #[prost(double, tag = "3")]
9888 pub item_score_adjustment: f64,
9889 }
9890}
9891///
9892/// A model which wraps another (compiled) model external to this one
9893#[allow(clippy::all)]
9894#[allow(clippy::pedantic)]
9895#[allow(clippy::nursery)]
9896#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
9897pub struct LinkedModel {
9898 #[prost(oneof = "linked_model::LinkType", tags = "1")]
9899 pub link_type: ::core::option::Option<linked_model::LinkType>,
9900}
9901/// Nested message and enum types in `LinkedModel`.
9902pub mod linked_model {
9903 #[allow(clippy::all)]
9904 #[allow(clippy::pedantic)]
9905 #[allow(clippy::nursery)]
9906 #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
9907 pub enum LinkType {
9908 /// A model located via a file system path
9909 #[prost(message, tag = "1")]
9910 LinkedModelFile(super::LinkedModelFile),
9911 }
9912}
9913/// Model is referenced by a model file name and search path
9914#[allow(clippy::all)]
9915#[allow(clippy::pedantic)]
9916#[allow(clippy::nursery)]
9917#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
9918pub struct LinkedModelFile {
9919 /// Model file name: e.g. "MyFetureExtractor.mlmodelc"
9920 #[prost(message, optional, tag = "1")]
9921 pub linked_model_file_name: ::core::option::Option<StringParameter>,
9922 /// Search path to find the linked model file
9923 /// Multiple paths can be searched using the unix-style path separator ":"
9924 /// Each path can be relative (to this model) or absolute
9925 ///
9926 /// An empty string is the same as the relative search path "."
9927 /// which searches in the same location as this model file
9928 ///
9929 /// There are some special paths which start with $
9930 /// - $BUNDLE_MAIN - Indicates to look in the main bundle
9931 /// - $BUNDLE_IDENTIFIER(identifier) - Looks in Bunde with given identifier
9932 #[prost(message, optional, tag = "2")]
9933 pub linked_model_search_path: ::core::option::Option<StringParameter>,
9934}
9935///
9936/// A pipeline consists of one or more models.
9937#[allow(clippy::all)]
9938#[allow(clippy::pedantic)]
9939#[allow(clippy::nursery)]
9940#[derive(Clone, PartialEq, ::prost::Message)]
9941pub struct Pipeline {
9942 #[prost(message, repeated, tag = "1")]
9943 pub models: ::prost::alloc::vec::Vec<Model>,
9944 /// Optional names given for each model
9945 /// If not supplied it defaults to \["model0",..., "model"(models.size()-1)\]
9946 /// These names can be used to disambiguate the scope / domain of a parameter
9947 #[prost(string, repeated, tag = "2")]
9948 pub names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
9949}
9950///
9951/// A classifier pipeline.
9952#[allow(clippy::all)]
9953#[allow(clippy::pedantic)]
9954#[allow(clippy::nursery)]
9955#[derive(Clone, PartialEq, ::prost::Message)]
9956pub struct PipelineClassifier {
9957 #[prost(message, optional, tag = "1")]
9958 pub pipeline: ::core::option::Option<Pipeline>,
9959}
9960///
9961/// A regressor pipeline.
9962#[allow(clippy::all)]
9963#[allow(clippy::pedantic)]
9964#[allow(clippy::nursery)]
9965#[derive(Clone, PartialEq, ::prost::Message)]
9966pub struct PipelineRegressor {
9967 #[prost(message, optional, tag = "1")]
9968 pub pipeline: ::core::option::Option<Pipeline>,
9969}
9970///
9971/// A feature description
9972/// consisting of a name, short description, and type.
9973#[allow(clippy::all)]
9974#[allow(clippy::pedantic)]
9975#[allow(clippy::nursery)]
9976#[derive(Clone, PartialEq, ::prost::Message)]
9977pub struct FeatureDescription {
9978 #[prost(string, tag = "1")]
9979 pub name: ::prost::alloc::string::String,
9980 #[prost(string, tag = "2")]
9981 pub short_description: ::prost::alloc::string::String,
9982 #[prost(message, optional, tag = "3")]
9983 pub r#type: ::core::option::Option<FeatureType>,
9984}
9985///
9986/// Model metadata,
9987/// consisting of a short description, a version string,
9988/// an author, a license, and any other user defined
9989/// key/value meta data.
9990#[allow(clippy::all)]
9991#[allow(clippy::pedantic)]
9992#[allow(clippy::nursery)]
9993#[derive(Clone, PartialEq, ::prost::Message)]
9994pub struct Metadata {
9995 #[prost(string, tag = "1")]
9996 pub short_description: ::prost::alloc::string::String,
9997 #[prost(string, tag = "2")]
9998 pub version_string: ::prost::alloc::string::String,
9999 #[prost(string, tag = "3")]
10000 pub author: ::prost::alloc::string::String,
10001 #[prost(string, tag = "4")]
10002 pub license: ::prost::alloc::string::String,
10003 #[prost(map = "string, string", tag = "100")]
10004 pub user_defined: ::std::collections::HashMap<
10005 ::prost::alloc::string::String,
10006 ::prost::alloc::string::String,
10007 >,
10008}
10009///
10010/// A description of a function.
10011#[allow(clippy::all)]
10012#[allow(clippy::pedantic)]
10013#[allow(clippy::nursery)]
10014#[derive(Clone, PartialEq, ::prost::Message)]
10015pub struct FunctionDescription {
10016 /// The function name.
10017 #[prost(string, tag = "1")]
10018 pub name: ::prost::alloc::string::String,
10019 /// Input feature descriptions for the function.
10020 #[prost(message, repeated, tag = "2")]
10021 pub input: ::prost::alloc::vec::Vec<FeatureDescription>,
10022 /// Output feature descriptions for the function.
10023 #[prost(message, repeated, tag = "3")]
10024 pub output: ::prost::alloc::vec::Vec<FeatureDescription>,
10025 /// State feature descriptions for the function.
10026 ///
10027 /// The `type` of each feature description must be `StateFeatureType`.
10028 #[prost(message, repeated, tag = "6")]
10029 pub state: ::prost::alloc::vec::Vec<FeatureDescription>,
10030 /// \[Required for regressor and classifier functions\]: the name
10031 /// to give to an output feature containing the prediction.
10032 #[prost(string, tag = "4")]
10033 pub predicted_feature_name: ::prost::alloc::string::String,
10034 /// \[Optional for classifier functions\]: the name to give to an
10035 /// output feature containing a dictionary mapping class
10036 /// labels to their predicted probabilities. If not specified,
10037 /// the dictionary will not be returned by the model.
10038 #[prost(string, tag = "5")]
10039 pub predicted_probabilities_name: ::prost::alloc::string::String,
10040}
10041///
10042/// A description of a model,
10043/// consisting of descriptions of its input and output features.
10044/// Both regressor and classifier models require the name of the
10045/// primary predicted output feature (``predictedFeatureName``).
10046/// Classifier models can specify the output feature containing
10047/// probabilities for the predicted classes
10048/// (``predictedProbabilitiesName``).
10049#[allow(clippy::all)]
10050#[allow(clippy::pedantic)]
10051#[allow(clippy::nursery)]
10052#[derive(Clone, PartialEq, ::prost::Message)]
10053pub struct ModelDescription {
10054 /// Functions in the model.
10055 ///
10056 /// Some model types (e.g. ML Program) support multiple functions. For
10057 /// example, a large language model might have "prompt" and "extend"
10058 /// functions. Each has a different input and output behavior, but
10059 /// they are in a same model and share resources.
10060 ///
10061 /// If the model has more than one function, use the multiple
10062 /// function configuration and declare the feature descriptions and
10063 /// associated properties at function level.
10064 ///
10065 /// If the model type doesn't support multiple functions or the
10066 /// model has just "main" function, declare the feature
10067 /// descriptions and associated properties at the model level.
10068 ///
10069 /// Note: feature descriptions and associated properties mentioned
10070 /// above include input, output, state, predictedFeatureName,
10071 /// predictedProbabilitiesName, and trainingInput fields.
10072 #[prost(message, repeated, tag = "20")]
10073 pub functions: ::prost::alloc::vec::Vec<FunctionDescription>,
10074 /// The default function.
10075 ///
10076 /// The default function is the one that is automatically used when
10077 /// one doesn't explicitly specify.
10078 ///
10079 /// The value must be one of the names in `functions` message
10080 /// above. If `functions` is empty, this field must not be present.
10081 #[prost(string, tag = "21")]
10082 pub default_function_name: ::prost::alloc::string::String,
10083 /// The metadata (e.g. author, licence, etc) of the model.
10084 #[prost(message, optional, tag = "100")]
10085 pub metadata: ::core::option::Option<Metadata>,
10086 #[prost(message, repeated, tag = "1")]
10087 pub input: ::prost::alloc::vec::Vec<FeatureDescription>,
10088 #[prost(message, repeated, tag = "10")]
10089 pub output: ::prost::alloc::vec::Vec<FeatureDescription>,
10090 /// State feature descriptions for the function.
10091 ///
10092 /// The `type` of each feature description must be `StateFeatureType`.
10093 #[prost(message, repeated, tag = "13")]
10094 pub state: ::prost::alloc::vec::Vec<FeatureDescription>,
10095 /// \[Required for regressor and classifier models\]: the name
10096 /// to give to an output feature containing the prediction.
10097 #[prost(string, tag = "11")]
10098 pub predicted_feature_name: ::prost::alloc::string::String,
10099 /// \[Optional for classifier models\]: the name to give to an
10100 /// output feature containing a dictionary mapping class
10101 /// labels to their predicted probabilities. If not specified,
10102 /// the dictionary will not be returned by the model.
10103 #[prost(string, tag = "12")]
10104 pub predicted_probabilities_name: ::prost::alloc::string::String,
10105 #[prost(message, repeated, tag = "50")]
10106 pub training_input: ::prost::alloc::vec::Vec<FeatureDescription>,
10107}
10108#[allow(clippy::all)]
10109#[allow(clippy::pedantic)]
10110#[allow(clippy::nursery)]
10111#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
10112pub struct SerializedModel {
10113 /// Identifier whose content describes the model type of the serialized protocol buffer message.
10114 #[prost(string, tag = "1")]
10115 pub identifier: ::prost::alloc::string::String,
10116 /// Must be a valid serialized protocol buffer of the above specified type.
10117 #[prost(bytes = "vec", tag = "2")]
10118 pub model: ::prost::alloc::vec::Vec<u8>,
10119}
10120///
10121/// A Core ML model,
10122/// consisting of a specification version,
10123/// a model description, and a model type.
10124///
10125/// Core ML model compatibility is indicated by
10126/// a monotonically increasing specification version number,
10127/// which is incremented anytime a backward-incompatible change is made
10128/// (this is functionally equivalent to the MAJOR version number
10129/// described by `Semantic Versioning 2.0.0 <<http://semver.org/>`_>).
10130///
10131/// Specification Versions : OS Availability (Core ML Version)
10132///
10133/// 1 : iOS 11, macOS 10.13, tvOS 11, watchOS 4 (Core ML 1)
10134/// - Feedforward & Recurrent Neural Networks
10135/// - General Linear Models
10136/// - Tree Ensembles
10137/// - Support Vector Machines
10138/// - Pipelines
10139/// - Feature Engineering
10140///
10141/// 2 : iOS 11.2, macOS 10.13.2, tvOS 11.2, watchOS 4.2 (Core ML 1.2)
10142/// - Custom Layers for Neural Networks
10143/// - Float 16 support for Neural Network layers
10144///
10145/// 3 : iOS 12, macOS 10.14, tvOS 12, watchOS 5 (Core ML 2)
10146/// - Flexible shapes and image sizes
10147/// - Categorical sequences
10148/// - Core ML Vision Feature Print, Text Classifier, Word Tagger
10149/// - Non Max Suppression
10150/// - Crop and Resize Bilinear NN layers
10151/// - Custom Models
10152///
10153/// 4 : iOS 13, macOS 10.15, tvOS 13, watchOS 6 (Core ML 3)
10154/// - Updatable models
10155/// - Exact shape / general rank mapping for neural networks
10156/// - Large expansion of supported neural network layers
10157/// - Generalized operations
10158/// - Control flow
10159/// - Dynamic layers
10160/// - See NeuralNetwork.proto
10161/// - Nearest Neighbor Classifier
10162/// - Sound Analysis Prepreocessing
10163/// - Recommender
10164/// - Linked Model
10165/// - NLP Gazeteer
10166/// - NLP WordEmbedding
10167///
10168/// 5 : iOS 14, macOS 11, tvOS 14, watchOS 7 (Core ML 4)
10169/// - Model Deployment
10170/// - Model Encryption
10171/// - Unified converter API with PyTorch and Tensorflow 2 Support in coremltools 4
10172/// - MIL builder for neural networks and composite ops in coremltools 4
10173/// - New layers in neural network:
10174/// - CumSum
10175/// - OneHot
10176/// - ClampedReLu
10177/// - ArgSort
10178/// - SliceBySize
10179/// - Convolution3D
10180/// - Pool3D
10181/// - Bilinear Upsample with align corners and fractional factors
10182/// - PixelShuffle
10183/// - MatMul with int8 weights and int8 activations
10184/// - Concat interleave
10185/// - See NeuralNetwork.proto
10186/// - Enhanced Xcode model view with interactive previews
10187/// - Enhanced Xcode Playground support for Core ML models
10188///
10189/// 6 : iOS 15, macOS 12, tvOS 15, watchOS 8 (Core ML 5)
10190/// - Core ML Audio Feature Print
10191/// - new type of model: mlprogram (MILSpec.Program)
10192///
10193/// 7 : iOS 16, macOS 13, tvOS 16, watchOS 9 (Core ML 6)
10194/// - FLOAT16 array data type
10195/// - GRAYSCALE_FLOAT16 image color space.
10196///
10197/// 8 : iOS 17, macOS 14, tvOS 17, watchOS 10 (Core ML 7)
10198/// - iOS 17 ops
10199/// - Scene print v2
10200/// - ClassConfidenceThresholding model
10201///
10202/// 9 : iOS 18, macOS 15, tvOS 18, watchOS 11 (Core ML 8)
10203/// - multiple functions
10204///
10205/// 10 : iOS 26, macOS 26, tvOS 26, watchOS 26, visionOS 26 (Core ML 9)
10206/// - Int8 MultiArray types for ML Programs
10207#[allow(clippy::all)]
10208#[allow(clippy::pedantic)]
10209#[allow(clippy::nursery)]
10210#[derive(Clone, PartialEq, ::prost::Message)]
10211pub struct Model {
10212 #[prost(int32, tag = "1")]
10213 pub specification_version: i32,
10214 #[prost(message, optional, tag = "2")]
10215 pub description: ::core::option::Option<ModelDescription>,
10216 ///
10217 /// Following model types support on-device update:
10218 ///
10219 /// - NeuralNetworkClassifier
10220 /// - NeuralNetworkRegressor
10221 /// - NeuralNetwork
10222 /// - KNearestNeighborsClassifier
10223 #[prost(bool, tag = "10")]
10224 pub is_updatable: bool,
10225 /// start at 200 here
10226 /// model specific parameters:
10227 #[prost(
10228 oneof = "model::Type",
10229 tags = "200, 201, 202, 300, 301, 302, 303, 304, 400, 401, 402, 403, 404, 500, 501, 502, 555, 556, 560, 600, 601, 602, 603, 604, 606, 607, 609, 610, 900, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 3000"
10230 )]
10231 pub r#type: ::core::option::Option<model::Type>,
10232}
10233/// Nested message and enum types in `Model`.
10234pub mod model {
10235 /// start at 200 here
10236 /// model specific parameters:
10237 #[allow(clippy::all)]
10238 #[allow(clippy::pedantic)]
10239 #[allow(clippy::nursery)]
10240 #[derive(Clone, PartialEq, ::prost::Oneof)]
10241 pub enum Type {
10242 /// pipeline starts at 200
10243 #[prost(message, tag = "200")]
10244 PipelineClassifier(super::PipelineClassifier),
10245 #[prost(message, tag = "201")]
10246 PipelineRegressor(super::PipelineRegressor),
10247 #[prost(message, tag = "202")]
10248 Pipeline(super::Pipeline),
10249 /// regressors start at 300
10250 #[prost(message, tag = "300")]
10251 GlmRegressor(super::GlmRegressor),
10252 #[prost(message, tag = "301")]
10253 SupportVectorRegressor(super::SupportVectorRegressor),
10254 #[prost(message, tag = "302")]
10255 TreeEnsembleRegressor(super::TreeEnsembleRegressor),
10256 #[prost(message, tag = "303")]
10257 NeuralNetworkRegressor(super::NeuralNetworkRegressor),
10258 #[prost(message, tag = "304")]
10259 BayesianProbitRegressor(super::BayesianProbitRegressor),
10260 /// classifiers start at 400
10261 #[prost(message, tag = "400")]
10262 GlmClassifier(super::GlmClassifier),
10263 #[prost(message, tag = "401")]
10264 SupportVectorClassifier(super::SupportVectorClassifier),
10265 #[prost(message, tag = "402")]
10266 TreeEnsembleClassifier(super::TreeEnsembleClassifier),
10267 #[prost(message, tag = "403")]
10268 NeuralNetworkClassifier(super::NeuralNetworkClassifier),
10269 #[prost(message, tag = "404")]
10270 KNearestNeighborsClassifier(super::KNearestNeighborsClassifier),
10271 /// generic models start at 500
10272 #[prost(message, tag = "500")]
10273 NeuralNetwork(super::NeuralNetwork),
10274 #[prost(message, tag = "501")]
10275 ItemSimilarityRecommender(super::ItemSimilarityRecommender),
10276 #[prost(message, tag = "502")]
10277 MlProgram(super::mil_spec::Program),
10278 /// Custom and linked models
10279 #[prost(message, tag = "555")]
10280 CustomModel(super::CustomModel),
10281 #[prost(message, tag = "556")]
10282 LinkedModel(super::LinkedModel),
10283 /// Precision Recall Curve 'container''
10284 #[prost(message, tag = "560")]
10285 ClassConfidenceThresholding(super::ClassConfidenceThresholding),
10286 /// feature engineering starts at 600
10287 #[prost(message, tag = "600")]
10288 OneHotEncoder(super::OneHotEncoder),
10289 #[prost(message, tag = "601")]
10290 Imputer(super::Imputer),
10291 #[prost(message, tag = "602")]
10292 FeatureVectorizer(super::FeatureVectorizer),
10293 #[prost(message, tag = "603")]
10294 DictVectorizer(super::DictVectorizer),
10295 #[prost(message, tag = "604")]
10296 Scaler(super::Scaler),
10297 #[prost(message, tag = "606")]
10298 CategoricalMapping(super::CategoricalMapping),
10299 #[prost(message, tag = "607")]
10300 Normalizer(super::Normalizer),
10301 #[prost(message, tag = "609")]
10302 ArrayFeatureExtractor(super::ArrayFeatureExtractor),
10303 #[prost(message, tag = "610")]
10304 NonMaximumSuppression(super::NonMaximumSuppression),
10305 /// simple mathematical functions used for testing start at 900
10306 #[prost(message, tag = "900")]
10307 Identity(super::Identity),
10308 /// CoreML provided models
10309 #[prost(message, tag = "2000")]
10310 TextClassifier(super::core_ml_models::TextClassifier),
10311 #[prost(message, tag = "2001")]
10312 WordTagger(super::core_ml_models::WordTagger),
10313 #[prost(message, tag = "2002")]
10314 VisionFeaturePrint(super::core_ml_models::VisionFeaturePrint),
10315 #[prost(message, tag = "2003")]
10316 SoundAnalysisPreprocessing(super::core_ml_models::SoundAnalysisPreprocessing),
10317 #[prost(message, tag = "2004")]
10318 Gazetteer(super::core_ml_models::Gazetteer),
10319 #[prost(message, tag = "2005")]
10320 WordEmbedding(super::core_ml_models::WordEmbedding),
10321 #[prost(message, tag = "2006")]
10322 AudioFeaturePrint(super::core_ml_models::AudioFeaturePrint),
10323 /// Reserved private messages start at 3000
10324 /// These messages are subject to change with no notice or support.
10325 #[prost(message, tag = "3000")]
10326 SerializedModel(super::SerializedModel),
10327 }
10328}