// This file is @generated by prost-build.
///
/// The 64-bit integer feature type.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Int64FeatureType {}
///
/// The double-precision floating point number feature type.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DoubleFeatureType {}
///
/// The string feature type.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StringFeatureType {}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SizeRange {
#[prost(uint64, tag = "1")]
pub lower_bound: u64,
/// negative value means unbound otherwise upperbound is included in range
#[prost(int64, tag = "2")]
pub upper_bound: i64,
}
///
/// The image feature type.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImageFeatureType {
#[prost(int64, tag = "1")]
pub width: i64,
#[prost(int64, tag = "2")]
pub height: i64,
#[prost(enumeration = "image_feature_type::ColorSpace", tag = "3")]
pub color_space: i32,
#[prost(oneof = "image_feature_type::SizeFlexibility", tags = "21, 31")]
pub size_flexibility: ::core::option::Option<image_feature_type::SizeFlexibility>,
}
/// Nested message and enum types in `ImageFeatureType`.
pub mod image_feature_type {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ImageSize {
#[prost(uint64, tag = "1")]
pub width: u64,
#[prost(uint64, tag = "2")]
pub height: u64,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EnumeratedImageSizes {
#[prost(message, repeated, tag = "1")]
pub sizes: ::prost::alloc::vec::Vec<ImageSize>,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ImageSizeRange {
#[prost(message, optional, tag = "1")]
pub width_range: ::core::option::Option<super::SizeRange>,
#[prost(message, optional, tag = "2")]
pub height_range: ::core::option::Option<super::SizeRange>,
}
/// Assumes raw (decompressed) format
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ColorSpace {
InvalidColorSpace = 0,
/// 8 bits per pixel
Grayscale = 10,
/// 32 bits per pixel: RGBA with A channel ignored
Rgb = 20,
/// 32 bits per pixel: BGRA with A channel ignored
Bgr = 30,
/// 16 bits float per pixel
GrayscaleFloat16 = 40,
}
impl ColorSpace {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::InvalidColorSpace => "INVALID_COLOR_SPACE",
Self::Grayscale => "GRAYSCALE",
Self::Rgb => "RGB",
Self::Bgr => "BGR",
Self::GrayscaleFloat16 => "GRAYSCALE_FLOAT16",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"INVALID_COLOR_SPACE" => Some(Self::InvalidColorSpace),
"GRAYSCALE" => Some(Self::Grayscale),
"RGB" => Some(Self::Rgb),
"BGR" => Some(Self::Bgr),
"GRAYSCALE_FLOAT16" => Some(Self::GrayscaleFloat16),
_ => None,
}
}
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum SizeFlexibility {
#[prost(message, tag = "21")]
EnumeratedSizes(EnumeratedImageSizes),
#[prost(message, tag = "31")]
ImageSizeRange(ImageSizeRange),
}
}
///
/// The array feature type.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ArrayFeatureType {
#[prost(int64, repeated, tag = "1")]
pub shape: ::prost::alloc::vec::Vec<i64>,
#[prost(enumeration = "array_feature_type::ArrayDataType", tag = "2")]
pub data_type: i32,
#[prost(oneof = "array_feature_type::ShapeFlexibility", tags = "21, 31")]
pub shape_flexibility: ::core::option::Option<array_feature_type::ShapeFlexibility>,
#[prost(oneof = "array_feature_type::DefaultOptionalValue", tags = "41, 51, 61")]
pub default_optional_value: ::core::option::Option<
array_feature_type::DefaultOptionalValue,
>,
}
/// Nested message and enum types in `ArrayFeatureType`.
pub mod array_feature_type {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Shape {
#[prost(int64, repeated, tag = "1")]
pub shape: ::prost::alloc::vec::Vec<i64>,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EnumeratedShapes {
#[prost(message, repeated, tag = "1")]
pub shapes: ::prost::alloc::vec::Vec<Shape>,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ShapeRange {
/// sizeRanges.size() must be length 1 or 3
/// sizeRanges\[d\] specifies the allowed range for dimension d
#[prost(message, repeated, tag = "1")]
pub size_ranges: ::prost::alloc::vec::Vec<super::SizeRange>,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ArrayDataType {
InvalidArrayDataType = 0,
/// 0x10000 | 32
Float32 = 65568,
/// 0x10000 | 64
Double = 65600,
/// 0x20000 | 32
Int32 = 131104,
/// 0x20000 | 8
Int8 = 131080,
/// 0x10000 | 16
Float16 = 65552,
}
impl ArrayDataType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::InvalidArrayDataType => "INVALID_ARRAY_DATA_TYPE",
Self::Float32 => "FLOAT32",
Self::Double => "DOUBLE",
Self::Int32 => "INT32",
Self::Int8 => "INT8",
Self::Float16 => "FLOAT16",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"INVALID_ARRAY_DATA_TYPE" => Some(Self::InvalidArrayDataType),
"FLOAT32" => Some(Self::Float32),
"DOUBLE" => Some(Self::Double),
"INT32" => Some(Self::Int32),
"INT8" => Some(Self::Int8),
"FLOAT16" => Some(Self::Float16),
_ => None,
}
}
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ShapeFlexibility {
#[prost(message, tag = "21")]
EnumeratedShapes(EnumeratedShapes),
#[prost(message, tag = "31")]
ShapeRange(ShapeRange),
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum DefaultOptionalValue {
#[prost(int32, tag = "41")]
IntDefaultValue(i32),
#[prost(float, tag = "51")]
FloatDefaultValue(f32),
#[prost(double, tag = "61")]
DoubleDefaultValue(f64),
}
}
///
/// The dictionary feature type.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DictionaryFeatureType {
///
/// Key/value type tags, with the following restrictions:
/// - ``keyType`` must be a hashable type
/// - ``valueType`` is assumed to be a ``double``
#[prost(oneof = "dictionary_feature_type::KeyType", tags = "1, 2")]
pub key_type: ::core::option::Option<dictionary_feature_type::KeyType>,
}
/// Nested message and enum types in `DictionaryFeatureType`.
pub mod dictionary_feature_type {
///
/// Key/value type tags, with the following restrictions:
/// - ``keyType`` must be a hashable type
/// - ``valueType`` is assumed to be a ``double``
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum KeyType {
#[prost(message, tag = "1")]
Int64KeyType(super::Int64FeatureType),
#[prost(message, tag = "2")]
StringKeyType(super::StringFeatureType),
}
}
///
/// The Sequence feature type.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SequenceFeatureType {
/// Range of allowed size/length/count of sequence
#[prost(message, optional, tag = "101")]
pub size_range: ::core::option::Option<SizeRange>,
///
/// Currently only categorical int64 and String sequences are supported
#[prost(oneof = "sequence_feature_type::Type", tags = "1, 3")]
pub r#type: ::core::option::Option<sequence_feature_type::Type>,
}
/// Nested message and enum types in `SequenceFeatureType`.
pub mod sequence_feature_type {
///
/// Currently only categorical int64 and String sequences are supported
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum Type {
#[prost(message, tag = "1")]
Int64Type(super::Int64FeatureType),
#[prost(message, tag = "3")]
StringType(super::StringFeatureType),
}
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StateFeatureType {
#[prost(oneof = "state_feature_type::Type", tags = "1")]
pub r#type: ::core::option::Option<state_feature_type::Type>,
}
/// Nested message and enum types in `StateFeatureType`.
pub mod state_feature_type {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Type {
#[prost(message, tag = "1")]
ArrayType(super::ArrayFeatureType),
}
}
///
/// A feature, which may be optional.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FeatureType {
#[prost(bool, tag = "1000")]
pub is_optional: bool,
#[prost(oneof = "feature_type::Type", tags = "1, 2, 3, 4, 5, 6, 7, 8")]
pub r#type: ::core::option::Option<feature_type::Type>,
}
/// Nested message and enum types in `FeatureType`.
pub mod feature_type {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Type {
#[prost(message, tag = "1")]
Int64Type(super::Int64FeatureType),
#[prost(message, tag = "2")]
DoubleType(super::DoubleFeatureType),
#[prost(message, tag = "3")]
StringType(super::StringFeatureType),
#[prost(message, tag = "4")]
ImageType(super::ImageFeatureType),
#[prost(message, tag = "5")]
MultiArrayType(super::ArrayFeatureType),
#[prost(message, tag = "6")]
DictionaryType(super::DictionaryFeatureType),
#[prost(message, tag = "7")]
SequenceType(super::SequenceFeatureType),
#[prost(message, tag = "8")]
StateType(super::StateFeatureType),
}
}
///
/// A mapping from a string
/// to a 64-bit integer.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StringToInt64Map {
#[prost(map = "string, int64", tag = "1")]
pub map: ::std::collections::HashMap<::prost::alloc::string::String, i64>,
}
///
/// A mapping from a 64-bit integer
/// to a string.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Int64ToStringMap {
#[prost(map = "int64, string", tag = "1")]
pub map: ::std::collections::HashMap<i64, ::prost::alloc::string::String>,
}
///
/// A mapping from a string
/// to a double-precision floating point number.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StringToDoubleMap {
#[prost(map = "string, double", tag = "1")]
pub map: ::std::collections::HashMap<::prost::alloc::string::String, f64>,
}
///
/// A mapping from a 64-bit integer
/// to a double-precision floating point number.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Int64ToDoubleMap {
#[prost(map = "int64, double", tag = "1")]
pub map: ::std::collections::HashMap<i64, f64>,
}
///
/// A vector of strings.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StringVector {
#[prost(string, repeated, tag = "1")]
pub vector: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
///
/// A vector of 64-bit integers.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Int64Vector {
#[prost(int64, repeated, tag = "1")]
pub vector: ::prost::alloc::vec::Vec<i64>,
}
///
/// A vector of floating point numbers.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FloatVector {
#[prost(float, repeated, tag = "1")]
pub vector: ::prost::alloc::vec::Vec<f32>,
}
///
/// A vector of double-precision floating point numbers.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DoubleVector {
#[prost(double, repeated, tag = "1")]
pub vector: ::prost::alloc::vec::Vec<f64>,
}
///
/// A range of int64 values
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Int64Range {
#[prost(int64, tag = "1")]
pub min_value: i64,
#[prost(int64, tag = "2")]
pub max_value: i64,
}
///
/// A set of int64 values
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Int64Set {
#[prost(int64, repeated, tag = "1")]
pub values: ::prost::alloc::vec::Vec<i64>,
}
///
/// A range of double values
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DoubleRange {
#[prost(double, tag = "1")]
pub min_value: f64,
#[prost(double, tag = "2")]
pub max_value: f64,
}
/// *
/// Precision/Recall curve.
///
/// The syntax comprises two tables, one to look up the confidence value threshold
/// for a given precision, and the other for a given recall.
///
/// Example:
/// ----------------------+----+----+----+----+----+----+----+----+----
/// precisionValues | .1 | .2 | .3 | .4 | .5 | .6 | .7 |
/// precisionConfidence | .0 | .0 | .0 | .0 | .1 | .3 | .4 |
/// ----------------------+----+----+----+----+----+----+----+----+----
///
/// ----------------------+----+----+----+----+----+----+----+----+----
/// recallValues | .1 | .2 | .3 | .4 | .5 | .6 | .7 | .8 | .9
/// recallConfidence | .7 | .6 | .5 | .4 | .3 | .3 | .2 | .1 | .0
/// ----------------------+----+----+----+----+----+----+----+----+----
///
/// The application expects that, when it filters out samples with
/// confidence threshold = 0.1, it gets precision = 0.5. Likewise,
/// with threshold = 0.2 it gets recall = 0.7.
///
/// The table must have only valid values; do not use `NaN`, `+/- INF`,
/// or negative values. The application is responsible for inter/extrapolating
/// approprate confidence threshold based on the application's specific need.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PrecisionRecallCurve {
#[prost(message, optional, tag = "1")]
pub precision_values: ::core::option::Option<FloatVector>,
#[prost(message, optional, tag = "2")]
pub precision_confidence_thresholds: ::core::option::Option<FloatVector>,
#[prost(message, optional, tag = "3")]
pub recall_values: ::core::option::Option<FloatVector>,
#[prost(message, optional, tag = "4")]
pub recall_confidence_thresholds: ::core::option::Option<FloatVector>,
}
///
/// A transformer that replaces missing values with a default value,
/// such as a statistically-derived value.
///
/// If ``ReplaceValue`` is set, then missing values of that type are
/// replaced with the corresponding value.
///
/// For example: if ``replaceDoubleValue`` is set to ``NaN``
/// and a single ``NaN`` double value is provided as input,
/// then it is replaced by ``imputedDoubleValue``. However
/// if the input is an array of doubles, then any instances
/// of ``NaN`` in the array is replaced with the corresponding
/// value in ``imputedDoubleArray``.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Imputer {
#[prost(oneof = "imputer::ImputedValue", tags = "1, 2, 3, 4, 5, 6, 7")]
pub imputed_value: ::core::option::Option<imputer::ImputedValue>,
#[prost(oneof = "imputer::ReplaceValue", tags = "11, 12, 13")]
pub replace_value: ::core::option::Option<imputer::ReplaceValue>,
}
/// Nested message and enum types in `Imputer`.
pub mod imputer {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ImputedValue {
#[prost(double, tag = "1")]
ImputedDoubleValue(f64),
#[prost(int64, tag = "2")]
ImputedInt64Value(i64),
#[prost(string, tag = "3")]
ImputedStringValue(::prost::alloc::string::String),
#[prost(message, tag = "4")]
ImputedDoubleArray(super::DoubleVector),
#[prost(message, tag = "5")]
ImputedInt64Array(super::Int64Vector),
#[prost(message, tag = "6")]
ImputedStringDictionary(super::StringToDoubleMap),
#[prost(message, tag = "7")]
ImputedInt64Dictionary(super::Int64ToDoubleMap),
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ReplaceValue {
#[prost(double, tag = "11")]
ReplaceDoubleValue(f64),
#[prost(int64, tag = "12")]
ReplaceInt64Value(i64),
#[prost(string, tag = "13")]
ReplaceStringValue(::prost::alloc::string::String),
}
}
///
/// Int64 parameter,
/// consisting of a default int64 value, and allowed range or set of values
/// value is unbounded if AllowedValues is not set.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Int64Parameter {
#[prost(int64, tag = "1")]
pub default_value: i64,
#[prost(oneof = "int64_parameter::AllowedValues", tags = "10, 11")]
pub allowed_values: ::core::option::Option<int64_parameter::AllowedValues>,
}
/// Nested message and enum types in `Int64Parameter`.
pub mod int64_parameter {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum AllowedValues {
#[prost(message, tag = "10")]
Range(super::Int64Range),
#[prost(message, tag = "11")]
Set(super::Int64Set),
}
}
///
/// Double parameter,
/// consisting of a default double value, and allowed range of values
/// value is unbounded if AllowedValues is not set.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct DoubleParameter {
#[prost(double, tag = "1")]
pub default_value: f64,
#[prost(oneof = "double_parameter::AllowedValues", tags = "10")]
pub allowed_values: ::core::option::Option<double_parameter::AllowedValues>,
}
/// Nested message and enum types in `DoubleParameter`.
pub mod double_parameter {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum AllowedValues {
#[prost(message, tag = "10")]
Range(super::DoubleRange),
}
}
///
/// String parameter,
/// A default string value must be provided
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StringParameter {
#[prost(string, tag = "1")]
pub default_value: ::prost::alloc::string::String,
}
///
/// String parameter,
/// A default bool value must be provided
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BoolParameter {
#[prost(bool, tag = "1")]
pub default_value: bool,
}
///
/// A neural network.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NeuralNetwork {
#[prost(message, repeated, tag = "1")]
pub layers: ::prost::alloc::vec::Vec<NeuralNetworkLayer>,
#[prost(message, repeated, tag = "2")]
pub preprocessing: ::prost::alloc::vec::Vec<NeuralNetworkPreprocessing>,
/// use this enum value to determine the input tensor shapes to the neural network, for multiarray inputs
#[prost(enumeration = "NeuralNetworkMultiArrayShapeMapping", tag = "5")]
pub array_input_shape_mapping: i32,
/// use this enum value to determine the input tensor shapes to the neural network, for image inputs
#[prost(enumeration = "NeuralNetworkImageShapeMapping", tag = "6")]
pub image_input_shape_mapping: i32,
#[prost(message, optional, tag = "10")]
pub update_params: ::core::option::Option<NetworkUpdateParameters>,
}
///
/// A neural network preprocessor that
/// performs a scalar multiplication of an image
/// followed by addition of scalar biases to the channels.
///
/// Input: X
/// An image in BGR or RGB format with shape ``\[3, H, W\]``
/// or in grayscale format with shape ``\[1, H, W\]``.
/// Output: Y
/// An image with format and shape corresponding to the input.
///
/// If the input image is in BGR format:
///
/// .. code::
///
/// Y\[0, :, :\] = channelScale * X\[0, :, :\] + blueBias
/// Y\[1, :, :\] = channelScale * X\[1, :, :\] + greenBias
/// Y\[2, :, :\] = channelScale * X\[2, :, :\] + redBias
///
/// If the input image is in RGB format:
///
/// .. code::
///
/// Y\[0, :, :\] = channelScale * X\[0, :, :\] + redBias
/// Y\[1, :, :\] = channelScale * X\[1, :, :\] + greenBias
/// Y\[2, :, :\] = channelScale * X\[2, :, :\] + blueBias
///
/// If the input image is in grayscale format:
///
/// .. code::
///
/// Y\[0, :, :\] = channelScale * X\[0, :, :\] + grayBias
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct NeuralNetworkImageScaler {
/// Scalar to be multiplied.
#[prost(float, tag = "10")]
pub channel_scale: f32,
/// Scalar blue bias to be added.
#[prost(float, tag = "20")]
pub blue_bias: f32,
/// Scalar green bias to be added.
#[prost(float, tag = "21")]
pub green_bias: f32,
/// Scalar red bias to be added.
#[prost(float, tag = "22")]
pub red_bias: f32,
/// Scalar bias to be added for grayscale images.
#[prost(float, tag = "30")]
pub gray_bias: f32,
}
///
/// A neural network preprocessor that
/// subtracts the provided mean image from the input image.
/// The mean image is subtracted from the input named
/// ``NeuralNetworkPreprocessing.featureName``.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NeuralNetworkMeanImage {
///
/// Mean image stored as a flattened array of floats,
/// representing shape \[Channel,Height,Width\].
#[prost(float, repeated, tag = "1")]
pub mean_image: ::prost::alloc::vec::Vec<f32>,
}
/// Preprocessing parameters for image inputs.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NeuralNetworkPreprocessing {
/// must be equal to the input name to which the preprocessing is applied
#[prost(string, tag = "1")]
pub feature_name: ::prost::alloc::string::String,
#[prost(oneof = "neural_network_preprocessing::Preprocessor", tags = "10, 11")]
pub preprocessor: ::core::option::Option<neural_network_preprocessing::Preprocessor>,
}
/// Nested message and enum types in `NeuralNetworkPreprocessing`.
pub mod neural_network_preprocessing {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Preprocessor {
#[prost(message, tag = "10")]
Scaler(super::NeuralNetworkImageScaler),
#[prost(message, tag = "11")]
MeanImage(super::NeuralNetworkMeanImage),
}
}
///
/// A rectified linear unit (ReLU) activation function.
///
/// This function has the following formula:
///
/// .. math::
/// f(x) = \text{max}(0, x)
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ActivationReLu {}
///
/// A leaky rectified linear unit (ReLU) activation function.
///
/// This function has the following formula:
///
/// .. math::
/// f(x) = \begin{cases}
/// x & \text{if } x \geq 0 \\
/// \alpha x & \text{if } x < 0
/// \end{cases}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ActivationLeakyReLu {
/// negative slope value for leakyReLU
#[prost(float, tag = "1")]
pub alpha: f32,
}
///
/// A hyperbolic tangent activation function.
///
/// This function has the following formula:
///
/// .. math::
/// f(x) = \dfrac{1 - e^{-2x}}{1 + e^{-2x}}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ActivationTanh {}
///
/// A scaled hyperbolic tangent activation function.
///
/// This function has the following formula:
///
/// .. math::
/// f(x) = \alpha \tanh(\beta x)
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ActivationScaledTanh {
#[prost(float, tag = "1")]
pub alpha: f32,
#[prost(float, tag = "2")]
pub beta: f32,
}
///
/// A sigmoid activation function.
///
/// This function has the following formula:
///
/// .. math::
/// f(x) = \dfrac{1}{1 + e^{-x}}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ActivationSigmoid {}
///
/// A linear activation function.
///
/// This function has the following formula:
///
/// .. math::
/// f(x) = \alpha x + \beta
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ActivationLinear {
#[prost(float, tag = "1")]
pub alpha: f32,
#[prost(float, tag = "2")]
pub beta: f32,
}
///
/// A hard sigmoid activation function.
///
/// This function has the following formula:
///
/// .. math::
/// f(x) = \text{min}(\text{max}(\alpha x + \beta, 0), 1)
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ActivationSigmoidHard {
#[prost(float, tag = "1")]
pub alpha: f32,
#[prost(float, tag = "2")]
pub beta: f32,
}
///
/// A parameterized rectified linear unit (PReLU) activation function.
/// Input must be at least rank 3. Axis = -3 is denoted by "C", or channels.
/// "alpha" parameter can be a vector of length C.
///
/// This function has the following formula:
///
/// .. math::
/// f(x_i) = \begin{cases}
/// x_i & \text{if } x_i \geq 0 \\
/// \alpha_i x_i & \text{if } x_i < 0
/// \end{cases} \;,\;i=1,...,C
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ActivationPReLu {
/// parameter of length C or 1.
/// If length is 1, same value is used for all channels
#[prost(message, optional, tag = "1")]
pub alpha: ::core::option::Option<WeightParams>,
}
///
/// An exponential linear unit (ELU) activation function.
///
/// This function has the following formula:
///
/// .. math::
/// f(x) = \begin{cases}
/// x & \text{if } x \geq 0 \\
/// \alpha (e^x - 1) & \text{if } x < 0
/// \end{cases}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ActivationElu {
#[prost(float, tag = "1")]
pub alpha: f32,
}
///
/// A thresholded rectified linear unit (ReLU) activation function.
///
/// This function has the following formula:
///
/// .. math::
/// f(x) = \begin{cases}
/// x & \text{if } x \geq \alpha \\
/// 0 & \text{if } x < \alpha
/// \end{cases}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ActivationThresholdedReLu {
#[prost(float, tag = "1")]
pub alpha: f32,
}
///
/// A softsign activation function.
///
/// This function has the following formula:
///
/// .. math::
/// f(x) = \dfrac{x}{1 + |x|}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ActivationSoftsign {}
///
/// A softplus activation function.
///
/// This function has the following formula:
///
/// .. math::
/// f(x) = \text{log}(1 + e^x)
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ActivationSoftplus {}
///
/// A parametric softplus activation function.
/// Input must be at least rank 3. axis = -3 is denoted by "C", or channels.
/// "alpha"/"beta" parameter can be a vector of length C.
///
/// This function has the following formula:
///
/// .. math::
/// f(x_i) = \alpha_i \text{log}(1 + e^{\beta_i x_i}) \;,\;i=1,...,C
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ActivationParametricSoftplus {
/// If length is 1, same value is used for all channels
///
/// parameter of length C or 1
#[prost(message, optional, tag = "1")]
pub alpha: ::core::option::Option<WeightParams>,
/// parameter of length C or 1
#[prost(message, optional, tag = "2")]
pub beta: ::core::option::Option<WeightParams>,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ActivationParams {
#[prost(
oneof = "activation_params::NonlinearityType",
tags = "5, 10, 15, 20, 25, 30, 31, 40, 41, 50, 60, 70, 71"
)]
pub nonlinearity_type: ::core::option::Option<activation_params::NonlinearityType>,
}
/// Nested message and enum types in `ActivationParams`.
pub mod activation_params {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum NonlinearityType {
#[prost(message, tag = "5")]
Linear(super::ActivationLinear),
#[prost(message, tag = "10")]
ReLu(super::ActivationReLu),
#[prost(message, tag = "15")]
LeakyReLu(super::ActivationLeakyReLu),
#[prost(message, tag = "20")]
ThresholdedReLu(super::ActivationThresholdedReLu),
#[prost(message, tag = "25")]
PReLu(super::ActivationPReLu),
#[prost(message, tag = "30")]
Tanh(super::ActivationTanh),
#[prost(message, tag = "31")]
ScaledTanh(super::ActivationScaledTanh),
#[prost(message, tag = "40")]
Sigmoid(super::ActivationSigmoid),
#[prost(message, tag = "41")]
SigmoidHard(super::ActivationSigmoidHard),
#[prost(message, tag = "50")]
Elu(super::ActivationElu),
#[prost(message, tag = "60")]
Softsign(super::ActivationSoftsign),
#[prost(message, tag = "70")]
Softplus(super::ActivationSoftplus),
#[prost(message, tag = "71")]
ParametricSoftplus(super::ActivationParametricSoftplus),
}
}
///
/// Representation of the intermediate tensors
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Tensor {
/// Number of dimensions in the tensor shape
#[prost(uint32, tag = "1")]
pub rank: u32,
/// actual value of the tensor shape.
/// must be of length "rank". Can contain -1s for unknown dimensions.
#[prost(int64, repeated, tag = "2")]
pub dim_value: ::prost::alloc::vec::Vec<i64>,
}
///
/// A single neural network layer.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NeuralNetworkLayer {
/// descriptive name of the layer
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub input: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "3")]
pub output: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
/// must be the same length as the "input" field
#[prost(message, repeated, tag = "4")]
pub input_tensor: ::prost::alloc::vec::Vec<Tensor>,
/// must be the same length as the "output" field
#[prost(message, repeated, tag = "5")]
pub output_tensor: ::prost::alloc::vec::Vec<Tensor>,
/// Must be set to true to mark the layer as updatable.
/// If true, the weightParams in the layer's properties must also be set to updatable
/// If false, the value of the isUpdatable parameter within the layer's weights are ignored
#[prost(bool, tag = "10")]
pub is_updatable: bool,
#[prost(
oneof = "neural_network_layer::Layer",
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"
)]
pub layer: ::core::option::Option<neural_network_layer::Layer>,
}
/// Nested message and enum types in `NeuralNetworkLayer`.
pub mod neural_network_layer {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Layer {
/// Start at 100 here
#[prost(message, tag = "100")]
Convolution(super::ConvolutionLayerParams),
#[prost(message, tag = "120")]
Pooling(super::PoolingLayerParams),
#[prost(message, tag = "130")]
Activation(super::ActivationParams),
#[prost(message, tag = "140")]
InnerProduct(super::InnerProductLayerParams),
#[prost(message, tag = "150")]
Embedding(super::EmbeddingLayerParams),
/// Normalization-related Layers
#[prost(message, tag = "160")]
Batchnorm(super::BatchnormLayerParams),
#[prost(message, tag = "165")]
Mvn(super::MeanVarianceNormalizeLayerParams),
#[prost(message, tag = "170")]
L2normalize(super::L2NormalizeLayerParams),
#[prost(message, tag = "175")]
Softmax(super::SoftmaxLayerParams),
#[prost(message, tag = "180")]
Lrn(super::LrnLayerParams),
#[prost(message, tag = "190")]
Crop(super::CropLayerParams),
#[prost(message, tag = "200")]
Padding(super::PaddingLayerParams),
#[prost(message, tag = "210")]
Upsample(super::UpsampleLayerParams),
#[prost(message, tag = "211")]
ResizeBilinear(super::ResizeBilinearLayerParams),
#[prost(message, tag = "212")]
CropResize(super::CropResizeLayerParams),
#[prost(message, tag = "220")]
Unary(super::UnaryFunctionLayerParams),
/// Element-wise Operations
#[prost(message, tag = "230")]
Add(super::AddLayerParams),
#[prost(message, tag = "231")]
Multiply(super::MultiplyLayerParams),
#[prost(message, tag = "240")]
Average(super::AverageLayerParams),
#[prost(message, tag = "245")]
Scale(super::ScaleLayerParams),
#[prost(message, tag = "250")]
Bias(super::BiasLayerParams),
#[prost(message, tag = "260")]
Max(super::MaxLayerParams),
#[prost(message, tag = "261")]
Min(super::MinLayerParams),
#[prost(message, tag = "270")]
Dot(super::DotProductLayerParams),
#[prost(message, tag = "280")]
Reduce(super::ReduceLayerParams),
#[prost(message, tag = "290")]
LoadConstant(super::LoadConstantLayerParams),
/// Data Reorganization
#[prost(message, tag = "300")]
Reshape(super::ReshapeLayerParams),
#[prost(message, tag = "301")]
Flatten(super::FlattenLayerParams),
#[prost(message, tag = "310")]
Permute(super::PermuteLayerParams),
#[prost(message, tag = "320")]
Concat(super::ConcatLayerParams),
#[prost(message, tag = "330")]
Split(super::SplitLayerParams),
#[prost(message, tag = "340")]
SequenceRepeat(super::SequenceRepeatLayerParams),
#[prost(message, tag = "345")]
ReorganizeData(super::ReorganizeDataLayerParams),
#[prost(message, tag = "350")]
Slice(super::SliceLayerParams),
/// Recurrent Layers
#[prost(message, tag = "400")]
SimpleRecurrent(super::SimpleRecurrentLayerParams),
#[prost(message, tag = "410")]
Gru(super::GruLayerParams),
#[prost(message, tag = "420")]
UniDirectionalLstm(super::UniDirectionalLstmLayerParams),
#[prost(message, tag = "430")]
BiDirectionalLstm(super::BiDirectionalLstmLayerParams),
/// Custom (user-implemented) Layer
#[prost(message, tag = "500")]
Custom(super::CustomLayerParams),
/// Control Flow related Layers
#[prost(message, tag = "600")]
Copy(super::CopyLayerParams),
#[prost(message, tag = "605")]
Branch(super::BranchLayerParams),
#[prost(message, tag = "615")]
Loop(super::LoopLayerParams),
#[prost(message, tag = "620")]
LoopBreak(super::LoopBreakLayerParams),
#[prost(message, tag = "625")]
LoopContinue(super::LoopContinueLayerParams),
#[prost(message, tag = "635")]
RangeStatic(super::RangeStaticLayerParams),
#[prost(message, tag = "640")]
RangeDynamic(super::RangeDynamicLayerParams),
/// Element-wise Unary Layers
#[prost(message, tag = "660")]
Clip(super::ClipLayerParams),
#[prost(message, tag = "665")]
Ceil(super::CeilLayerParams),
#[prost(message, tag = "670")]
Floor(super::FloorLayerParams),
#[prost(message, tag = "680")]
Sign(super::SignLayerParams),
#[prost(message, tag = "685")]
Round(super::RoundLayerParams),
#[prost(message, tag = "700")]
Exp2(super::Exp2LayerParams),
#[prost(message, tag = "710")]
Sin(super::SinLayerParams),
#[prost(message, tag = "715")]
Cos(super::CosLayerParams),
#[prost(message, tag = "720")]
Tan(super::TanLayerParams),
#[prost(message, tag = "730")]
Asin(super::AsinLayerParams),
#[prost(message, tag = "735")]
Acos(super::AcosLayerParams),
#[prost(message, tag = "740")]
Atan(super::AtanLayerParams),
#[prost(message, tag = "750")]
Sinh(super::SinhLayerParams),
#[prost(message, tag = "755")]
Cosh(super::CoshLayerParams),
#[prost(message, tag = "760")]
Tanh(super::TanhLayerParams),
#[prost(message, tag = "770")]
Asinh(super::AsinhLayerParams),
#[prost(message, tag = "775")]
Acosh(super::AcoshLayerParams),
#[prost(message, tag = "780")]
Atanh(super::AtanhLayerParams),
#[prost(message, tag = "790")]
Erf(super::ErfLayerParams),
#[prost(message, tag = "795")]
Gelu(super::GeluLayerParams),
/// Element-wise Binary with Broadcasting Support
#[prost(message, tag = "815")]
Equal(super::EqualLayerParams),
#[prost(message, tag = "820")]
NotEqual(super::NotEqualLayerParams),
#[prost(message, tag = "825")]
LessThan(super::LessThanLayerParams),
#[prost(message, tag = "827")]
LessEqual(super::LessEqualLayerParams),
#[prost(message, tag = "830")]
GreaterThan(super::GreaterThanLayerParams),
#[prost(message, tag = "832")]
GreaterEqual(super::GreaterEqualLayerParams),
#[prost(message, tag = "840")]
LogicalOr(super::LogicalOrLayerParams),
#[prost(message, tag = "845")]
LogicalXor(super::LogicalXorLayerParams),
#[prost(message, tag = "850")]
LogicalNot(super::LogicalNotLayerParams),
#[prost(message, tag = "855")]
LogicalAnd(super::LogicalAndLayerParams),
#[prost(message, tag = "865")]
ModBroadcastable(super::ModBroadcastableLayerParams),
#[prost(message, tag = "870")]
MinBroadcastable(super::MinBroadcastableLayerParams),
#[prost(message, tag = "875")]
MaxBroadcastable(super::MaxBroadcastableLayerParams),
#[prost(message, tag = "880")]
AddBroadcastable(super::AddBroadcastableLayerParams),
#[prost(message, tag = "885")]
PowBroadcastable(super::PowBroadcastableLayerParams),
#[prost(message, tag = "890")]
DivideBroadcastable(super::DivideBroadcastableLayerParams),
#[prost(message, tag = "895")]
FloorDivBroadcastable(super::FloorDivBroadcastableLayerParams),
#[prost(message, tag = "900")]
MultiplyBroadcastable(super::MultiplyBroadcastableLayerParams),
#[prost(message, tag = "905")]
SubtractBroadcastable(super::SubtractBroadcastableLayerParams),
/// Tensor Manipulations
#[prost(message, tag = "920")]
Tile(super::TileLayerParams),
#[prost(message, tag = "925")]
Stack(super::StackLayerParams),
#[prost(message, tag = "930")]
Gather(super::GatherLayerParams),
#[prost(message, tag = "935")]
Scatter(super::ScatterLayerParams),
#[prost(message, tag = "940")]
GatherNd(super::GatherNdLayerParams),
#[prost(message, tag = "945")]
ScatterNd(super::ScatterNdLayerParams),
#[prost(message, tag = "950")]
SoftmaxNd(super::SoftmaxNdLayerParams),
#[prost(message, tag = "952")]
GatherAlongAxis(super::GatherAlongAxisLayerParams),
#[prost(message, tag = "954")]
ScatterAlongAxis(super::ScatterAlongAxisLayerParams),
#[prost(message, tag = "960")]
Reverse(super::ReverseLayerParams),
#[prost(message, tag = "965")]
ReverseSeq(super::ReverseSeqLayerParams),
#[prost(message, tag = "975")]
SplitNd(super::SplitNdLayerParams),
#[prost(message, tag = "980")]
ConcatNd(super::ConcatNdLayerParams),
#[prost(message, tag = "985")]
Transpose(super::TransposeLayerParams),
#[prost(message, tag = "995")]
SliceStatic(super::SliceStaticLayerParams),
#[prost(message, tag = "1000")]
SliceDynamic(super::SliceDynamicLayerParams),
#[prost(message, tag = "1005")]
SlidingWindows(super::SlidingWindowsLayerParams),
#[prost(message, tag = "1015")]
TopK(super::TopKLayerParams),
#[prost(message, tag = "1020")]
ArgMin(super::ArgMinLayerParams),
#[prost(message, tag = "1025")]
ArgMax(super::ArgMaxLayerParams),
#[prost(message, tag = "1040")]
EmbeddingNd(super::EmbeddingNdLayerParams),
#[prost(message, tag = "1045")]
BatchedMatmul(super::BatchedMatMulLayerParams),
/// Tensor Allocation / Reshape-related Operations
#[prost(message, tag = "1065")]
GetShape(super::GetShapeLayerParams),
#[prost(message, tag = "1070")]
LoadConstantNd(super::LoadConstantNdLayerParams),
#[prost(message, tag = "1080")]
FillLike(super::FillLikeLayerParams),
#[prost(message, tag = "1085")]
FillStatic(super::FillStaticLayerParams),
#[prost(message, tag = "1090")]
FillDynamic(super::FillDynamicLayerParams),
#[prost(message, tag = "1100")]
BroadcastToLike(super::BroadcastToLikeLayerParams),
#[prost(message, tag = "1105")]
BroadcastToStatic(super::BroadcastToStaticLayerParams),
#[prost(message, tag = "1110")]
BroadcastToDynamic(super::BroadcastToDynamicLayerParams),
#[prost(message, tag = "1120")]
Squeeze(super::SqueezeLayerParams),
#[prost(message, tag = "1125")]
ExpandDims(super::ExpandDimsLayerParams),
#[prost(message, tag = "1130")]
FlattenTo2D(super::FlattenTo2DLayerParams),
#[prost(message, tag = "1135")]
ReshapeLike(super::ReshapeLikeLayerParams),
#[prost(message, tag = "1140")]
ReshapeStatic(super::ReshapeStaticLayerParams),
#[prost(message, tag = "1145")]
ReshapeDynamic(super::ReshapeDynamicLayerParams),
#[prost(message, tag = "1150")]
RankPreservingReshape(super::RankPreservingReshapeLayerParams),
#[prost(message, tag = "1155")]
ConstantPad(super::ConstantPaddingLayerParams),
/// Random Distributions
#[prost(message, tag = "1170")]
RandomNormalLike(super::RandomNormalLikeLayerParams),
#[prost(message, tag = "1175")]
RandomNormalStatic(super::RandomNormalStaticLayerParams),
#[prost(message, tag = "1180")]
RandomNormalDynamic(super::RandomNormalDynamicLayerParams),
#[prost(message, tag = "1190")]
RandomUniformLike(super::RandomUniformLikeLayerParams),
#[prost(message, tag = "1195")]
RandomUniformStatic(super::RandomUniformStaticLayerParams),
#[prost(message, tag = "1200")]
RandomUniformDynamic(super::RandomUniformDynamicLayerParams),
#[prost(message, tag = "1210")]
RandomBernoulliLike(super::RandomBernoulliLikeLayerParams),
#[prost(message, tag = "1215")]
RandomBernoulliStatic(super::RandomBernoulliStaticLayerParams),
#[prost(message, tag = "1220")]
RandomBernoulliDynamic(super::RandomBernoulliDynamicLayerParams),
#[prost(message, tag = "1230")]
CategoricalDistribution(super::CategoricalDistributionLayerParams),
/// Reduction-related Layers:
#[prost(message, tag = "1250")]
ReduceL1(super::ReduceL1LayerParams),
#[prost(message, tag = "1255")]
ReduceL2(super::ReduceL2LayerParams),
#[prost(message, tag = "1260")]
ReduceMax(super::ReduceMaxLayerParams),
#[prost(message, tag = "1265")]
ReduceMin(super::ReduceMinLayerParams),
#[prost(message, tag = "1270")]
ReduceSum(super::ReduceSumLayerParams),
#[prost(message, tag = "1275")]
ReduceProd(super::ReduceProdLayerParams),
#[prost(message, tag = "1280")]
ReduceMean(super::ReduceMeanLayerParams),
#[prost(message, tag = "1285")]
ReduceLogSum(super::ReduceLogSumLayerParams),
#[prost(message, tag = "1290")]
ReduceSumSquare(super::ReduceSumSquareLayerParams),
#[prost(message, tag = "1295")]
ReduceLogSumExp(super::ReduceLogSumExpLayerParams),
/// Masking / Selection Layers
#[prost(message, tag = "1313")]
WhereNonZero(super::WhereNonZeroLayerParams),
#[prost(message, tag = "1315")]
MatrixBandPart(super::MatrixBandPartLayerParams),
#[prost(message, tag = "1320")]
LowerTriangular(super::LowerTriangularLayerParams),
#[prost(message, tag = "1325")]
UpperTriangular(super::UpperTriangularLayerParams),
#[prost(message, tag = "1330")]
WhereBroadcastable(super::WhereBroadcastableLayerParams),
/// Normalization Layers
#[prost(message, tag = "1350")]
LayerNormalization(super::LayerNormalizationLayerParams),
#[prost(message, tag = "1400")]
NonMaximumSuppression(super::NonMaximumSuppressionLayerParams),
/// Following layers are available only after Core ML Specification
/// version >= 5 (iOS >= 14, macOS >= 11.0)
#[prost(message, tag = "1450")]
OneHot(super::OneHotLayerParams),
#[prost(message, tag = "1455")]
CumSum(super::CumSumLayerParams),
#[prost(message, tag = "1460")]
ClampedReLu(super::ClampedReLuLayerParams),
#[prost(message, tag = "1461")]
ArgSort(super::ArgSortLayerParams),
#[prost(message, tag = "1465")]
Pooling3d(super::Pooling3DLayerParams),
#[prost(message, tag = "1466")]
GlobalPooling3d(super::GlobalPooling3DLayerParams),
#[prost(message, tag = "1470")]
SliceBySize(super::SliceBySizeLayerParams),
#[prost(message, tag = "1471")]
Convolution3d(super::Convolution3DLayerParams),
}
}
///
/// Branching Layer
///
/// A layer that provides the functionality of branching or an If-Else block.
///
/// Must have 1 input. There are no outputs as the execution is transferred to either the
/// if or the else branch based on the value of the input.
///
/// Input is the condition predicate. Must be a scalar (length 1 tensor).
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BranchLayerParams {
///
/// execute this graph if the absolute value of the input Tensor is greater than 1e-6
/// This must be present.
#[prost(message, optional, tag = "1")]
pub if_branch: ::core::option::Option<NeuralNetwork>,
///
/// execute this graph if the absolute value of the input Tensor is less than 1e-6
/// This is optional.
#[prost(message, optional, tag = "2")]
pub else_branch: ::core::option::Option<NeuralNetwork>,
}
///
/// Loop Layer
///
/// A layer that provides the functionality of a "for" loop or a "while" loop.
///
/// There are either no inputs or 1 input. When an input is present, it corresponds to the maximum loop count,
/// in that case the value of the "maxLoopIterations" field is ignored. Input must be a scalar.
/// (For description below, maxLoopIterations is assumed to be the value of the input, when its present)
///
/// No outputs are produced. Blobs produced by the condition or the body network are visible in the scope of the overall network.
///
/// "conditionNetwork" must produce a tensor with the name specified in the "conditionVar" field.
///
/// There are 3 possible cases for determining the termination condition:
///
/// Case 1:
///
/// If there is no "conditionNetwork", in this case the layer corresponds to a pure for loop, which is run "maxLoopIterations" number of times.
/// Equivalent pseudo-code:
///
/// for loopIterator = 0 : maxLoopIterations
/// bodyNetwork()
///
///
/// Case 2:
///
/// "conditionNetwork" is present, and "maxLoopIterations" is 0 and there is no input,
/// in this case the layer corresponds to a while loop. Equivalent pseudo-code:
///
/// conditionVar = conditionNetwork()
/// while conditionVar:
/// bodyNetwork()
/// conditionVar = conditionNetwork()
///
///
/// Case 3:
///
/// "conditionNetwork" is provided, and "maxLoopIterations" is positive or there is an input,
/// in this case the layer corresponds to a while loop with a joint condition. Equivalent pseudo-code:
///
/// loopIterator = 0
/// conditionVar = conditionNetwork()
/// while (conditionVar and loopIterator < maxLoopIterations):
/// bodyNetwork()
/// loopIterator = loopIterator + 1
/// conditionVar = conditionNetwork()
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LoopLayerParams {
///
/// maximum number of iterations. Ignored if input is present.
#[prost(uint64, tag = "1")]
pub max_loop_iterations: u64,
///
/// This field provides the name of the tensor which is produced by the conditionNetwork
/// and whose value is checked to start/continue/terminate the loop. Value close to 0.0f is treated as False.
/// This field is optional.
/// Must be a non empty string if and only if "conditionNetwork" is present.
#[prost(string, tag = "2")]
pub condition_var: ::prost::alloc::string::String,
///
/// Must generate a tensor with the name provided in the "conditionVar" field.
/// This field is optional.
/// Must be present if and only if "conditionVar" field is a non empty string.
#[prost(message, optional, tag = "3")]
pub condition_network: ::core::option::Option<NeuralNetwork>,
///
/// Body of the loop.
/// This field must be present.
#[prost(message, optional, tag = "4")]
pub body_network: ::core::option::Option<NeuralNetwork>,
}
///
/// Loop break Layer
///
/// Terminate the loop that has this layer.
/// If present, it should always reside in the "bodyNetwork" of the loop layer
///
/// No inputs/outputs
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LoopBreakLayerParams {}
///
/// Loop Continue Layer
///
/// Stop the current loop iteration and continue on the next iteration.
/// If present, it should always reside in the "bodyNetwork" of the loop layer
///
/// No inputs/outputs
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LoopContinueLayerParams {}
///
/// Copy Layer
///
/// A layer that copies its input tensor to the output tensor.
/// Must have 1 input and 1 output, with distinct names.
/// 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,
/// in which case it will overwrite the output tensor.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CopyLayerParams {}
///
/// GreaterThan Layer
///
/// Either 1 or 2 inputs.
/// Produces 1 output.
/// Perform elementwise greater than operation.
///
/// Output is 1.0f if the condition is true otherwise 0.0f.
///
/// .. code::
///
/// y = x1 > x2
/// or
/// y = x1 > alpha, if only one input is provided
///
/// Broadcasting is supported.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GreaterThanLayerParams {
///
/// Compare to the scalar value provided here if there is 1 input
#[prost(float, tag = "2")]
pub alpha: f32,
}
///
/// GreaterEqual Layer
///
/// Either 1 or 2 inputs.
/// Produces 1 output.
/// Perform elementwise greater equal operation.
///
/// Output is 1.0f if the condition is true otherwise 0.0f.
///
/// .. code::
///
/// y = x1 >= x2
/// or
/// y = x1 >= alpha, if only one input is provided
///
/// Broadcasting is supported.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GreaterEqualLayerParams {
///
/// Compare to the scalar value provided here if there is 1 input
#[prost(float, tag = "2")]
pub alpha: f32,
}
///
/// LessThan Layer
///
/// Either 1 or 2 inputs.
/// Produces 1 output.
/// Perform elementwise less than operation.
///
/// Output is 1.0f if the condition is true otherwise 0.0f.
///
/// .. code::
///
/// y = x1 < x2
/// or
/// y = x1 < alpha, if only one input is provided
///
/// Broadcasting is supported.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LessThanLayerParams {
///
/// Compare to the scalar value provided here if there is 1 input
#[prost(float, tag = "2")]
pub alpha: f32,
}
///
/// LessEqual Layer
///
/// Either 1 or 2 inputs.
/// Produces 1 output.
/// Perform elementwise less equal operation.
///
/// Output is 1.0f if the condition is true otherwise 0.0f.
///
/// .. code::
///
/// y = x1 <= x2
/// or
/// y = x1 <= alpha, if only one input is provided
///
/// Broadcasting is supported.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LessEqualLayerParams {
///
/// Compare to the scalar value provided here if there is 1 input
#[prost(float, tag = "2")]
pub alpha: f32,
}
///
/// Equal Layer
///
/// Either 1 or 2 inputs.
/// Produces 1 output.
/// Perform elementwise equal operation.
///
/// Output is 1.0f if the condition is true otherwise 0.0f.
///
/// .. code::
///
/// y = x1 == x2
/// or
/// y = x1 == alpha, if only one input is provided
///
/// Broadcasting is supported.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct EqualLayerParams {
///
/// Compare to the scalar value provided here if there is 1 input
#[prost(float, tag = "1")]
pub alpha: f32,
}
///
/// NotEqual Layer
///
/// Either 1 or 2 inputs.
/// Produces 1 output.
/// Perform elementwise not equal operation.
///
/// Output is 1.0f if the condition is true otherwise 0.0f.
///
/// .. code::
///
/// y = x1 != x2
/// or
/// y = x1 != alpha, if only one input is provided
///
/// Broadcasting is supported.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct NotEqualLayerParams {
///
/// Compare to the scalar value provided here if there is 1 input
#[prost(float, tag = "1")]
pub alpha: f32,
}
///
/// LogicalAnd Layer
///
/// Must have 2 inputs, produces 1 output.
/// Perform elementwise logical AND operation.
///
/// Input is considered False if equal to 0.0f otherwise True.
/// Output is 1.0f if the condition is true otherwise 0.0f.
///
/// .. code::
///
/// y = AND(x1, x2)
///
/// Broadcasting is supported.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LogicalAndLayerParams {}
///
/// LogicalOr Layer
///
/// Must have 2 inputs, produces 1 output.
/// Perform elementwise logical OR operation.
///
/// Input is considered False if equal to 0.0f otherwise True.
/// Output is 1.0f if the condition is true otherwise 0.0f.
///
/// .. code::
///
/// y = OR(x1, x2)
///
/// Broadcasting is supported.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LogicalOrLayerParams {}
///
/// LogicalXor Layer
///
/// Must have 2 inputs, produces 1 output.
/// Perform elementwise logical XOR operation.
///
/// Input is considered False if equal to 0.0f otherwise True.
/// Output is 1.0f if the condition is true otherwise 0.0f.
///
/// .. code::
///
/// y = XOR(x1, x2)
///
/// Broadcasting is supported.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LogicalXorLayerParams {}
///
/// LogicalNot Layer
///
/// Must have 1 input, produces 1 output.
/// Perform elementwise logical NOT operation.
///
/// Input is considered False if equal to 0.0f otherwise True.
/// Output is 1.0f if the condition is true otherwise 0.0f.
///
/// .. code::
///
/// y = NOT(x)
///
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LogicalNotLayerParams {}
///
/// Specifies the amount of spatial border to be either padded or cropped.
///
/// For padding:
///
/// .. code::
///
/// H_out = borderAmounts\[0\].startEdgeSize + H_in + borderAmounts\[0\].endEdgeSize
/// W_out = borderAmounts\[1\].startEdgeSize + W_in + borderAmounts\[1\].endEdgeSize
///
/// topPaddingAmount == Height startEdgeSize
/// bottomPaddingAmount == Height endEdgeSize
/// leftPaddingAmount == Width startEdgeSize
/// rightPaddingAmount == Width endEdgeSize
///
/// For cropping:
///
/// .. code::
///
/// H_out = (-borderAmounts\[0\].startEdgeSize) + H_in + (-borderAmounts\[0\].endEdgeSize)
/// W_out = (-borderAmounts\[1\].startEdgeSize) + W_in + (-borderAmounts\[1\].endEdgeSize)
///
/// topCropAmount == Height startEdgeSize
/// bottomCropAmount == Height endEdgeSize
/// leftCropAmount == Width startEdgeSize
/// rightCropAmount == Width endEdgeSize
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BorderAmounts {
///
/// The border amounts.
/// This must be length 2 in the order ``\[H, W\]``.
#[prost(message, repeated, tag = "10")]
pub border_amounts: ::prost::alloc::vec::Vec<border_amounts::EdgeSizes>,
}
/// Nested message and enum types in `BorderAmounts`.
pub mod border_amounts {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct EdgeSizes {
///
/// The amount to be padded or cropped from the beginning.
#[prost(uint64, tag = "1")]
pub start_edge_size: u64,
///
/// The amount to be padded or cropped from the end.
#[prost(uint64, tag = "2")]
pub end_edge_size: u64,
}
}
///
/// Specifies the type of padding to be used with Convolution/Deconvolution and Pooling layers.
/// After padding, input spatial shape: ``\[H_in, W_in\]``, gets modified to the
/// output spatial shape ``\[H_out, W_out\]``.
///
/// .. code::
///
/// topPaddingAmount == Height startEdgeSize == borderAmounts\[0\].startEdgeSize
/// bottomPaddingAmount == Height endEdgeSize == borderAmounts\[0\].endEdgeSize
/// leftPaddingAmount == Width startEdgeSize == borderAmounts\[1\].startEdgeSize
/// rightPaddingAmount == Width endEdgeSize == borderAmounts\[1\].endEdgeSize
///
/// With Convolution or Pooling:
///
/// .. code::
///
/// H_out = int_division_round_down((H_in + topPaddingAmount + bottomPaddingAmount - KernelSize\[0\]),stride\[0\]) + 1
///
/// which is same as:
///
/// .. code::
///
/// H_out = int_division_round_up((H_in + topPaddingAmount + bottomPaddingAmount - KernelSize\[0\] + 1),stride\[0\])
///
/// With Deconvolution:
///
/// .. code::
///
/// H_out = (H_in-1) * stride\[0\] + kernelSize\[0\] - (topPaddingAmount + bottomPaddingAmount)
///
///
/// The equivalent expressions hold true for ``W_out`` as well.
///
///
/// By default, the values of ``paddingAmounts`` are set to ``0``,
/// which results in a "true" valid padding.
/// If non-zero values are provided for ``paddingAmounts``,
/// "valid" convolution/pooling is performed within the spatially expanded input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ValidPadding {
#[prost(message, optional, tag = "1")]
pub padding_amounts: ::core::option::Option<BorderAmounts>,
}
///
/// Specifies the type of padding to be used with Convolution/Deconvolution and pooling layers.
/// After padding, input spatial shape: ``\[H_in, W_in\]``, gets modified to the
/// output spatial shape ``\[H_out, W_out\]``.
/// With Convolution or pooling:
///
/// .. code::
///
/// H_out = int_division_round_up(H_in,stride\[0\])
/// W_out = int_division_round_up(W_in,stride\[1\])
///
/// This is achieved by using the following padding amounts:
///
/// .. code::
///
/// totalPaddingHeight = max(0,(H_out-1) * stride\[0\] + KernelSize\[0\] - Hin)
/// totalPaddingWidth = max(0,(W_out-1) * stride\[1\] + KernelSize\[1\] - Win)
///
/// There are two modes of asymmetry:
/// ``BOTTOM_RIGHT_HEAVY``, and ``TOP_LEFT_HEAVY``.
///
/// If the mode is ``BOTTOM_RIGHT_HEAVY``:
///
/// .. code::
///
/// topPaddingAmount = floor(totalPaddingHeight / 2)
/// bottomPaddingAmount = totalPaddingHeight - topPaddingAmount
/// leftPaddingAmount = floor(totalPaddingWidth / 2)
/// rightPaddingAmount = totalPaddingWidth - leftPaddingAmount
///
/// If the mode is ``TOP_LEFT_HEAVY``:
///
/// .. code::
///
/// bottomPaddingAmount = floor(totalPaddingHeight / 2)
/// topPaddingAmount = totalPaddingHeight - bottomPaddingAmount
/// rightPaddingAmount = floor(totalPaddingWidth / 2)
/// leftPaddingAmount = totalPaddingWidth - rightPaddingAmount
///
///
/// With Deconvolution:
///
/// .. code::
///
/// H_out = H_in * stride\[0\]
/// W_out = W_in * stride\[1\]
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SamePadding {
#[prost(enumeration = "same_padding::SamePaddingMode", tag = "1")]
pub asymmetry_mode: i32,
}
/// Nested message and enum types in `SamePadding`.
pub mod same_padding {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum SamePaddingMode {
BottomRightHeavy = 0,
TopLeftHeavy = 1,
}
impl SamePaddingMode {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::BottomRightHeavy => "BOTTOM_RIGHT_HEAVY",
Self::TopLeftHeavy => "TOP_LEFT_HEAVY",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"BOTTOM_RIGHT_HEAVY" => Some(Self::BottomRightHeavy),
"TOP_LEFT_HEAVY" => Some(Self::TopLeftHeavy),
_ => None,
}
}
}
}
///
/// Specifies how grid points are sampled from an interval.
/// Without the loss of generality, assume the interval to be \[0, X-1\] from which N points are to be sampled.
/// Here X may correspond to an input image's height or width.
/// 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\].
/// Note: numpy.linspace(start = start, end = end, num = N, endpoint = True) corresponds to sampling
/// N points uniformly from the interval \[start, end\], endpoints included.
/// The methods vary in how the ``start`` and ``end`` values are computed.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SamplingMode {
#[prost(enumeration = "sampling_mode::Method", tag = "1")]
pub sampling_method: i32,
}
/// Nested message and enum types in `SamplingMode`.
pub mod sampling_mode {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Method {
///
/// start = 0, end = X-1
/// grid points = numpy.linspace(start, end)
StrictAlignEndpointsMode = 0,
///
/// if N == 1: start = end = (X-1)/2
/// otherwise, start = 0, end = X-1
/// grid points = numpy.linspace(start, end)
AlignEndpointsMode = 1,
///
/// start = 0, end = X - X/N
/// grid points = min(X-1, numpy.linspace(start, end))
/// 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.
UpsampleMode = 2,
///
/// spacing = max(1, X-1)/N
/// start = 0.5 * spacing
/// end = start + (N-1) * spacing
/// grid points = min(X-1, numpy.linspace(start, end))
RoiAlignMode = 3,
}
impl Method {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::StrictAlignEndpointsMode => "STRICT_ALIGN_ENDPOINTS_MODE",
Self::AlignEndpointsMode => "ALIGN_ENDPOINTS_MODE",
Self::UpsampleMode => "UPSAMPLE_MODE",
Self::RoiAlignMode => "ROI_ALIGN_MODE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"STRICT_ALIGN_ENDPOINTS_MODE" => Some(Self::StrictAlignEndpointsMode),
"ALIGN_ENDPOINTS_MODE" => Some(Self::AlignEndpointsMode),
"UPSAMPLE_MODE" => Some(Self::UpsampleMode),
"ROI_ALIGN_MODE" => Some(Self::RoiAlignMode),
_ => None,
}
}
}
}
///
/// Specifies the convention used to specify four bounding box coordinates for an image of size (Height, Width).
/// The (0,0) coordinate corresponds to the top-left corner of the image.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BoxCoordinatesMode {
#[prost(enumeration = "box_coordinates_mode::Coordinates", tag = "1")]
pub box_mode: i32,
}
/// Nested message and enum types in `BoxCoordinatesMode`.
pub mod box_coordinates_mode {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Coordinates {
///
/// \[h_start, w_start, h_end, w_end\]
CornersHeightFirst = 0,
///
/// \[w_start, h_start, w_end, h_end\]
CornersWidthFirst = 1,
///
/// \[h_center, w_center, box_height, box_width\]
CenterSizeHeightFirst = 2,
///
/// \[w_center, h_center, box_width, box_height\]
CenterSizeWidthFirst = 3,
}
impl Coordinates {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::CornersHeightFirst => "CORNERS_HEIGHT_FIRST",
Self::CornersWidthFirst => "CORNERS_WIDTH_FIRST",
Self::CenterSizeHeightFirst => "CENTER_SIZE_HEIGHT_FIRST",
Self::CenterSizeWidthFirst => "CENTER_SIZE_WIDTH_FIRST",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CORNERS_HEIGHT_FIRST" => Some(Self::CornersHeightFirst),
"CORNERS_WIDTH_FIRST" => Some(Self::CornersWidthFirst),
"CENTER_SIZE_HEIGHT_FIRST" => Some(Self::CenterSizeHeightFirst),
"CENTER_SIZE_WIDTH_FIRST" => Some(Self::CenterSizeWidthFirst),
_ => None,
}
}
}
}
///
/// Weights for layer parameters.
/// Weights are stored as repeated floating point numbers
/// using row-major ordering
/// and can represent 1-, 2-, 3-, or 4-dimensional data.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WeightParams {
///
/// Values specified in single / float / FP32 precision.
#[prost(float, repeated, tag = "1")]
pub float_value: ::prost::alloc::vec::Vec<f32>,
///
/// Values in 16-bit half precision floating point.
#[prost(bytes = "vec", tag = "2")]
pub float16_value: ::prost::alloc::vec::Vec<u8>,
///
/// Raw value specification for quantized lower precisions.
///
/// This field is interpreted as uintN, where N is the number of bits in quantization.
/// E.g. if n=8, the field is interpreted as an array of UINT8.
/// Use this field for quantized parameters unless specifically noted to use
/// int8RawValue.
#[prost(bytes = "vec", tag = "30")]
pub raw_value: ::prost::alloc::vec::Vec<u8>,
///
/// Field to be used if int8DynamicQuantize is set in the parent layer.
/// Cannot be set if rawValue is also set.
/// The values in this field are interpreted as INT8.
///
/// If this field is set, following conditions must hold true:
/// * QuantizationType == LinearQuantizationParams, such that
/// * size of the "scale" field is 1 and "bias" field is empty in "LinearQuantizationParams"
#[prost(bytes = "vec", tag = "31")]
pub int8_raw_value: ::prost::alloc::vec::Vec<u8>,
///
/// Quantization related parameters.
#[prost(message, optional, tag = "40")]
pub quantization: ::core::option::Option<QuantizationParams>,
#[prost(bool, tag = "50")]
pub is_updatable: bool,
}
///
/// Quantization parameters.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QuantizationParams {
#[prost(uint64, tag = "1")]
pub number_of_bits: u64,
#[prost(oneof = "quantization_params::QuantizationType", tags = "101, 102")]
pub quantization_type: ::core::option::Option<quantization_params::QuantizationType>,
}
/// Nested message and enum types in `QuantizationParams`.
pub mod quantization_params {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum QuantizationType {
#[prost(message, tag = "101")]
LinearQuantization(super::LinearQuantizationParams),
#[prost(message, tag = "102")]
LookupTableQuantization(super::LookUpTableQuantizationParams),
}
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LinearQuantizationParams {
///
/// Stores scale and bias values corresponding to the quantized weights.
/// Must be an array of 1 element, or an array of C elements, where C
/// is number of output channels. For recurrent layers it is equal to
/// the output vector size.
///
/// Relationship between quantized weights, unquantized weights, scale and bias:
///
/// W_unquantized = W_quantized * scale + bias
///
#[prost(float, repeated, tag = "1")]
pub scale: ::prost::alloc::vec::Vec<f32>,
#[prost(float, repeated, tag = "2")]
pub bias: ::prost::alloc::vec::Vec<f32>,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LookUpTableQuantizationParams {
/// Stores look-up table quantization values. Must be an array of
/// (2^numberOfBits) Elements.
#[prost(float, repeated, tag = "1")]
pub float_value: ::prost::alloc::vec::Vec<f32>,
}
///
/// A layer that performs spatial convolution or deconvolution.
///
/// .. code::
///
/// y = ConvolutionLayer(x)
///
/// Requires 1 or 2 inputs and produces 1 output.
///
/// Input
/// First Input:
/// A blob with rank greater than or equal to 4.
/// Rank 4 blob represents \[Batch, channels, height, width\].
/// For ranks greater than 4, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
///
/// From Core ML specification version 4 onwards (iOS >= 13, macOS >= 10.15).
/// convolution layer can have 2 inputs, in which case the second input is
/// the blob representing the weights. This is allowed when "isDeconvolution" = False.
/// The weight blob should have shape
/// ``\[outputChannels, kernelChannels, kernelHeight, kernelWidth\]``,
/// where kernelChannels == inputChannels / nGroups.
///
/// Output
/// Rank is same as the input. e.g.: for rank 4 input, output shape is \[B, C_out, H_out, W_out\]
///
///
/// If ``dilationFactor`` is not 1, effective kernel size is
/// modified as follows:
///
/// .. code::
///
/// KernelSize\[0\] <-- (kernelSize\[0\]-1) * dilationFactor\[0\] + 1
/// KernelSize\[1\] <-- (kernelSize\[1\]-1) * dilationFactor\[1\] + 1
///
/// Type of padding can be ``valid`` or ``same``. Output spatial dimensions depend on the
/// the type of padding. For details, refer to the descriptions of the messages "ValidPadding"
/// and "SamePadding". Padded values are all zeros.
///
/// For Deconvolution, ``ConvolutionPaddingType`` (``valid`` or ``same``) is ignored when ``outputShape`` is set.
///
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConvolutionLayerParams {
///
/// The number of kernels.
/// Same as ``C_out`` used in the layer description.
#[prost(uint64, tag = "1")]
pub output_channels: u64,
///
/// Channel dimension of the kernels.
/// Must be equal to ``inputChannels / nGroups``, if isDeconvolution == False
/// Must be equal to ``inputChannels``, if isDeconvolution == True
#[prost(uint64, tag = "2")]
pub kernel_channels: u64,
///
/// Group convolution, i.e. weight reuse along channel axis.
/// Input and kernels are divided into g groups
/// and convolution / deconvolution is applied within the groups independently.
/// If not set or 0, it is set to the default value 1.
#[prost(uint64, tag = "10")]
pub n_groups: u64,
///
/// Must be length 2 in the order ``\[H, W\]``.
/// If not set, default value ``\[3, 3\]`` is used.
#[prost(uint64, repeated, tag = "20")]
pub kernel_size: ::prost::alloc::vec::Vec<u64>,
///
/// Must be length 2 in the order ``\[H, W\]``.
/// If not set, default value ``\[1, 1\]`` is used.
#[prost(uint64, repeated, tag = "30")]
pub stride: ::prost::alloc::vec::Vec<u64>,
///
/// Must be length 2 in order ``\[H, W\]``.
/// If not set, default value ``\[1, 1\]`` is used.
/// It is ignored if ``isDeconvolution == true``.
#[prost(uint64, repeated, tag = "40")]
pub dilation_factor: ::prost::alloc::vec::Vec<u64>,
///
/// Flag to specify whether it is a deconvolution layer.
#[prost(bool, tag = "60")]
pub is_deconvolution: bool,
///
/// Flag to specify whether a bias is to be added or not.
#[prost(bool, tag = "70")]
pub has_bias: bool,
///
/// Weights associated with this layer.
/// If convolution (``isDeconvolution == false``), weights have the shape
/// ``\[outputChannels, kernelChannels, kernelHeight, kernelWidth\]``, where kernelChannels == inputChannels / nGroups
/// If deconvolution (``isDeconvolution == true``) weights have the shape
/// ``\[kernelChannels, outputChannels / nGroups, kernelHeight, kernelWidth\]``, where kernelChannels == inputChannels
#[prost(message, optional, tag = "90")]
pub weights: ::core::option::Option<WeightParams>,
/// Must be of size \[outputChannels\].
#[prost(message, optional, tag = "91")]
pub bias: ::core::option::Option<WeightParams>,
///
/// The output shape, which has length 2 ``\[H_out, W_out\]``.
/// This is used only for deconvolution (``isDeconvolution == true``).
/// If not set, the deconvolution output shape is calculated
/// based on ``ConvolutionPaddingType``.
#[prost(uint64, repeated, tag = "100")]
pub output_shape: ::prost::alloc::vec::Vec<u64>,
///
/// The type of padding.
#[prost(oneof = "convolution_layer_params::ConvolutionPaddingType", tags = "50, 51")]
pub convolution_padding_type: ::core::option::Option<
convolution_layer_params::ConvolutionPaddingType,
>,
}
/// Nested message and enum types in `ConvolutionLayerParams`.
pub mod convolution_layer_params {
///
/// The type of padding.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum ConvolutionPaddingType {
#[prost(message, tag = "50")]
Valid(super::ValidPadding),
#[prost(message, tag = "51")]
Same(super::SamePadding),
}
}
///
/// A layer that performs a 3-dimensional convolution.
///
/// .. code::
///
/// y = Convolution3DLayer(x)
///
/// Input
/// A blob of rank 5.
/// The input blob's shape should be ``\[batch, channels, depth, height, width\]``.
///
/// Fields
/// The bias field, if set, should have shape of ``\[channelsOut\]``.
///
/// Output
/// A blob of rank 5.
/// The output blob's shape is ``\[batch, channelsOut, depthOut, heightOut, widthOut\]``.
///
/// Type of padding can be ``custom``, ``valid``, or ``same``. Padded values are all zeros.
/// Output spatial dimensions depend on the the type of padding. For details, refer to the
/// descriptions of the ``PaddingType`` field of this ``Convolution3DLayerParams`` message.
///
/// Example
/// For example, given an input of size ``\[1, 3, 3, 8, 8\]``, a stride of 2 in each dimension,
/// a kernel of 3 in each dimension, 2 output channels, and ``same`` padding, this layer will
/// compute the total padding applied in the depth, height, and width dimensions to be 2, 1, and 1,
/// respectively. The depth padding is even and will be applied equally to both sides of the depth
/// dimension. Since the height and width padding values are odd, they'll be applied to the
/// bottom/right of the height/width dimensions. Thus, the padding applied to the input will be
/// ``\[1, 1, 0, 1, 0, 1\]`` (front, back, top, bottom, left, right). Finally, the output produced
/// will have size ``\[1, 2, 2, 4, 4\]``.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Convolution3DLayerParams {
///
/// The number of channels in the output (channelsOut). Must be a positive integer.
#[prost(int32, tag = "1")]
pub output_channels: i32,
///
/// The number of channels in the input (channels). Must be a positive integer.
#[prost(int32, tag = "2")]
pub input_channels: i32,
///
/// Group convolution, i.e., weight reuse along the channel axis.
/// It must evenly divide both the number of input and output channels and be at most the number
/// of input channels (a depthwise convolution).
/// Input and kernels are divided into g groups and convolution is applied within the groups
/// independently.
#[prost(int32, tag = "10")]
pub n_groups: i32,
/// Depth of the convolution kernel. Must be a positive integer.
#[prost(int32, tag = "20")]
pub kernel_depth: i32,
/// Height of the convolution kernel. Must be a positive integer.
#[prost(int32, tag = "21")]
pub kernel_height: i32,
/// Width of the convolution kernel. Must be a positive integer.
#[prost(int32, tag = "22")]
pub kernel_width: i32,
/// Stride along the depth direction. Must be a positive integer.
#[prost(int32, tag = "31")]
pub stride_depth: i32,
/// Stride along the height direction. Must be a positive integer.
#[prost(int32, tag = "32")]
pub stride_height: i32,
/// Stride along the width direction. Must be a positive integer.
#[prost(int32, tag = "33")]
pub stride_width: i32,
/// Dilation along the depth direction. Must be a positive integer.
#[prost(int32, tag = "40")]
pub dilation_depth: i32,
/// Dilation along the height direction. Must be a positive integer.
#[prost(int32, tag = "41")]
pub dilation_height: i32,
/// Dilation along the width direction. Must be a positive integer.
#[prost(int32, tag = "42")]
pub dilation_width: i32,
///
/// Flag to specify whether a bias is to be added or not.
/// If false, then no bias is added.
#[prost(bool, tag = "50")]
pub has_bias: bool,
///
/// Weights associated with this layer.
/// Weights have the shape
/// if deconvolution == False
/// ``\[outputChannels, kernelChannels, kernelDepth, kernelHeight, kernelWidth\]``, where
/// kernelChannels == inputChannels / nGroups
/// else if deconvolution == True
/// ``\[outputChannels / nGroups, kernelChannels, kernelDepth, kernelHeight, kernelWidth\]``, where
#[prost(message, optional, tag = "60")]
pub weights: ::core::option::Option<WeightParams>,
///
/// Must be of size ``\[outputChannels\]``.
#[prost(message, optional, tag = "61")]
pub bias: ::core::option::Option<WeightParams>,
#[prost(enumeration = "convolution3_d_layer_params::PaddingType", tag = "70")]
pub padding_type: i32,
/// Padding before the input in the depth direction. Must be zero or a positive integer.
/// Used when the `PaddingType` is `CustomPadding`, otherwise ignored by other padding types.
#[prost(int32, tag = "80")]
pub custom_padding_front: i32,
/// Padding after the input in the depth direction. Must be zero or a positive integer.
/// Used when the `PaddingType` is `CustomPadding`, otherwise ignored by other padding types.
#[prost(int32, tag = "81")]
pub custom_padding_back: i32,
/// Padding before the input in the height direction. Must be zero or a positive integer.
/// Used when the `PaddingType` is `CustomPadding`, otherwise ignored by other padding types.
#[prost(int32, tag = "82")]
pub custom_padding_top: i32,
/// Padding after the input in the height direction. Must be zero or a positive integer.
/// Used when the `PaddingType` is `CustomPadding`, otherwise ignored by other padding types.
#[prost(int32, tag = "83")]
pub custom_padding_bottom: i32,
/// Padding before the input in the width direction. Must be zero or a positive integer.
/// Used when the `PaddingType` is `CustomPadding`, otherwise ignored by other padding types.
#[prost(int32, tag = "84")]
pub custom_padding_left: i32,
/// Padding after the input in the width direction. Must be zero or a positive integer.
/// Used when the `PaddingType` is `CustomPadding`, otherwise ignored by other padding types.
#[prost(int32, tag = "85")]
pub custom_padding_right: i32,
/// Flag to specify if this is Convolution Transpose or not.
#[prost(bool, tag = "86")]
pub is_deconvolution: bool,
///
/// The output shape, which has length 3 ``\[D_out, H_out, W_out\]``.
/// This is used only for deconvolution (``isDeconvolution == true``).
/// If not set, the deconvolution output shape is calculated
/// based on ``PaddingType``.
#[prost(uint64, repeated, tag = "87")]
pub output_shape: ::prost::alloc::vec::Vec<u64>,
}
/// Nested message and enum types in `Convolution3DLayerParams`.
pub mod convolution3_d_layer_params {
///
/// The type of padding.
/// All padding types pad the input shape with zeros.
/// CUSTOM padding will add the custom padding values specified below to their respective
/// dimensions, e.g., `customPaddingFront` number of zeros will be added to one side of the
/// input's depth dimension and `customPaddingBack` number of zeros will be added to the other
/// side of the input's depth dimension.
/// VALID padding adds no padding to any dimension. In this case, the last convolution along
/// each dimension will be dropped if the input dimension and the kernel size, stride, and
/// dilation do not match.
/// SAME padding adds enough padding to each dimension such that the output of the convolution
/// has size ``Ceiling(inputShape / stride)``. Padding is added evenly to both sides of each
/// dimension unless the total padding to add is odd, in which case it is added to the
/// back/bottom/right side of the respective dimension. For example, if the total padding needed
/// in the depth dimension is 3, 1 zero will be added to the front side of the depth dimension
/// and 2 zeros will be added to the back side.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum PaddingType {
Custom = 0,
Valid = 1,
Same = 2,
}
impl PaddingType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Custom => "CUSTOM",
Self::Valid => "VALID",
Self::Same => "SAME",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CUSTOM" => Some(Self::Custom),
"VALID" => Some(Self::Valid),
"SAME" => Some(Self::Same),
_ => None,
}
}
}
}
///
/// A layer that performs a matrix-vector or matrix-matrix product.
/// This is equivalent to a fully-connected, or dense layer.
/// The weight parameters correspond to a matrix of dimensions (inputChannels, outputChannels) i.e. (C_in, C_out)
///
/// .. code::
///
/// y = InnerProductLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// Input can have rank 1 to rank 5. This is how it is reshaped in to the matrix (for rank > 1):
/// rank 1 (x1) : in this case, the layer corresponds to a matrix-vector product. x1 must be equal to C_in
/// rank 2 (x1, x2): x2 must be equal to C_in
/// rank 3 (x1, x2, x3) --> (x1 * x2, x3). x3 must be equal to C_in
/// rank 4 (x1, x2, x3, x4) ---> (x1, x2 * x3 * x4). x2 * x3 * x4 must be equal to C_in
/// rank 5 (x1, x2, x3, x4, x5) ---> (x1 * x2, x3 * x4 * x5). x3 * x4 * x5 must be equal to C_in
///
/// Output
/// Output rank is same as the input rank
/// rank 1: (C_out)
/// rank 2: (x1, C_out)
/// rank 3: (x1, x2, C_out)
/// rank 4: (x1, C_out, 1, 1)
/// rank 5: (x1, x2, C_out, 1, 1)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InnerProductLayerParams {
/// Input size: C_in.
#[prost(uint64, tag = "1")]
pub input_channels: u64,
/// Output size: C_out.
#[prost(uint64, tag = "2")]
pub output_channels: u64,
/// Whether a bias is added or not.
#[prost(bool, tag = "10")]
pub has_bias: bool,
/// Weight matrix \[C_out, C_in\].
#[prost(message, optional, tag = "20")]
pub weights: ::core::option::Option<WeightParams>,
/// Bias vector \[C_out\].
#[prost(message, optional, tag = "21")]
pub bias: ::core::option::Option<WeightParams>,
///
/// If set, this layer, at runtime, quantizes the floating point input blob to int8 before applying an
/// inner product using INT8 weight matrix parameters, as provided in weights->int8RawValue. The
/// result is then dequantized.
/// Requires:
/// * hasBias == false
/// * QuantizationType == LinearQuantizationParams, such that
/// * size of the "scale" field is 1 and "bias" field is empty in "LinearQuantizationParams"
/// * numberOfBits == 8
/// * weights->rawValue_size to be empty
#[prost(bool, tag = "22")]
pub int8_dynamic_quantize: bool,
}
///
/// A layer that performs a matrix lookup and optionally adds a bias.
/// The weights matrix is stored with dimensions \[outputChannels, inputDim\].
///
/// .. code::
///
/// y = EmbeddingLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// Input values must be in the range ``\[0, inputDim - 1\]``.
///
/// Input must have rank equal to 4 or 5, such that the last 3 dimensions are all 1.
/// rank 4: shape (x1, 1, 1, 1). x1 is effectively the batch/sequence length.
/// rank 5: shape (x1, x2 , 1, 1, 1). x1 * x2 is effectively the combined batch/sequence length.
///
/// Output
/// Output rank is same as the input rank. Please see input description above.
/// rank 4: shape (x1, outputChannels, 1, 1)
/// rank 5: shape (x1, x2, outputChannels, 1, 1)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EmbeddingLayerParams {
/// Size of the input dictionary.
#[prost(uint64, tag = "1")]
pub input_dim: u64,
/// Size of the output vectors.
#[prost(uint64, tag = "2")]
pub output_channels: u64,
/// Whether a bias is added or not.
#[prost(bool, tag = "10")]
pub has_bias: bool,
/// 2-D weights of dimensions \[outputChannels, inputDim\].
#[prost(message, optional, tag = "20")]
pub weights: ::core::option::Option<WeightParams>,
/// Bias of size \[outputChannels\].
#[prost(message, optional, tag = "21")]
pub bias: ::core::option::Option<WeightParams>,
}
///
/// A layer that performs a matrix lookup and optionally adds a bias.
/// The weights matrix is stored with dimensions \[embeddingSize, vocabSize\].
///
/// .. code::
///
/// y = EmbeddingNDLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// Input values must be in the range ``\[0, vocabSize - 1\]``.
/// Input must have rank at least 2. The last dimension must always be 1.
/// rank 2: shape (x1, 1). x1 is the batch/sequence length.
/// rank 3: shape (x1, x2, 1). x1 * x2 is effectively the combined batch/sequence length.
/// rank 4: shape (x1, x2, x3, 1). x1 * x2 * x2 is effectively the combined batch/sequence length.
/// rank 5: shape (x1, x2 , x3, x4, 1). x1 * x2 * x3 * x4 is effectively the combined batch/sequence length.
///
/// Output
/// Output rank is same as the input rank. Please see input description above.
/// rank 2: shape (x1, embeddingSize)
/// rank 3: shape (x1, x2, embeddingSize)
/// rank 4: shape (x1, x2, x3, embeddingSize)
/// rank 5: shape (x1, x2, x3, x4, embeddingSize)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EmbeddingNdLayerParams {
/// Size of the input dictionary.
#[prost(uint64, tag = "1")]
pub vocab_size: u64,
/// Size of the output vectors.
#[prost(uint64, tag = "2")]
pub embedding_size: u64,
/// Whether a bias is added or not.
#[prost(bool, tag = "3")]
pub has_bias: bool,
/// 2-D weights of dimensions \[embeddingSize, vocabSize\].
#[prost(message, optional, tag = "20")]
pub weights: ::core::option::Option<WeightParams>,
/// Bias of size \[embeddingSize\].
#[prost(message, optional, tag = "21")]
pub bias: ::core::option::Option<WeightParams>,
}
///
/// A layer that performs batch normalization,
/// which is performed along axis = -3,
/// and repeated along the other axes, if present.
///
/// .. code::
///
/// y = BatchnormLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// This operation is described by the following formula:
///
/// .. math::
/// y_i = \gamma_i \dfrac{ (x_i - \mu_i)}{\sqrt{\sigma_i^2 + \epsilon}} + \beta_i \;,\;i=1,....,C
///
/// Input
/// A blob with rank greater than equal to 3.
/// Example: Rank 4 blob represents \[Batch, channels, height, width\]
/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
///
/// Output
/// A blob with the same shape as the input.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchnormLayerParams {
/// Size of the channel dimension in the input.
#[prost(uint64, tag = "1")]
pub channels: u64,
///
/// If ``computeMeanVar == true``,
/// the mean and variance are calculated from either
/// the single input instance, if ``instanceNormalization == true``,
/// or the whole batch, if ``instanceNormalization = false``.
/// and the values provided in parameters "mean" and "variance" are ignored.
#[prost(bool, tag = "5")]
pub compute_mean_var: bool,
#[prost(bool, tag = "6")]
pub instance_normalization: bool,
///
/// A small constant to avoid division by 0 while normalizing by variance.
/// Defaults to ``1e-5`` if not set or set to ``0``.
#[prost(float, tag = "10")]
pub epsilon: f32,
/// Parameter of length \[channels\]
#[prost(message, optional, tag = "15")]
pub gamma: ::core::option::Option<WeightParams>,
/// Parameter of length \[channels\]
#[prost(message, optional, tag = "16")]
pub beta: ::core::option::Option<WeightParams>,
/// Parameter of length \[channels\]
#[prost(message, optional, tag = "17")]
pub mean: ::core::option::Option<WeightParams>,
/// Parameter of length \[channels\]
#[prost(message, optional, tag = "18")]
pub variance: ::core::option::Option<WeightParams>,
}
///
/// A spatial pooling layer.
///
/// .. code::
///
/// y = PoolingLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with rank greater than equal to 4.
/// Rank 4 blob represents \[Batch, channels, height, width\]
/// For ranks greater than 4, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
///
/// Output
/// Rank is same as the input. e.g.: for rank 4 input, output shape is \[B, C, H_out, W_out\]
///
/// Padding options are similar to ``ConvolutionLayerParams``
/// with the additional option of ``ValidCompletePadding`` (``includeLastPixel``),
/// which ensures that the last application of the kernel
/// always includes the last pixel of the input image, if there is padding.
///
/// .. code::
///
/// H_out = ceil(float(H_in + 2 * paddingAmounts\[0\] - kernelSize\[0\])/float(Stride\[0\])) + 1
/// if (paddingAmounts\[0\] > 0 or paddingAmounts\[1\] > 0)
/// if ((H_out - 1) * Stride >= H_in + paddingAmounts\[0\]) {
/// H_out = H_out - 1
/// }
/// }
///
/// The equivalent expressions hold true for ``W_out`` as well.
/// Only symmetric padding is supported with this option.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PoolingLayerParams {
/// Type of pooling operation.
#[prost(enumeration = "pooling_layer_params::PoolingType", tag = "1")]
pub r#type: i32,
///
/// Must be length 2 in the order ``\[H, W\]``.
/// If not set, default value ``\[3, 3\]`` is used.
#[prost(uint64, repeated, tag = "10")]
pub kernel_size: ::prost::alloc::vec::Vec<u64>,
///
/// Must be length 2 in the order ``\[H, W\]``.
/// If not set, default value ``\[1, 1\]`` is used.
#[prost(uint64, repeated, tag = "20")]
pub stride: ::prost::alloc::vec::Vec<u64>,
///
/// If true, padded values are excluded from the count (denominator)
/// when computing average pooling.
#[prost(bool, tag = "50")]
pub avg_pool_exclude_padding: bool,
///
/// If true, global pooling is performed.
/// Kernel size is inferred from the input data spatial dimensions.
#[prost(bool, tag = "60")]
pub global_pooling: bool,
#[prost(oneof = "pooling_layer_params::PoolingPaddingType", tags = "30, 31, 32")]
pub pooling_padding_type: ::core::option::Option<
pooling_layer_params::PoolingPaddingType,
>,
}
/// Nested message and enum types in `PoolingLayerParams`.
pub mod pooling_layer_params {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ValidCompletePadding {
///
/// Must be length 2 in order ``\[H, W\]``.
/// If not set, value ``\[0, 0\]`` is used.
#[prost(uint64, repeated, tag = "10")]
pub padding_amounts: ::prost::alloc::vec::Vec<u64>,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum PoolingType {
Max = 0,
Average = 1,
L2 = 2,
}
impl PoolingType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Max => "MAX",
Self::Average => "AVERAGE",
Self::L2 => "L2",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"MAX" => Some(Self::Max),
"AVERAGE" => Some(Self::Average),
"L2" => Some(Self::L2),
_ => None,
}
}
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum PoolingPaddingType {
#[prost(message, tag = "30")]
Valid(super::ValidPadding),
#[prost(message, tag = "31")]
Same(super::SamePadding),
#[prost(message, tag = "32")]
IncludeLastPixel(ValidCompletePadding),
}
}
///
/// A layer to pool three spatial dimensions
///
/// Input
/// A blob with rank equal to 5, representing \[Batch, channels, depth, height, width\].
///
/// Output
/// Rank is same as the input: A blob with rank equal to 5, representing \[Batch, channels, depth, height, width\].
///
/// Requires 1 input and produces 1 output.
///
/// For example, given an input of shape (1,1,2,3,3):
/// +----+----+----+
/// / | 10 | 11 | 12 |
/// / +----+----+----+
/// / | 13 | 14 | 15 |
/// / +----+----+----+
/// / | 16 | 17 | 18 |
/// / +----+----+----+
/// +----+----+----+ /
/// | 1 | 2 | 3 | /
/// +----+----+----+ /
/// | 4 | 5 | 6 | /
/// +----+----+----+ /
/// | 7 | 8 | 9 | /
/// +----+----+----+
///
/// And applying MAX pooling using:
/// Kernel: 2x2x2
/// Stride: 1x1x1
/// Valid Padding
/// We expect to get an output with shape: (1,1,1,2,2) and value:
/// +----+----+
/// | 14 | 15 |
/// +----+----+
/// | 17 | 18 |
/// +----+----+
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Pooling3DLayerParams {
/// Whether to use Max or Average
#[prost(enumeration = "pooling3_d_layer_params::PoolingType3D", tag = "1")]
pub r#type: i32,
/// Depth of the pooling region.
#[prost(int32, tag = "2")]
pub kernel_depth: i32,
/// Height of the pooling region.
#[prost(int32, tag = "3")]
pub kernel_height: i32,
/// Width of the pooling region.
#[prost(int32, tag = "4")]
pub kernel_width: i32,
/// Stride along the depth direction
#[prost(int32, tag = "5")]
pub stride_depth: i32,
/// Stride along the height direction
#[prost(int32, tag = "6")]
pub stride_height: i32,
/// Stride along the width direction
#[prost(int32, tag = "7")]
pub stride_width: i32,
#[prost(enumeration = "pooling3_d_layer_params::Pooling3DPaddingType", tag = "15")]
pub padding_type: i32,
/// Padding before the input in the depth direction.
#[prost(int32, tag = "8")]
pub custom_padding_front: i32,
/// Padding after the input in the depth direction.
#[prost(int32, tag = "9")]
pub custom_padding_back: i32,
/// Padding before the input in the height direction.
#[prost(int32, tag = "10")]
pub custom_padding_top: i32,
/// Padding after the input in the height direction.
#[prost(int32, tag = "11")]
pub custom_padding_bottom: i32,
/// Padding before the input in the width direction.
#[prost(int32, tag = "12")]
pub custom_padding_left: i32,
/// Padding after the input in the width direction.
#[prost(int32, tag = "13")]
pub custom_padding_right: i32,
/// If true, exclude zeros from padding in Average pooling. Meaningless in Max Pooling.
#[prost(bool, tag = "14")]
pub count_exclude_padding: bool,
}
/// Nested message and enum types in `Pooling3DLayerParams`.
pub mod pooling3_d_layer_params {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum PoolingType3D {
Max = 0,
Average = 1,
}
impl PoolingType3D {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Max => "MAX",
Self::Average => "AVERAGE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"MAX" => Some(Self::Max),
"AVERAGE" => Some(Self::Average),
_ => None,
}
}
}
///
/// The type of padding.
/// All padding types pad the input shape with zeros.
/// CUSTOM padding will add the custom padding values specified below to their respective
/// dimensions, e.g., `customPaddingFront` number of zeros will be added to one side of the
/// input's depth dimension and `customPaddingBack` number of zeros will be added to the other
/// side of the input's depth dimension.
/// VALID padding adds no padding to any dimension. In this case, the last pool along
/// each dimension will be dropped if the input dimension and the kernel size, and stride do not match.
/// SAME padding adds enough padding to each dimension such that the output
/// has the same spatial dimensions as the input. Padding is added evenly to both
/// sides of each dimension unless the total padding to add is odd, in which case the extra padding
/// is added to the back/bottom/right side of the respective dimension. For example, if the the
/// total horizontal padding is 3, then there will be 1 padding on the left, and 2 padding on the right.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Pooling3DPaddingType {
Custom = 0,
Valid = 1,
Same = 2,
}
impl Pooling3DPaddingType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Custom => "CUSTOM",
Self::Valid => "VALID",
Self::Same => "SAME",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CUSTOM" => Some(Self::Custom),
"VALID" => Some(Self::Valid),
"SAME" => Some(Self::Same),
_ => None,
}
}
}
}
///
/// A layer to pool three spatial dimensions down to one value.
/// This behaves like a special case of Pooling3DLayerParams in which
/// the Kernel is the size of the input and there is no padding.
///
/// Input
/// A blob with rank equal to 5, representing \[Batch, channels, depth, height, width\].
///
/// Output
/// Rank is same as the input: A blob with rank equal to 5, representing \[Batch, channels, depth, height, width\].
/// Depth, height, and width of the output will always be 1.
///
/// Requires 1 input and produces 1 output.
///
/// For example, given an input of shape (1,1,2,3,3):
/// +----+----+----+
/// / | 10 | 11 | 12 |
/// / +----+----+----+
/// / | 13 | 14 | 15 |
/// / +----+----+----+
/// / | 16 | 17 | 18 |
/// / +----+----+----+
/// +----+----+----+ /
/// | 1 | 2 | 3 | /
/// +----+----+----+ /
/// | 4 | 5 | 6 | /
/// +----+----+----+ /
/// | 7 | 8 | 9 | /
/// +----+----+----+
///
/// And applying MAX global 3d pooling, we expect to get an output with shape: (1,1,1,1,1) and value:
/// +----+
/// | 18 |
/// +----+
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GlobalPooling3DLayerParams {
/// Whether to use Max or Average
#[prost(
enumeration = "global_pooling3_d_layer_params::GlobalPoolingType3D",
tag = "1"
)]
pub r#type: i32,
}
/// Nested message and enum types in `GlobalPooling3DLayerParams`.
pub mod global_pooling3_d_layer_params {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum GlobalPoolingType3D {
Max = 0,
Average = 1,
}
impl GlobalPoolingType3D {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Max => "MAX",
Self::Average => "AVERAGE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"MAX" => Some(Self::Max),
"AVERAGE" => Some(Self::Average),
_ => None,
}
}
}
}
///
/// A layer that performs padding along spatial dimensions.
///
/// .. code::
///
/// y = PaddingLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with rank at least 2.
/// e.g.: blob with shape ``\[H_in, W_in\]``.
/// For ranks greater than 2, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch
/// i.e. Padding is applied on last two dimensions.
///
/// Output
/// Same rank as the input.
/// e.g.: blob with shape ``\[H_out, W_out\]``.
///
/// Output dimensions are calculated as follows:
///
/// .. code::
///
/// H_out = H_in + topPaddingAmount + bottomPaddingAmount
/// W_out = W_in + leftPaddingAmount + rightPaddingAmount
///
/// topPaddingAmount == Height startEdgeSize == borderAmounts\[0\].startEdgeSize
/// bottomPaddingAmount == Height endEdgeSize == borderAmounts\[0\].endEdgeSize
/// leftPaddingAmount == Width startEdgeSize == borderAmounts\[1\].startEdgeSize
/// rightPaddingAmount == Width endEdgeSize == borderAmounts\[1\].endEdgeSize
///
/// There are three types of padding:
///
/// - ``PaddingConstant``, which fills a constant value at the border.
/// - ``PaddingReflection``, which reflects the values at the border.
/// - ``PaddingReplication``, which replicates the values at the border.
///
/// Given the following input:
///
/// .. code::
///
/// \[1, 3, 4\] : 1 2 3 4
/// 5 6 7 8
/// 9 10 11 12
///
/// Here is the output of applying the padding
/// ``(top=2, left=2, bottom=0, right=0)``
/// with each of the supported types:
///
/// - ``PaddingConstant`` (``value = 0``):
/// .. code::
///
/// \[1, 5, 6\] : 0 0 0 0 0 0
/// 0 0 0 0 0 0
/// 0 0 1 2 3 4
/// 0 0 5 6 7 8
/// 0 0 9 10 11 12
///
/// - ``PaddingReflection``:
/// .. code::
///
/// \[1, 5, 6\] : 11 10 9 10 11 12
/// 7 6 5 6 7 8
/// 3 2 1 2 3 4
/// 7 6 5 6 7 8
/// 11 10 9 10 11 12
///
/// - ``PaddingReplication``:
/// .. code::
///
/// \[1, 5, 6\] : 1 1 1 2 3 4
/// 1 1 1 2 3 4
/// 1 1 1 2 3 4
/// 5 5 5 6 7 8
/// 9 9 9 10 11 12
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PaddingLayerParams {
/// Amounts to be padded to the input.
#[prost(message, optional, tag = "10")]
pub padding_amounts: ::core::option::Option<BorderAmounts>,
#[prost(oneof = "padding_layer_params::PaddingType", tags = "1, 2, 3")]
pub padding_type: ::core::option::Option<padding_layer_params::PaddingType>,
}
/// Nested message and enum types in `PaddingLayerParams`.
pub mod padding_layer_params {
///
/// Fill a constant value in the padded region.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PaddingConstant {
#[prost(float, tag = "1")]
pub value: f32,
}
///
/// Reflect the values at the border for padding.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PaddingReflection {}
///
/// Replicate the values at the border for padding.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PaddingReplication {}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum PaddingType {
#[prost(message, tag = "1")]
Constant(PaddingConstant),
#[prost(message, tag = "2")]
Reflection(PaddingReflection),
#[prost(message, tag = "3")]
Replication(PaddingReplication),
}
}
///
/// A layer that concatenates along the axis = -3 or -5.
/// For general concatenation along any axis, see ConcatNDLayer.
///
/// .. code::
///
/// y = ConcatLayer(x1,x2,....)
///
/// Requires more than 1 input and produces 1 output.
///
/// Input
/// All input blobs must have same rank.
/// If "sequenceConcat" = False, rank must be greater than equal to 3. In this case concatenation is along axis = -3
/// If "sequenceConcat" = True, rank must be greater than equal to 5. In this case concatenation is along axis = -5
///
/// Output
/// Same rank as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ConcatLayerParams {
///
/// If true, concatenate along the axis = -5 instead of axis = -3.
#[prost(bool, tag = "100")]
pub sequence_concat: bool,
}
///
/// A layer that performs local response normalization (LRN).
///
/// .. code::
///
/// y = LRNLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with rank greater than equal to 3.
/// Example: Rank 4 blob represents \[Batch, channels, height, width\]
/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
/// Output
/// A blob with the same shape as the input.
///
/// This layer is described by the following formula:
///
/// .. math::
/// x_i \leftarrow \dfrac{x_i}{\left ( k + \dfrac{\alpha}{\text{localSize}} \sum_j x_j^2 \right )^\beta}
///
/// where the summation is done over a ``(localSize, 1, 1)`` neighborhood ---
/// that is, over a window "across" channels in 1x1 spatial neighborhoods.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LrnLayerParams {
#[prost(float, tag = "1")]
pub alpha: f32,
#[prost(float, tag = "2")]
pub beta: f32,
/// Number of channels in the normalization window.
#[prost(uint64, tag = "3")]
pub local_size: u64,
/// Defaults to 1 if not set or 0. Must be strictly positive.
#[prost(float, tag = "4")]
pub k: f32,
}
///
/// Softmax Normalization Layer
///
/// A layer that performs softmax normalization.
/// Normalization is applied along axis = -3 or N-3 (where N is the rank of the input)
/// For softmax layer that can operate on any axis, see SoftmaxNDLayer.
///
///
/// .. code::
///
/// y = SoftmaxLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// Must be a blob with rank >= 3.
/// Output
/// A blob with the same shape as the input.
///
/// This layer is described by the following formula:
///
/// .. math::
/// x_i \leftarrow \dfrac{e^{x_i}}{\sum_i{e^{x_i}}}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SoftmaxLayerParams {}
///
/// A layer that uniformly splits across axis = -3 to produce a specified number of outputs.
/// For general split operation along any axis, see SplitNDLayer.
///
/// .. code::
///
/// (y1,y2,...yN) = SplitLayer(x), where N = nOutputs
///
/// Requires 1 input and produces multiple outputs.
///
/// Input
/// A blob with rank at least 3.
/// e.g.: blob with shape ``\[C, H, W\]``
/// Output
/// ``nOutputs`` blobs each with same rank as the input.
/// e.g.: For input that is of shape ``\[C, H, W\]``, output shapes will be ``\[C/nOutputs, H, W\]``
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SplitLayerParams {
/// The number of outputs.
#[prost(uint64, tag = "1")]
pub n_outputs: u64,
}
///
/// A layer that performs elementwise addition.
/// This layer has limited broadcasting support. For general broadcasting see AddBroadcastableLayer.
///
/// .. code::
///
/// y = AddLayer(x1,x2,...)
///
/// Requires 1 or more than 1 input and produces 1 output.
///
/// Input
/// In general, there are no rank constraints.
/// However, only certain set of shapes are broadcastable. For example:
/// \[B, 1, 1, 1\], \[B, C, 1, 1\], \[B, 1, H, W\], \[B, C, H, W\]
/// Output
/// A blob with shape equal to the input blob.
///
/// If only one input is provided, scalar addition is performed:
///
/// .. math::
/// y = x + \alpha
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct AddLayerParams {
///
/// Scalar to be added to the input.
/// Only used if there is a single input.
#[prost(float, tag = "1")]
pub alpha: f32,
}
///
/// A layer that performs elementwise multiplication.
/// This layer has limited broadcasting support. For general broadcasting see MultiplyBroadcastableLayer.
///
/// .. code::
///
/// y = MultiplyLayer(x1,x2,...)
///
/// Requires 1 or more than 1 input and produces 1 output.
///
/// Input
/// In general, there are no rank constraints.
/// However, only certain set of shapes are broadcastable. For example:
/// \[B, 1, 1, 1\], \[B, C, 1, 1\], \[B, 1, H, W\], \[B, C, H, W\]
/// Output
/// A blob with shape equal to the first input blob.
///
/// If only one input is provided, scalar multiplication is performed:
///
/// .. math::
/// y = \alpha x
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct MultiplyLayerParams {
///
/// Scalar to be multiplied with the input.
/// Only used if there is a single input.
#[prost(float, tag = "1")]
pub alpha: f32,
}
///
/// A layer that applies a unary function.
///
/// .. code::
///
/// y = UnaryFunctionLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with no rank constraints.
/// Output
/// A blob with the same shape as the input.
///
/// The input is first modified by shifting and scaling:
///
/// .. math::
/// x \leftarrow \text{scale} \cdot x + \text{shift}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UnaryFunctionLayerParams {
/// The type of unary function.
#[prost(enumeration = "unary_function_layer_params::Operation", tag = "1")]
pub r#type: i32,
///
/// A constant used in ``POWER`` and ``THRESHOLD`` functions.
#[prost(float, tag = "2")]
pub alpha: f32,
///
/// A small constant to avoid division by 0 while normalizing variance.
/// Defaults to ``1e-6`` if not set or set to ``0``.
#[prost(float, tag = "3")]
pub epsilon: f32,
///
/// Input is shifted by this amount
/// before the unary function is applied.
/// Defaults to ``0.0`` if not set.
#[prost(float, tag = "4")]
pub shift: f32,
///
/// Input is scaled by this amount
/// before the unary function is applied.
/// Defaults to ``1.0`` if not set or set to ``0``.
#[prost(float, tag = "5")]
pub scale: f32,
}
/// Nested message and enum types in `UnaryFunctionLayerParams`.
pub mod unary_function_layer_params {
///
/// A unary operator.
///
/// The following functions are supported:
///
/// ``SQRT``
/// .. math:: f(x) = \sqrt{x}
///
/// ``RSQRT``
/// .. math:: f(x) = \dfrac{1}{\sqrt{x + \epsilon}}
///
/// ``INVERSE``
/// .. math:: f(x) = \dfrac{1}{x + \epsilon}
///
/// ``POWER``
/// .. math:: f(x) = x^\alpha
///
/// ``EXP``
/// .. math:: f(x) = e^x
///
/// ``LOG``
/// .. math:: f(x) = \log x
///
/// ``ABS``
/// .. math:: f(x) = |x|
///
/// ``THRESHOLD``
/// .. math:: f(x) = \text{max}(\alpha, x)
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Operation {
Sqrt = 0,
Rsqrt = 1,
Inverse = 2,
Power = 3,
Exp = 4,
Log = 5,
Abs = 6,
Threshold = 7,
}
impl Operation {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Sqrt => "SQRT",
Self::Rsqrt => "RSQRT",
Self::Inverse => "INVERSE",
Self::Power => "POWER",
Self::Exp => "EXP",
Self::Log => "LOG",
Self::Abs => "ABS",
Self::Threshold => "THRESHOLD",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SQRT" => Some(Self::Sqrt),
"RSQRT" => Some(Self::Rsqrt),
"INVERSE" => Some(Self::Inverse),
"POWER" => Some(Self::Power),
"EXP" => Some(Self::Exp),
"LOG" => Some(Self::Log),
"ABS" => Some(Self::Abs),
"THRESHOLD" => Some(Self::Threshold),
_ => None,
}
}
}
}
///
/// A layer that scales up spatial dimensions.
/// It supports two modes: nearest neighbour (default) and bilinear.
///
/// .. code::
///
/// y = UpsampleLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with rank at least 3.
/// e.g.: blob with shape ``\[C, H, W\]``.
/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
///
/// Output
/// Same rank as the input.
/// e.g.: blob with shape ``\[C, scalingFactor[0\] * H, scalingFactor\[1\] * W]``
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpsampleLayerParams {
///
/// Scaling Factor. Mutually exclusive with fractionalScalingFactor.
/// Must be length 2 in order ``\[H, W\]``.
/// If not set, default value ``\[1, 1\]`` is used.
#[prost(uint64, repeated, tag = "1")]
pub scaling_factor: ::prost::alloc::vec::Vec<u64>,
///
/// Fractional scaling factor. Mutually exclusive with scalingFactor.
/// Must be length 2 in order ``\[H, W\]``.
/// If not set, default value ``\[1.0, 1.0\]`` is used.
#[prost(float, repeated, tag = "7")]
pub fractional_scaling_factor: ::prost::alloc::vec::Vec<f32>,
#[prost(enumeration = "upsample_layer_params::InterpolationMode", tag = "5")]
pub mode: i32,
#[prost(enumeration = "upsample_layer_params::LinearUpsampleMode", tag = "6")]
pub linear_upsample_mode: i32,
}
/// Nested message and enum types in `UpsampleLayerParams`.
pub mod upsample_layer_params {
///
/// Overall mode for interpolating new elements when upsampling.
/// NN - Nearest Neighbors - simply pick the nearest true value for interpolated values.
/// BILINEAR - Use bilinear interpolation. See LinearUpsamplingMode for behavior.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum InterpolationMode {
/// Nearest Neighbour
Nn = 0,
/// Bilinear
Bilinear = 1,
}
impl InterpolationMode {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Nn => "NN",
Self::Bilinear => "BILINEAR",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NN" => Some(Self::Nn),
"BILINEAR" => Some(Self::Bilinear),
_ => None,
}
}
}
///
/// LinearUpsampleMode specifies the behavior for linear upsampling. Only valid when Interpolation Mode is BILINEAR.
/// If input grid is \[0, Xin-1\] (corresponding to an input size of Xin), and if the output size is Xout,
/// then the grid points are sampled in the following manner:
/// DEFAULT:
/// spacing = (Xin-Xin/Xout) / (Xout-1)
/// grid_point\[i\] = min(Xin-1, max(0, i * spacing)), for i = 0,1,2,….,Xout-1
/// ALIGN_CORNERS_TRUE:
/// spacing = (Xin-1) / (Xout-1)
/// grid_point\[i\] = min(Xin-1, max(0, i * spacing)), for i = 0,1,2,….,Xout-1
/// ALIGN_CORNERS_FALSE:
/// spacing = Xin / Xout
/// grid_point\[i\] = min(Xin-1, max(0, i * spacing + 0.5 * spacing - 0.5)), for i = 0,1,2,….,Xout-1
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum LinearUpsampleMode {
Default = 0,
AlignCornersTrue = 1,
AlignCornersFalse = 2,
}
impl LinearUpsampleMode {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Default => "DEFAULT",
Self::AlignCornersTrue => "ALIGN_CORNERS_TRUE",
Self::AlignCornersFalse => "ALIGN_CORNERS_FALSE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"DEFAULT" => Some(Self::Default),
"ALIGN_CORNERS_TRUE" => Some(Self::AlignCornersTrue),
"ALIGN_CORNERS_FALSE" => Some(Self::AlignCornersFalse),
_ => None,
}
}
}
}
///
/// A layer that resizes the input to a pre-specified spatial size using bilinear interpolation.
///
/// .. code::
///
/// y = ResizeBilinearLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with rank at least 3.
/// e.g.: blob with shape ``\[C, H_in, W_in\]``.
/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
///
/// Output
/// Same rank as the input.
/// e.g.: blob with shape ``\[C, H_out, W_out\]``.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ResizeBilinearLayerParams {
///
/// Target Spatial Size.
/// Must be length 2 in order ``\[Height, Width\]``, i.e. ``\[H_out, W_out\]``.
/// If not set, default value ``\[1, 1\]`` is used.
#[prost(uint64, repeated, tag = "1")]
pub target_size: ::prost::alloc::vec::Vec<u64>,
///
/// Mode used to compute the grid on which the spatial output values are evaluated.
/// Same mode is applied to both the height and width axes.
#[prost(message, optional, tag = "2")]
pub mode: ::core::option::Option<SamplingMode>,
}
///
/// A layer that extracts cropped spatial patches or RoIs (regions of interest) from the input and resizes them to a pre-specified size using
/// bilinear interpolation.
/// Note that RoI Align layer can be implemented with this layer followed by a pooling layer.
///
/// .. code::
///
/// y = CropResizeLayer(x)
///
/// Requires 2 inputs and produces 1 output.
///
/// Input
/// There are two inputs.
/// First input represents an image feature map.
/// Second input represents the bounding box coordinates for N patches or RoIs (region of interest).
///
/// First input is rank 5: \[1, Batch, C, H_in, W_in\].
/// Second input is rank 5. Its shape can be either \[N, 1, 4, 1, 1\] or \[N, 1, 5, 1, 1\].
///
/// N: number of patches/RoIs to be extracted
///
/// If RoI shape = ``\[N, 1, 4, 1, 1\]``
/// The axis=-3 corresponds to the four coordinates specifying the bounding box.
/// All the N RoIs are extracted from all the batches of the input.
///
/// If RoI shape = ``\[N, 1, 5, 1, 1\]``
/// The first element of the axis=-3 specifies the input batch id from which to extract the RoI and
/// must be in the interval ``\[0, Batch - 1\]``. That is, n-th RoI is extracted from the RoI\[n,0,0,0,0\]-th
/// input batch id. The last four elements of the axis=-3 specify the bounding box coordinates.
///
/// Output
/// A blob with rank 5.
/// - Shape is \[N, Batch, C, H_out, W_out\] if input RoI shape is \[N, 1, 4, 1, 1\]
/// - Shape is \[N, 1, C, H_out, W_out\] if input RoI shape is \[N, 1, 5, 1, 1\]
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CropResizeLayerParams {
///
/// Target Spatial Size.
/// Must be length 2 in order ``\[Height, Width\]``, i.e. ``\[H_out, W_out\]``.
/// If not set, default value ``\[1, 1\]`` is used.
#[prost(uint64, repeated, tag = "1")]
pub target_size: ::prost::alloc::vec::Vec<u64>,
///
/// If true the bounding box coordinates must be in the interval \[0, 1\].
/// They are scaled by (H_in - 1), (W_in - 1), i.e. based on the input spatial dimensions.
/// If false the bounding box coordinates must be in the interval
/// \[0, H_in -1\] and \[0, W_in - 1\], respectively for height and width dimensions.
#[prost(bool, tag = "2")]
pub normalized_coordinates: bool,
///
/// Mode used to compute the grid on which the spatial output values are evaluated.
/// Same mode is applied to both the height and width axes.
#[prost(message, optional, tag = "3")]
pub mode: ::core::option::Option<SamplingMode>,
///
/// Representation used to express the bounding box coordinates.
/// It determines how the values of the second input are interpreted.
#[prost(message, optional, tag = "4")]
pub box_indices_mode: ::core::option::Option<BoxCoordinatesMode>,
///
/// Additional spatial scale that multiplies the bounding box coordinates.
/// Generally used while implementing the RoI Align layer,
/// which uses unnormalized RoI coordinates along with a spatial scale less than or equal to 1.
#[prost(float, tag = "5")]
pub spatial_scale: f32,
}
///
/// A layer that performs elementwise addition of a bias,
/// which is broadcasted to match the input shape.
///
/// .. code::
///
/// y = BiasLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with rank at least 3.
/// e.g.: blob with shape ``\[C, H, W\]``.
/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
/// Output
/// A blob with the same shape as the input.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BiasLayerParams {
///
/// The shape of the bias.
/// Must be one of the following:
/// ``\[1\]``, ``\[C\]``, ``\[1, H, W\]`` or ``\[C, H, W\]``.
#[prost(uint64, repeated, tag = "1")]
pub shape: ::prost::alloc::vec::Vec<u64>,
///
/// The bias values.
/// The size must be equal to the product of the ``shape`` dimensions.
#[prost(message, optional, tag = "2")]
pub bias: ::core::option::Option<WeightParams>,
}
///
/// A layer that performs elmentwise multiplication by a scale factor
/// and optionally adds a bias;
/// both the scale and bias are broadcasted to match the input shape.
///
/// .. code::
///
/// y = ScaleLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with rank at least 3.
/// e.g.: blob with shape ``\[C, H, W\]``.
/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
/// Output
/// A blob with the same shape as the input.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ScaleLayerParams {
///
/// The shape of the scale.
/// Must be one of the following:
/// ``\[1\]``, ``\[C\]``, ``\[1, H, W\]`` or ``\[C, H, W\]``.
#[prost(uint64, repeated, tag = "1")]
pub shape_scale: ::prost::alloc::vec::Vec<u64>,
///
/// The scale values.
/// The size must be equal to the product of the ``shape`` dimensions.
///
/// Scale values. Size must be equal to the product of dimensions specified in shapeScale.
#[prost(message, optional, tag = "2")]
pub scale: ::core::option::Option<WeightParams>,
/// If true, a bias is added after scaling.
#[prost(bool, tag = "3")]
pub has_bias: bool,
///
/// The shape of the bias.
/// Must be one of the following:
/// ``\[1\]``, ``\[C\]``, ``\[1, H, W\]`` or ``\[C, H, W\]``.
#[prost(uint64, repeated, tag = "4")]
pub shape_bias: ::prost::alloc::vec::Vec<u64>,
///
/// The bias values.
/// The size must be equal to the product of the ``shape`` dimensions.
#[prost(message, optional, tag = "5")]
pub bias: ::core::option::Option<WeightParams>,
}
///
/// A layer that loads data as a parameter and provides it as an output.
/// The output is rank 5. For general rank, see LoadConstantNDLayer.
///
/// .. code::
///
/// y = LoadConstantLayer()
///
/// Requires no input and produces 1 output.
///
/// Output:
/// A blob with rank 5 and shape ``\[1, 1, C, H, W\]``
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LoadConstantLayerParams {
///
/// The shape of the constant to be loaded,
/// which must be``\[C, H, W\]``, that is length 3.
#[prost(uint64, repeated, tag = "1")]
pub shape: ::prost::alloc::vec::Vec<u64>,
///
/// The data values,
/// of size ``C * H * W``.
#[prost(message, optional, tag = "2")]
pub data: ::core::option::Option<WeightParams>,
}
///
/// A layer that performs L2 normalization, i.e. divides by the
/// the square root of the sum of squares of all elements of input.
///
/// .. code::
///
/// y = L2NormalizeLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with rank greater than equal to 3.
/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
/// Output
/// A blob with the same shape as the input.
///
/// This layer is described by the following formula:
///
/// .. math::
/// x_i \leftarrow \dfrac{x_i}{\sqrt{\sum{x_i^2} + \epsilon}}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct L2NormalizeLayerParams {
///
/// A small constant to avoid division by 0 while normalizing variance.
/// Defaults to ``1e-6`` if not set or set to ``0``.
#[prost(float, tag = "1")]
pub epsilon: f32,
}
///
/// A layer that flattens the input.
///
/// .. code::
///
/// y = FlattenLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with rank greater than equal to 3.
/// e.g.: Rank 4 blob represents \[Batch, C, H, W\]
/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
/// Output
/// Same rank as the input, such that last two dimensions are both 1.
/// e.g.: For rank 4 input, output shape is ``\[Batch, C * H * W, 1, 1\]``
///
/// There are two X orders: ``CHANNEL_FIRST`` and ``CHANNEL_LAST``.
/// ``CHANNEL_FIRST`` does not require data to be rearranged,
/// because row major ordering is used by internal storage.
/// ``CHANNEL_LAST`` requires data to be rearranged.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FlattenLayerParams {
#[prost(enumeration = "flatten_layer_params::FlattenOrder", tag = "1")]
pub mode: i32,
}
/// Nested message and enum types in `FlattenLayerParams`.
pub mod flatten_layer_params {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum FlattenOrder {
ChannelFirst = 0,
ChannelLast = 1,
}
impl FlattenOrder {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::ChannelFirst => "CHANNEL_FIRST",
Self::ChannelLast => "CHANNEL_LAST",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CHANNEL_FIRST" => Some(Self::ChannelFirst),
"CHANNEL_LAST" => Some(Self::ChannelLast),
_ => None,
}
}
}
}
///
/// A layer that recasts the input into a new shape.
///
/// .. code::
///
/// y = ReshapeLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with rank 5.
/// e.g.: ``\[1, 1, C, H, W\]`` or ``\[Seq, 1, C, H, W\]``.
/// Output
/// A blob with rank 5.
/// e.g.: ``\[1, 1, C_out, H_out, W_out\]`` or ``\[Seq_out, 1, C_out, H_out, W_out\]``.
///
/// There are two reshape orders: ``CHANNEL_FIRST`` and ``CHANNEL_LAST``.
/// ``CHANNEL_FIRST`` is equivalent to
/// flattening the input to ``\[Seq, 1, C * H * W, 1, 1\]`` in channel first order
/// and then reshaping it to the target shape;
/// no data rearrangement is required.
/// ``CHANNEL_LAST`` is equivalent to
/// flattening the input to ``\[Seq, 1, H * W * C, 1, 1\]`` in channel last order,
/// reshaping it to ``\[Seq_out, 1, H_out, W_out, C_out\]`` (it is now in "H_out-major"" order),
/// and then permuting it to ``\[C_out, H_out, W_out\]``;
/// both the flattening and permuting requires the data to be rearranged.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReshapeLayerParams {
///
/// The shape of the output.
/// Must be of length 3 or 4.
/// If set to 3, ``targetShape`` is interpreted as
/// ``\[1, 1, C_out, H_out, W_out\]``, and sequence length of the input is preserved.
/// If set to 4, ``targetShape`` is interpreted as
/// ``\[Seq_out, 1, C_out, H_out, W_out\]``,
/// where ``Seq_out`` is the new sequence length.
#[prost(int64, repeated, tag = "1")]
pub target_shape: ::prost::alloc::vec::Vec<i64>,
#[prost(enumeration = "reshape_layer_params::ReshapeOrder", tag = "2")]
pub mode: i32,
}
/// Nested message and enum types in `ReshapeLayerParams`.
pub mod reshape_layer_params {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ReshapeOrder {
ChannelFirst = 0,
ChannelLast = 1,
}
impl ReshapeOrder {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::ChannelFirst => "CHANNEL_FIRST",
Self::ChannelLast => "CHANNEL_LAST",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CHANNEL_FIRST" => Some(Self::ChannelFirst),
"CHANNEL_LAST" => Some(Self::ChannelLast),
_ => None,
}
}
}
}
///
/// A layer that rearranges the dimensions and data of an input.
/// For generic transpose/permute operation see TransposeLayer.
///
/// .. code::
///
/// y = PermuteLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// Must be a rank 5 blob.
/// e.g.: shape ``\[Seq, B, C, H, W\]``.
/// Output
/// Rank 5 blob. Transposed version of the input, such that dimensions at axis=1 or axis=-4 is unchanged.
///
///
/// Examples:
///
/// Assume input shape is \[Seq, B, C, H, W\]
///
/// - If ``axis`` is set to ``\[0, 3, 1, 2\]``,
/// then the output has shape ``\[Seq, B, W, C, H\]``
///
/// - If ``axis`` is set to ``\[3, 1, 2, 0\]``,
/// then the output has shape ``\[W, B, C, H, Seq\]``
///
/// - If ``axis`` is set to ``\[0, 3, 2, 1\]``,
/// then the output has shape ``\[Seq, B, W, H, C\]``
///
/// - If ``axis`` is not set, or is set to ``\[0, 1, 2, 3\]``,
/// the output is the same as the input.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PermuteLayerParams {
///
/// The order in which to permute the dimensions.
/// Must have length 4 and a permutation of ``\[0, 1, 2, 3\]``.
#[prost(uint64, repeated, tag = "1")]
pub axis: ::prost::alloc::vec::Vec<u64>,
}
///
/// A layer that reorganizes data in the input in specific ways.
///
/// .. code::
///
/// y = ReorganizeDataLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with rank at least 3.
/// e.g.: blob with shape ``\[C, H, W\]``.
/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
/// Output
/// Same rank as the input.
/// e.g.: blob with shape ``\[C_out, H_out, W_out\]``.
///
/// mode == SPACE_TO_DEPTH
/// ``\[C_out, H_out, W_out\]`` : ``\[C * blockSize * blockSize, H/blockSize, W/blockSize\]``.
/// blockSize must divide H and W.
/// Data is moved from the spatial dimensions to the channel dimension. Input is spatially divided into
/// non-overlapping blocks of size blockSize X blockSize and data from each block is moved into the
/// channel dimension.
///
/// mode == DEPTH_TO_SPACE
/// ``\[C_out, H_out, W_out\]`` : ``\[C/(blockSize * blockSize), H * blockSize, W * blockSize\]``.
/// Square of blockSize must divide C.
/// Reverse of SPACE_TO_DEPTH. Data is moved from the channel dimension to the spatial dimensions.
///
/// mode == PIXEL_SHUFFLE
/// ``\[C_out, H_out, W_out\]`` : ``\[C/(blockSize * blockSize), H * blockSize, W * blockSize\]``.
/// Square of blockSize must divide C.
/// Similar to DEPTH_TO_SPACE, but using the pixel-shuffle semantics for channel order in the output space.
/// In both modes, elements along the channel dimension are collapsed into
/// blocks in the spatial dimensions. The difference is in the arrangement of
/// the input-channels' data in the output space. See below example for more
/// detail.
/// (Only available in Core ML Specification >= 5 (iOS >= 14, macOS >= 11.0)
///
///
/// Examples:
///
/// Assume input is the following \[C = 8, H = 1, W = 2\] tensor:
///
/// .. code::
///
/// \[[[1 2]\] [\[3 4]\] [\[5 6]\] [\[7 8]\] [\[9 10]\] [\[11 12]\] [\[13 14]\] [\[15 16]\]]
///
/// If block_size == 2 and mode == DEPTH_TO_SPACE, output will be the following
/// \[C = 2, H = 2, W = 4\] tensor:
///
/// .. code::
///
/// \[[[ 1 5 2 6\]
/// \[ 9 13 10 14]\]
///
/// \[[ 3 7 4 8\]
/// \[11 15 12 16]\]]
///
/// For mode == SPACE_TO_DEPTH, the behavior is the same as mode ==
/// DEPTH_TO_SPACE, but with the input and output swapped.
///
/// If block_size == 2 and mode == PIXEL_SHUFFLE, output will be the following
/// \[C = 2, H = 2, W = 4\] tensor:
///
/// .. code::
///
/// \[[[ 1 3 2 4\]
/// \[ 5 7 6 8]\]
///
/// \[[ 9 11 10 12\]
/// \[13 15 14 16]\]]
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReorganizeDataLayerParams {
#[prost(enumeration = "reorganize_data_layer_params::ReorganizationType", tag = "1")]
pub mode: i32,
/// must be greater than 1
#[prost(uint64, tag = "2")]
pub block_size: u64,
}
/// Nested message and enum types in `ReorganizeDataLayerParams`.
pub mod reorganize_data_layer_params {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ReorganizationType {
SpaceToDepth = 0,
DepthToSpace = 1,
PixelShuffle = 2,
}
impl ReorganizationType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::SpaceToDepth => "SPACE_TO_DEPTH",
Self::DepthToSpace => "DEPTH_TO_SPACE",
Self::PixelShuffle => "PIXEL_SHUFFLE",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SPACE_TO_DEPTH" => Some(Self::SpaceToDepth),
"DEPTH_TO_SPACE" => Some(Self::DepthToSpace),
"PIXEL_SHUFFLE" => Some(Self::PixelShuffle),
_ => None,
}
}
}
}
///
/// A layer that slices the input data along axis = -1 or -2 or -3.
/// For general slice along any axis, please see SliceStaticLayer/SliceDynamicLayer.
///
/// .. code::
///
/// y = SliceLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob that can, in general, have any rank. However, depending on the value of "axis" ,
/// there may be additional rank constraints.
/// Output
/// A blob with the same rank as the input.
///
/// Sliced section is taken from the interval ``[startIndex, endIndex)``, i.e.
/// startIndex is inclusive while endIndex is exclusive.
/// stride must be positive and represents the step size for slicing.
/// Negative indexing is supported for startIndex and endIndex.
/// -1 denotes N-1, -2 denotes N-2 and so on, where N is the length of the dimension to be sliced.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SliceLayerParams {
/// start of the sliced section. Inclusive.
#[prost(int64, tag = "1")]
pub start_index: i64,
/// end of sliced section. Exclusive.
#[prost(int64, tag = "2")]
pub end_index: i64,
/// The step size. Must be positive.
#[prost(uint64, tag = "3")]
pub stride: u64,
/// The following mapping is used for interpreting this parameter:
/// CHANNEL_AXIS => axis = -3, input must have rank at least 3.
/// HEIGHT_AXIS => axis = -2, input must have rank at least 2.
/// WIDTH_AXIS => axis = -1
#[prost(enumeration = "slice_layer_params::SliceAxis", tag = "4")]
pub axis: i32,
}
/// Nested message and enum types in `SliceLayerParams`.
pub mod slice_layer_params {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum SliceAxis {
ChannelAxis = 0,
HeightAxis = 1,
WidthAxis = 2,
}
impl SliceAxis {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::ChannelAxis => "CHANNEL_AXIS",
Self::HeightAxis => "HEIGHT_AXIS",
Self::WidthAxis => "WIDTH_AXIS",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CHANNEL_AXIS" => Some(Self::ChannelAxis),
"HEIGHT_AXIS" => Some(Self::HeightAxis),
"WIDTH_AXIS" => Some(Self::WidthAxis),
_ => None,
}
}
}
}
///
/// A layer that reduces the input using a specified operation.
///
/// .. code::
///
/// y = ReduceLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob that can, in general, have any rank. However, depending on the value of "axis" ,
/// there may be additional rank constraints.
/// Output
/// A blob with the same rank as the input, which has 1s on the dimensions specified in the parameter "axis"
///
/// Values supported for axis are \[-1\], \[-2\], \[-3\], \[-2,-1\], \[-3,-2,-1\]
/// and the equivalent positive values (depending on the rank of the input)
/// For mode == 'ArgMax', axis must be \[-1\] or \[-2\] or \[-3\].
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ReduceLayerParams {
/// Specifies function used to reduce.
#[prost(enumeration = "reduce_layer_params::ReduceOperation", tag = "1")]
pub mode: i32,
///
/// Used if mode is ``LOGSUM``.
/// Defaults to ``1e-6`` if not set or is set to ``0``.
#[prost(float, tag = "2")]
pub epsilon: f32,
/// The following mapping is used for interpreting this parameter:
/// CHW = axis \[-3, -2, -1\], input must have rank at least 3.
/// HW = axis \[-2, -1\], input must have rank at least 2.
/// C = axis \[-3\]
/// H = axis \[-2\]
/// W = axis \[-1\]
#[prost(enumeration = "reduce_layer_params::ReduceAxis", tag = "3")]
pub axis: i32,
}
/// Nested message and enum types in `ReduceLayerParams`.
pub mod reduce_layer_params {
///
/// The following reduction operations are supported
/// and are applied on the specified axis of the input array:
///
/// ``SUM``
/// Sum of all elements
///
/// .. math:: \sum{x_i}
///
/// ``AVG``
/// Sum of all elements divided by the number of elements
///
/// .. math:: \dfrac{\sum^n{x_i}}{n}
///
/// ``PROD``
/// Product of all elements
///
/// .. math:: \prod{x_i}
///
/// ``LOGSUM``
/// Sum of the natural logarithm of all elements
///
/// .. math:: \sum{\ln{(x_i + \epsilon)}}
///
/// ``SUMSQUARE``
/// Sum of squares of all elements
///
/// .. math:: \sum{x^2}
///
/// ``L1``
/// L1 normalization of all elements
///
/// .. math:: ||x||_1 = \sum{|x_i|}
///
/// ``L2``
/// L2 normalization of all elements
///
/// .. math:: ||x||_2 = \sqrt{\sum{x_i^2}}
///
/// ``MAX``
/// Maximum of all elements
///
/// .. math:: \text{max}(x_i)
///
/// ``MIN``
/// Minimum of all elements
///
/// .. math:: \text{min}(x_i)
///
/// ``ARGMAX``
/// Argument of the maximum of all elements
///
/// .. math:: \text{argmax}(x_i)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ReduceOperation {
Sum = 0,
Avg = 1,
Prod = 2,
Logsum = 3,
Sumsquare = 4,
L1 = 5,
L2 = 6,
Max = 7,
Min = 8,
/// only supported with axis = C, H or W.
Argmax = 9,
}
impl ReduceOperation {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Sum => "SUM",
Self::Avg => "AVG",
Self::Prod => "PROD",
Self::Logsum => "LOGSUM",
Self::Sumsquare => "SUMSQUARE",
Self::L1 => "L1",
Self::L2 => "L2",
Self::Max => "MAX",
Self::Min => "MIN",
Self::Argmax => "ARGMAX",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SUM" => Some(Self::Sum),
"AVG" => Some(Self::Avg),
"PROD" => Some(Self::Prod),
"LOGSUM" => Some(Self::Logsum),
"SUMSQUARE" => Some(Self::Sumsquare),
"L1" => Some(Self::L1),
"L2" => Some(Self::L2),
"MAX" => Some(Self::Max),
"MIN" => Some(Self::Min),
"ARGMAX" => Some(Self::Argmax),
_ => None,
}
}
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ReduceAxis {
Chw = 0,
Hw = 1,
C = 2,
H = 3,
W = 4,
}
impl ReduceAxis {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Chw => "CHW",
Self::Hw => "HW",
Self::C => "C",
Self::H => "H",
Self::W => "W",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CHW" => Some(Self::Chw),
"HW" => Some(Self::Hw),
"C" => Some(Self::C),
"H" => Some(Self::H),
"W" => Some(Self::W),
_ => None,
}
}
}
}
///
/// A layer that crops the spatial dimensions of an input.
/// If two inputs are provided, the shape of the second input is used as the reference shape.
///
/// .. code::
///
/// y = CropLayer(x1) or y = CropLayer(x1,x2)
///
/// Requires 1 or 2 inputs and produces 1 output.
///
/// Input
/// 1 or 2 tensors, each with rank at least 3, both inputs must have equal rank.
/// Example:
/// - 1 input case: A blob with shape ``\[C, H_in, W_in\]``.
/// - 2 input case: 1st blob with shape ``\[C, H_in, W_in\]``, 2nd blob with shape ``\[C, H_out, W_out\]``.
///
/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
///
/// Output
/// Same rank as the inputs.
/// e.g.: A blob with shape ``\[C, H_out, W_out\]``.
///
/// If one input is used, output is computed as follows:
///
/// .. code::
///
/// y = x1\[:, topCropAmount:H_in - bottomCropAmount, leftCropAmount:W_in - rightCropAmount\]
///
/// topCropAmount == Height startEdgeSize == borderAmounts\[0\].startEdgeSize
/// bottomCropAmount == Height endEdgeSize == borderAmounts\[0\].endEdgeSize
/// leftCropAmount == Width startEdgeSize == borderAmounts\[1\].startEdgeSize
/// rightCropAmount == Width endEdgeSize == borderAmounts\[1\].endEdgeSize
///
/// H_out = H_in - topCropAmount - bottomCropAmount
/// W_out = W_in - leftCropAmount - rightCropAmount
///
/// If two inputs are used, output is computed as follows:
///
/// .. code::
///
/// y = x1\[:, offset[0\]:offset\[0\] + H_out, offset\[1\]:offset\[1\] + W_out]
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CropLayerParams {
///
/// The amounts to be cropped from the input.
/// Used only if a single input is provided.
#[prost(message, optional, tag = "1")]
pub crop_amounts: ::core::option::Option<BorderAmounts>,
///
/// The offset amounts.
/// Used only if two inputs are provided.
/// Must be of length 2, in order ``\[H, W\]``.
#[prost(uint64, repeated, tag = "5")]
pub offset: ::prost::alloc::vec::Vec<u64>,
}
///
/// A layer that computes the elementwise average of the inputs.
/// This layer has limited broadcasting support. For general broadcasting see AddBroadcastableLayer.
///
/// .. code::
///
/// y = AverageLayer(x1,x2,...)
///
/// Requires multiple inputs and produces 1 output.
///
/// Input
/// In general, there are no rank constraints.
/// However, only certain set of shapes are broadcastable. For example:
/// \[B, 1, 1, 1\], \[B, C, 1, 1\], \[B, 1, H, W\], \[B, C, H, W\]
/// Output
/// A blob with the same shape as each input.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AverageLayerParams {}
///
/// A layer that computes the elementwise maximum over the inputs.
///
/// .. code::
///
/// y = MaxLayer(x1,x2,...)
///
/// Requires multiple inputs and produces 1 output.
///
/// Input
/// In general, there are no rank constraints.
/// However, only certain set of shapes are broadcastable. For example:
/// \[B, C, 1, 1\], \[B, C, H, W\]
/// Output
/// A blob with the same shape as each input.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MaxLayerParams {}
///
/// A layer that computes the elementwise minimum over the inputs.
///
/// .. code::
///
/// y = MinLayer(x1,x2,...)
///
/// Requires multiple inputs and produces 1 output.
///
/// Input
/// In general, there are no rank constraints.
/// However, only certain set of shapes are broadcastable. For example:
/// \[B, C, 1, 1\], \[B, C, H, W\]
/// Output
/// A blob with the same shape as each input.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MinLayerParams {}
///
/// A layer that computes the dot product of two vectors.
///
/// .. code::
///
/// y = DotProductLayer(x1,x2)
///
/// Requires 2 inputs and produces 1 output.
///
/// Input
/// Two blobs with rank at least 3, such that the last two dimensions must be 1.
/// e.g.: blobs with shape ``\[B, C, 1, 1\]``.
/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
///
/// Output
/// Same rank as the input.
/// e.g. for rank 4 inputs, output shape: \[B, 1, 1, 1\]
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DotProductLayerParams {
///
/// If true, inputs are normalized first,
/// thereby computing the cosine similarity.
#[prost(bool, tag = "1")]
pub cosine_similarity: bool,
}
///
/// A layer that performs mean variance normalization, along axis = -3.
///
/// .. code::
///
/// y = MeanVarianceNormalizeLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with rank greater than equal to 3.
/// Example: Rank 4 blob represents \[Batch, channels, height, width\]
/// For ranks greater than 3, the leading dimensions, starting from 0 to -4 (inclusive), are all treated as batch.
///
/// Output
/// A blob with the same shape as the input.
///
/// If ``acrossChannels == true``
/// normalization is performed on flattened input, i.e. the input is reshaped to (Batch,C), where "Batch" contains
/// all dimensions from 0 to -4 (inclusive), and C contains dimensions -1, -2, -3.
///
/// If ``acrossChannels == false``
/// normalization is performed within a channel,
/// across spatial dimensions (i.e. last two dimensions).
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct MeanVarianceNormalizeLayerParams {
///
/// If true, mean and variance are computed across channels.
#[prost(bool, tag = "1")]
pub across_channels: bool,
///
/// If false, only mean is subtracted.
#[prost(bool, tag = "2")]
pub normalize_variance: bool,
///
/// A small constant to avoid division by 0 while normalizing variance.
/// Defaults to ``1e-6`` if not set or set to ``0``.
#[prost(float, tag = "3")]
pub epsilon: f32,
}
///
/// A layer that repeats a sequence or the dimension sitting at axis = -5
///
/// .. code::
///
/// y = SequenceRepeatLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// A blob with rank at least 5.
/// e.g: shape ``\[Seq, B, C, H, W\]``
/// Output
/// A blob with the same rank as the input.
/// e.g.: for input shape ``\[Seq, B, C, H, W\]``, output shape is ``\[nRepetitions * Seq, B, C, H, W\]``.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SequenceRepeatLayerParams {
///
/// Number of repetitions.
/// Defaults to ``1`` if not set or set to ``0``.
#[prost(uint64, tag = "1")]
pub n_repetitions: u64,
}
///
/// A simple recurrent layer.
///
/// .. code::
///
/// y_t = SimpleRecurrentLayer(x_t, y_{t-1})
///
/// Input
/// A blob of rank 5, with shape `\[Seq, Batch, inputVectorSize, 1, 1\]``.
/// This represents a sequence of vectors of size ``inputVectorSize``.
/// Output
/// Same rank as the input.
/// Represents a vector of size ``outputVectorSize``. It is either the final output or a sequence of outputs at all time steps.
///
/// - Output Shape: ``\[1, Batch, outputVectorSize, 1, 1\]`` , if ``sequenceOutput == false``
/// - Output Shape: ``\[Seq, Batch, outputVectorSize, 1, 1\]`` , if ``sequenceOutput == true``
///
/// This layer is described by the following equation:
///
/// .. math::
/// \boldsymbol{y_t} = f(\mathrm{clip}(W \boldsymbol{x_t} + \
/// R \boldsymbol{y_{t-1}} + b))
///
/// - ``W`` is a 2-dimensional weight matrix
/// (``\[outputVectorSize, inputVectorSize\]``, row-major)
/// - ``R`` is a 2-dimensional recursion matrix
/// (``\[outputVectorSize, outputVectorSize\]``, row-major)
/// - ``b`` is a 1-dimensional bias vector (``\[outputVectorSize\]``)
/// - ``f()`` is an activation
/// - ``clip()`` is a function that constrains values between ``\[-50.0, 50.0\]``
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SimpleRecurrentLayerParams {
/// The size of the input vectors.
#[prost(uint64, tag = "1")]
pub input_vector_size: u64,
/// The size of the output vectors.
#[prost(uint64, tag = "2")]
pub output_vector_size: u64,
///
/// Activations supported are Linear, Sigmoid, Tanh, ReLU, Scaled Tanh (alpha = 1.71, beta = 2/3), Hard sigmoid (alpha = 0.2, beta = 0.5)
///
/// The activation function.
#[prost(message, optional, tag = "10")]
pub activation: ::core::option::Option<ActivationParams>,
///
/// If false output is just the result after final state update.
/// If true, output is a sequence, containing outputs at all time steps.
#[prost(bool, tag = "15")]
pub sequence_output: bool,
/// If false, no bias is added.
#[prost(bool, tag = "20")]
pub has_bias_vector: bool,
/// Weight matrix W.
#[prost(message, optional, tag = "30")]
pub weight_matrix: ::core::option::Option<WeightParams>,
/// Recursion Weight matrix R.
#[prost(message, optional, tag = "31")]
pub recursion_matrix: ::core::option::Option<WeightParams>,
/// Bias vector b.
#[prost(message, optional, tag = "32")]
pub bias_vector: ::core::option::Option<WeightParams>,
/// If true, then the node processes the input sequence from right to left
#[prost(bool, tag = "100")]
pub reverse_input: bool,
}
///
/// Gated-Recurrent Unit (GRU) Layer
///
/// .. code::
///
/// y_t = GRULayer(x_t, y_{t-1})
///
/// Input
/// A blob of rank 5, with shape `\[Seq, Batch, inputVectorSize, 1, 1\]``.
/// This represents a sequence of vectors of size ``inputVectorSize``.
/// Output
/// Same rank as the input.
/// Represents a vector of size ``outputVectorSize``. It is either the final output or a sequence of outputs at all time steps.
///
/// - Output Shape: ``\[1, Batch, outputVectorSize, 1, 1\]`` , if ``sequenceOutput == false``
/// - Output Shape: ``\[Seq, Batch, outputVectorSize, 1, 1\]`` , if ``sequenceOutput == true``
///
/// This layer is described by the following equations:
///
/// Update Gate
/// .. math::
/// \boldsymbol{z_t} = \
/// f(\mathrm{clip}(W_z \boldsymbol{x_t} + \
/// R_z \boldsymbol{y_{t-1}} + b_z)
///
/// Reset Gate
/// .. math::
/// \boldsymbol{r_t} = \
/// f(\mathrm{clip}(W_r \boldsymbol{x_t} + \
/// R_r \boldsymbol{y_{t-1}} + b_r))
///
/// Cell Memory State
/// .. math::
/// \boldsymbol{c_t} = \
/// \boldsymbol{y_{t-1}} \odot \boldsymbol{r_t}
///
/// Output Gate
/// .. math::
/// \boldsymbol{o_t} = \
/// g(\mathrm{clip}(W_o \boldsymbol{x_t} + \
/// R_o \boldsymbol{c_t} + b_o))
///
/// Output
/// .. math::
/// \boldsymbol{y_t} = \
/// (1 - \boldsymbol{z_t}) \odot \boldsymbol{o_t} + \
/// \boldsymbol{z_t} \odot \boldsymbol{y_{t-1}}
///
/// - ``W_z``, ``W_r``, ``W_o`` are 2-dimensional input weight matrices
/// (``\[outputVectorSize, inputVectorSize\]``, row-major)
/// - ``R_z``, ``R_r``, ``R_o`` are 2-dimensional recursion matrices
/// (``\[outputVectorSize, outputVectorSize\]``, row-major)
/// - ``b_z``, ``b_r``, ``b_o`` are 1-dimensional bias vectors
/// (``\[outputVectorSize\]``)
/// - ``f()``, ``g()`` are activations
/// - ``clip()`` is a function that constrains values between ``\[-50.0, 50.0\]``
/// - ``⊙`` denotes the elementwise product of matrices
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GruLayerParams {
/// Size of the input vectors.
#[prost(uint64, tag = "1")]
pub input_vector_size: u64,
/// Size of the output vectors.
#[prost(uint64, tag = "2")]
pub output_vector_size: u64,
///
/// 2 element array representing activations \[f(), g()\] in that order.
/// Typical values used = \[sigmoid, tanh\].
/// Activations supported are Linear, Sigmoid, Tanh, ReLU, Scaled Tanh (alpha = 1.71, beta = 2/3), Hard sigmoid (alpha = 0.2, beta = 0.5)
#[prost(message, repeated, tag = "10")]
pub activations: ::prost::alloc::vec::Vec<ActivationParams>,
///
/// If false output is just the result after final state update.
/// If true, output is a sequence, containing outputs at all time steps.
#[prost(bool, tag = "15")]
pub sequence_output: bool,
///
/// If false, no biases (``b_z``, ``b_r``, ``b_o``) are added.
#[prost(bool, tag = "20")]
pub has_bias_vectors: bool,
/// Weight Matrix W_z.
#[prost(message, optional, tag = "30")]
pub update_gate_weight_matrix: ::core::option::Option<WeightParams>,
/// Weight Matrix W_r.
#[prost(message, optional, tag = "31")]
pub reset_gate_weight_matrix: ::core::option::Option<WeightParams>,
/// Weight Matrix W_o.
#[prost(message, optional, tag = "32")]
pub output_gate_weight_matrix: ::core::option::Option<WeightParams>,
/// Recursion Weight Matrix R_z.
#[prost(message, optional, tag = "50")]
pub update_gate_recursion_matrix: ::core::option::Option<WeightParams>,
/// Recursion Weight Matrix R_r.
#[prost(message, optional, tag = "51")]
pub reset_gate_recursion_matrix: ::core::option::Option<WeightParams>,
/// Recursion Weight Matrix R_o.
#[prost(message, optional, tag = "52")]
pub output_gate_recursion_matrix: ::core::option::Option<WeightParams>,
/// Bias vector b_z.
#[prost(message, optional, tag = "70")]
pub update_gate_bias_vector: ::core::option::Option<WeightParams>,
/// Bias vector b_r.
#[prost(message, optional, tag = "71")]
pub reset_gate_bias_vector: ::core::option::Option<WeightParams>,
/// Bias vector b_o.
#[prost(message, optional, tag = "72")]
pub output_gate_bias_vector: ::core::option::Option<WeightParams>,
/// If true, then the node processes the input sequence from right to left
#[prost(bool, tag = "100")]
pub reverse_input: bool,
}
///
/// Long short-term memory (LSTM) parameters.
///
/// This is described by the following equations:
///
/// Input Gate
/// .. math::
/// \boldsymbol{i_t} = \
/// f(\mathrm{clip}(W_i \boldsymbol{x_t} + \
/// R_i \boldsymbol{y_{t-1}} + \
/// p_i \odot c_{t-1} + b_i))
///
/// Forget Gate
/// .. math::
/// \boldsymbol{f_t} = \
/// f(\mathrm{clip}(W_f \boldsymbol{x_t} + \
/// R_f \boldsymbol{y_{t-1}} + \
/// p_f \odot c_{t-1} + b_f))
///
/// Block Input
/// .. math::
/// \boldsymbol{z_t} = \
/// g(\mathrm{clip}(W_z \boldsymbol{x_t} + \
/// R_z \boldsymbol{y_{t-1}} + b_z))
///
/// Cell Memory State
/// .. math::
/// \boldsymbol{c_t} = \
/// \boldsymbol{c_{t-1}} \odot \boldsymbol{f_t} + \
/// \boldsymbol{i_t} \odot \boldsymbol{z_t}
///
/// Output Gate
/// .. math::
/// \boldsymbol{o_t} = \
/// f(\mathrm{clip}(W_o \boldsymbol{x_t} + \
/// R_o \boldsymbol{y_{t-1}} + \
/// p_o \odot c_t + b_o))
///
/// Output
/// .. math::
/// \boldsymbol{y_t} = \
/// h(\boldsymbol{c_t}) \odot \boldsymbol{o_t}
///
/// - ``W_i``, ``W_f``, ``W_z``, ``W_o`` are 2-dimensional input weight matrices
/// (``\[outputVectorSize, inputVectorSize\]``, row-major)
/// - ``R_i``, ``R_f``, ``R_z``, ``R_o`` are 2-dimensional recursion matrices
/// (``\[outputVectorSize, outputVectorSize\]``, row-major)
/// - ``b_i``, ``b_f``, ``b_z``, ``b_o`` are 1-dimensional bias vectors
/// (``\[outputVectorSize\]``)
/// - ``p_``, ``p_f``, ``p_o`` are 1-dimensional peephole vectors
/// (``\[outputVectorSize\]``)
/// - ``f()``, ``g()``, ``h()`` are activations
/// - ``clip()`` is a function that constrains values between ``\[-50.0, 50.0\]``
/// - ``⊙`` denotes the elementwise product of matrices
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct LstmParams {
///
/// If true, output is a sequence, containing outputs at all time steps.
/// If false, output is just the result after final state update.
#[prost(bool, tag = "10")]
pub sequence_output: bool,
///
/// If false, no biases (``b_i``, ``b_f``, ``b_z``, ``b_o``) are added.
#[prost(bool, tag = "20")]
pub has_bias_vectors: bool,
///
/// If true, a vector of ``1`` values is added to ``b_f``.
#[prost(bool, tag = "30")]
pub forget_bias: bool,
///
/// If true, peephole vectors are included.
#[prost(bool, tag = "40")]
pub has_peephole_vectors: bool,
///
/// If the coupled Input and Forget flag is on, the behaviour of
/// ``c_t`` is changed to the following (i.e. forget gate is not used):
///
/// .. math::
/// \boldsymbol{c_t} = \
/// \boldsymbol{c_{t-1}} \odot (1 - \boldsymbol{i_t}) + \
/// \boldsymbol{i_t} \odot \boldsymbol{z_t}
///
#[prost(bool, tag = "50")]
pub coupled_input_and_forget_gate: bool,
///
/// Places a limit on the maximum and minimum values of ``c_t``.
/// c_t = min(c_t, cellClipThreshold)
/// c_t = max(c_t, -cellClipThreshold)
/// If 0, it is set to its default value = 50.0.
#[prost(float, tag = "60")]
pub cell_clip_threshold: f32,
}
///
/// Weights for long short-term memory (LSTM) layers
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LstmWeightParams {
/// Weight Matrix W_i.
#[prost(message, optional, tag = "1")]
pub input_gate_weight_matrix: ::core::option::Option<WeightParams>,
/// Weight Matrix W_f.
#[prost(message, optional, tag = "2")]
pub forget_gate_weight_matrix: ::core::option::Option<WeightParams>,
/// Weight Matrix W_z.
#[prost(message, optional, tag = "3")]
pub block_input_weight_matrix: ::core::option::Option<WeightParams>,
/// Weight Matrix W_o.
#[prost(message, optional, tag = "4")]
pub output_gate_weight_matrix: ::core::option::Option<WeightParams>,
/// Recursion Weight Matrix R_i.
#[prost(message, optional, tag = "20")]
pub input_gate_recursion_matrix: ::core::option::Option<WeightParams>,
/// Recursion Weight Matrix R_f.
#[prost(message, optional, tag = "21")]
pub forget_gate_recursion_matrix: ::core::option::Option<WeightParams>,
/// Recursion Weight Matrix R_z.
#[prost(message, optional, tag = "22")]
pub block_input_recursion_matrix: ::core::option::Option<WeightParams>,
/// Recursion Weight Matrix R_o.
#[prost(message, optional, tag = "23")]
pub output_gate_recursion_matrix: ::core::option::Option<WeightParams>,
/// biases:
///
/// Bias vector b_i.
#[prost(message, optional, tag = "40")]
pub input_gate_bias_vector: ::core::option::Option<WeightParams>,
/// Bias vector b_f.
#[prost(message, optional, tag = "41")]
pub forget_gate_bias_vector: ::core::option::Option<WeightParams>,
/// Bias vector b_z.
#[prost(message, optional, tag = "42")]
pub block_input_bias_vector: ::core::option::Option<WeightParams>,
/// Bias vector b_o.
#[prost(message, optional, tag = "43")]
pub output_gate_bias_vector: ::core::option::Option<WeightParams>,
/// peepholes:
///
/// Peephole vector p_i.
#[prost(message, optional, tag = "60")]
pub input_gate_peephole_vector: ::core::option::Option<WeightParams>,
/// Peephole vector p_f.
#[prost(message, optional, tag = "61")]
pub forget_gate_peephole_vector: ::core::option::Option<WeightParams>,
/// Peephole vector p_o.
#[prost(message, optional, tag = "62")]
pub output_gate_peephole_vector: ::core::option::Option<WeightParams>,
}
///
/// A unidirectional long short-term memory (LSTM) layer.
///
/// .. code::
///
/// (y_t, c_t) = UniDirectionalLSTMLayer(x_t, y_{t-1}, c_{t-1})
///
/// Input
/// A blob of rank 5, with shape `\[Seq, Batch, inputVectorSize, 1, 1\]``.
/// This represents a sequence of vectors of size ``inputVectorSize``.
/// Output
/// Same rank as the input.
/// Represents a vector of size ``outputVectorSize``. It is either the final output or a sequence of outputs at all time steps.
///
/// - Output Shape: ``\[1, Batch, outputVectorSize, 1, 1\]`` , if ``sequenceOutput == false``
/// - Output Shape: ``\[Seq, Batch, outputVectorSize, 1, 1\]`` , if ``sequenceOutput == true``
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UniDirectionalLstmLayerParams {
/// Size of the input vectors.
#[prost(uint64, tag = "1")]
pub input_vector_size: u64,
/// Size of the output vectors.
#[prost(uint64, tag = "2")]
pub output_vector_size: u64,
///
/// 3 element array representing activations \[f(),g(),h()\] in that order.
/// Typical values used = \[sigmoid, tanh, tanh\].
/// Activations supported are Linear, Sigmoid, Tanh, ReLU, Scaled Tanh (alpha = 1.71, beta = 2/3), Hard sigmoid (alpha = 0.2, beta = 0.5)
#[prost(message, repeated, tag = "10")]
pub activations: ::prost::alloc::vec::Vec<ActivationParams>,
#[prost(message, optional, tag = "15")]
pub params: ::core::option::Option<LstmParams>,
/// Weights, biases and peepholes.
#[prost(message, optional, tag = "20")]
pub weight_params: ::core::option::Option<LstmWeightParams>,
/// If true, then the node processes the input sequence from right to left
#[prost(bool, tag = "100")]
pub reverse_input: bool,
}
///
/// Bidirectional long short-term memory (LSTM) layer
///
/// .. code::
///
/// (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)
///
/// Input
/// A blob of rank 5, with shape `\[Seq, Batch, inputVectorSize, 1, 1\]``.
/// This represents a sequence of vectors of size ``inputVectorSize``.
/// Output
/// Same rank as the input.
/// Represents a vector of size ``2 * outputVectorSize``. It is either the final output or a sequence of outputs at all time steps.
///
/// - Output Shape: ``\[1, Batch, 2 * outputVectorSize, 1, 1\]`` , if ``sequenceOutput == false``
/// - Output Shape: ``\[Seq, Batch, 2 * outputVectorSize, 1, 1\]`` , if ``sequenceOutput == true``
///
///
/// The first LSTM operates on the input sequence in the forward direction.
/// The second LSTM operates on the input sequence in the reverse direction.
///
/// Example: given the input sequence ``\[x_1, x_2, x_3\]``,
/// where ``x_i`` are vectors at time index ``i``:
///
/// The forward LSTM output is ``\[yf_1, yf_2, yf_3\]``,
///
/// where ``yf_i`` are vectors of size ``outputVectorSize``:
///
/// - ``yf_1`` is the output at the end of sequence {``x_1``}
/// - ``yf_2`` is the output at the end of sequence {``x_1``, ``x_2``}
/// - ``yf_3`` is the output at the end of sequence {``x_1``, ``x_2``, ``x_3``}
///
/// The backward LSTM output: ``\[yb_1, yb_2, yb_3\]``,
///
/// where ``yb_i`` are vectors of size ``outputVectorSize``:
///
/// - ``yb_1`` is the output at the end of sequence {``x_3``}
/// - ``yb_2`` is the output at the end of sequence {``x_3``, ``x_2``}
/// - ``yb_3`` is the output at the end of sequence {``x_3``, ``x_2``, ``x_1``}
///
/// Output of the bi-dir layer:
///
/// - if ``sequenceOutput = True`` : { ``\[yf_1, yb_3\]``, ``\[yf_2, yb_2\]``, ``\[yf_3, yb_1\]`` }
/// - if ``sequenceOutput = False`` : { ``\[yf_3, yb_3\]`` }
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BiDirectionalLstmLayerParams {
///
/// Size of the input vectors.
#[prost(uint64, tag = "1")]
pub input_vector_size: u64,
///
/// Size of the outputs vectors.
/// It is same for both forward and backward LSTMs.
#[prost(uint64, tag = "2")]
pub output_vector_size: u64,
///
/// 3 element array representing activations \[f(),g(),h()\] in that order.
/// Typical values used = \[sigmoid, tanh, tanh\].
/// Activations supported are Linear, Sigmoid, Tanh, ReLU, Scaled Tanh (alpha = 1.71, beta = 2/3), Hard sigmoid (alpha = 0.2, beta = 0.5)
#[prost(message, repeated, tag = "10")]
pub activations_forward_lstm: ::prost::alloc::vec::Vec<ActivationParams>,
///
/// Currently, backward LSTM activations
/// must be same as the ones for the forward LSTM.
#[prost(message, repeated, tag = "11")]
pub activations_backward_lstm: ::prost::alloc::vec::Vec<ActivationParams>,
///
/// Common parameters shared by the forward and backward LSTMs.
#[prost(message, optional, tag = "15")]
pub params: ::core::option::Option<LstmParams>,
///
/// Weights and biases.
/// Must be a length 2 message,
/// for the forward and backward LSTM respectively.
#[prost(message, repeated, tag = "20")]
pub weight_params: ::prost::alloc::vec::Vec<LstmWeightParams>,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CustomLayerParams {
/// The name of the class (conforming to MLCustomLayer) corresponding to this layer
#[prost(string, tag = "10")]
pub class_name: ::prost::alloc::string::String,
/// Any weights -- these are serialized in binary format and memmapped at runtime
#[prost(message, repeated, tag = "20")]
pub weights: ::prost::alloc::vec::Vec<WeightParams>,
/// these may be handled as strings, so this should not be large
#[prost(map = "string, message", tag = "30")]
pub parameters: ::std::collections::HashMap<
::prost::alloc::string::String,
custom_layer_params::CustomLayerParamValue,
>,
/// 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.
#[prost(string, tag = "40")]
pub description: ::prost::alloc::string::String,
}
/// Nested message and enum types in `CustomLayerParams`.
pub mod custom_layer_params {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CustomLayerParamValue {
#[prost(oneof = "custom_layer_param_value::Value", tags = "10, 20, 30, 40, 50")]
pub value: ::core::option::Option<custom_layer_param_value::Value>,
}
/// Nested message and enum types in `CustomLayerParamValue`.
pub mod custom_layer_param_value {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Value {
#[prost(double, tag = "10")]
DoubleValue(f64),
#[prost(string, tag = "20")]
StringValue(::prost::alloc::string::String),
#[prost(int32, tag = "30")]
IntValue(i32),
#[prost(int64, tag = "40")]
LongValue(i64),
#[prost(bool, tag = "50")]
BoolValue(bool),
}
}
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TransposeLayerParams {
///
/// Length of "axes" should match the rank of input & output tensor
/// "axes" should be a permutation of "\[0,1,2,...,N-1\]" where N is the rank.
///
///
#[prost(uint64, repeated, tag = "1")]
pub axes: ::prost::alloc::vec::Vec<u64>,
}
///
/// A layer that computes the matrix multiplication of two tensors with numpy-like broadcasting
/// where the matrices reside in the last two indices of the tensor.
///
/// .. code::
///
/// y = BatchedMatMul(a,b)
///
/// Requires 1 or 2 inputs and produces 1 output.
///
/// 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.
///
/// Input
/// - a: First N-Dimensional tensor
/// - b: Second N-Dimensional tensor (either a rank-N input or a matrix, i.e. N=2, provided as a layer parameter)
///
/// Output
/// A tensor containing the matrix product of two tensors.
/// When there are two inputs: rank is max(2, rank(a), rank(b))
/// When there is one input: rank is same as that of the input.
///
/// This operation behaves as following:
///
/// When there are two inputs:
/// - If N >= 2 for both tensors, it is treated as a batch of matrices residing in the last two indices.
/// All the indices, except for the last two, are broadcasted using conventional rules.
/// - 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)
/// - 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)
///
/// When there is one input:
/// - The weight matrix corresponds to a matrix, of shape (X1, X2). Values of X1, X2 must be provided as layer parameters.
/// - The input, "a", is reshaped into a matrix by combining all the leading dimensions, except the last, into a batch dimension. eg:
/// - if "a" is rank 1 (X1,) --> (1, X1). Output shape will be (X2,)
/// - if "a" is rank 2 (B1, X1) --> no need to reshape. Output shape will be (B1, X2)
/// - if "a" is rank 3 (B1, B2, X1) --> (B1 * B2, X1). Output shape will be (B1, B2, X2)
/// - etc
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchedMatMulLayerParams {
///
/// If transposeA is true, it transposes the left matrix on the fly before matrix multiplication.
/// (is ignored when there is one input)
#[prost(bool, tag = "1")]
pub transpose_a: bool,
///
/// If transposeB is true, it transposes the right matrix on the fly before matrix multiplication.
/// (is ignored when there is one input)
#[prost(bool, tag = "2")]
pub transpose_b: bool,
/// X1: same as the last dimension of the input tensor
#[prost(uint64, tag = "5")]
pub weight_matrix_first_dimension: u64,
/// X2: same as the last dimension of the output tensor
#[prost(uint64, tag = "6")]
pub weight_matrix_second_dimension: u64,
/// Whether a bias is added or not. Supported only when there is one input.
#[prost(bool, tag = "7")]
pub has_bias: bool,
///
/// Weight matrix representing shape \[X1, X2\].
/// Values are however stored in column major order,
/// in the "repeated float" or "bytes" fields of the message "WeightParams"
#[prost(message, optional, tag = "8")]
pub weights: ::core::option::Option<WeightParams>,
/// Bias vector \[X2\]. Supported only when there is one input.
#[prost(message, optional, tag = "9")]
pub bias: ::core::option::Option<WeightParams>,
///
/// If set, this layer, at runtime, quantizes the floating point input blob to int8 before applying the
/// matrix multiplication using the INT8 weight parameters provided in weights->int8RawValue. The
/// result is then dequantized.
/// Requires:
/// * number of inputs to be 1
/// * hasBias == false
/// * QuantizationType == LinearQuantizationParams, such that
/// * size of the "scale" field is 1 and "bias" field is empty in "LinearQuantizationParams"
/// * numberOfBits == 8
/// * weights->rawValue_size to be empty
#[prost(bool, tag = "10")]
pub int8_dynamic_quantize: bool,
}
///
/// A layer that concatenates a list of tensors along a specified axis.
///
/// .. code::
///
/// y = ConcatNDLayer(x1,x2,....)
///
/// Requires at least 2 input and produces 1 output.
///
/// Input
/// The rank of the input tensors must match and all dimensions also must match, except for the dimension 'axis'.
///
///
/// Output
/// Same rank as the input. The dimension along "axis", is the sum of the dimensions of the inputs.
///
/// example:
///
/// in1 : shape (3, 2), value = \[[1, 2\], \[3, 4\], \[5, 6]\]
/// in2 : shape (3, 2), value = \[[7, 8\], \[9, 10\], \[11, 12]\]
/// axis = 0
///
/// if interleave = False (default)
/// output : shape (6, 2)
/// output\[0:3, :\] = in1
/// output\[3:6, :\] = in2
/// value = \[[1, 2\], \[3, 4\], \[5, 6\], \[7, 8\], \[9, 10\], \[11, 12]\]
///
/// if interleave = True
/// output : shape (6, 2)
/// output\[0::2, :\] = in1
/// output\[1::2, :\] = in2
/// value = \[[1, 2\], \[7, 8\], \[3, 4\], \[9, 10\], \[5, 6\], \[11, 12]\]
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ConcatNdLayerParams {
///
/// Dimension along which to concatenate. Supports negative values of the parameter 'axis'.
#[prost(int64, tag = "1")]
pub axis: i64,
///
/// (Only available in Core ML Specification >= 5 (iOS >= 14, macOS >= 11.0)
/// Interleave option. If True, concatenation is done via interleaving the inputs.
/// This requires all inputs to have the exact same shape.
#[prost(bool, tag = "2")]
pub interleave: bool,
}
///
/// A layer that performs softmax normalization along a specified axis.
///
/// .. code::
///
/// y = SoftmaxNDLayer(x)
///
/// Requires 1 input and produces 1 output.
///
/// Output shape is same as the input.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SoftmaxNdLayerParams {
///
/// Dimension on which the softmax would be performed. Supports negative values of the parameter 'axis'.
#[prost(int64, tag = "1")]
pub axis: i64,
}
///
/// A layer that reverses specific dimensions of the input tensor.
/// It is similar in functionality to the numpy.flip method.
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReverseLayerParams {
///
/// Reverses each dimension of the input tensor for which corresponding reverseDim is set to True.
/// Requires len(reverseDim) == rank(inputTensor)
#[prost(bool, repeated, tag = "1")]
pub reverse_dim: ::prost::alloc::vec::Vec<bool>,
}
///
/// A layer that reverses variable length slices.
///
/// Requires 2 inputs and produces 1 output.
///
/// 2 inputs, in order are denoted by "data", "seq_lengths".
/// "seq_lenghts" must be a rank 1 tensor, i.e. seq_lengths.shape = (B,)
/// which contains the lengths of the amount of sequence to be reversed, for each element of the batch.
/// Dimension "batchAxis" in "data" must be equal to B, i.e,
/// data.shape\[batchAxis\] = B.
///
/// According to the batch axis, input "data" is first divided into a batch of B inputs,
/// each of which is flipped along the dimension "sequenceAxis", by the amount specified in
/// "seq_lengths", the second input.
///
/// e.g.:
///
/// data \[shape = (2,4)\]:
/// \[0 1 2 3\]
/// \[4 5 6 7\]
/// seq_lengths \[shape = (2,)\]:
/// \[3, 0\]
/// batchAxis = 0
/// sequenceAxis = 1
///
/// output \[shape = (2,4)\]:
/// \[2 1 0 3\]
/// \[4 5 6 7\]
///
///
/// data \[shape = (2,3,2)\]:
/// \[0 1\]
/// \[2 3\]
/// \[4 5\] (slice = 0)
/// \[6 7\]
/// \[8 9\]
/// \[10 11\] (slice = 1)
/// seq_lengths \[shape = (2,)\]:
/// \[2, 3\]
/// batchAxis = 0
/// sequenceAxis = 1
///
/// output \[shape = (2,3,2)\]:
/// \[2 3\]
/// \[0 1\]
/// \[4 5\] (slice = 0)
/// \[10 11\]
/// \[8 9\]
/// \[6 7\] (slice = 1)
///
/// Output shape is same as the input.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReverseSeqLayerParams {
/// batch axis has to be strictly less than seq_axis
#[prost(int64, tag = "1")]
pub batch_axis: i64,
#[prost(int64, tag = "2")]
pub sequence_axis: i64,
}
///
/// A layer that loads data as a parameter and provides it as an output.
///
/// .. code::
///
/// y = LoadConstantNDLayer()
///
/// Requires no input and produces 1 output.
///
/// Output: A tensor with shape as provided in the parameter "shape"
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LoadConstantNdLayerParams {
///
/// The shape of the constant to be loaded.
#[prost(uint64, repeated, tag = "1")]
pub shape: ::prost::alloc::vec::Vec<u64>,
#[prost(message, optional, tag = "2")]
pub data: ::core::option::Option<WeightParams>,
}
///
/// A layer that generates an output tensor with a constant value.
/// Input is only used to determine the shape of the output.
/// This layer is used to allocate a tensor with a dynamic shape (that of the input) and constant value.
///
/// Requires 1 input and produces 1 output.
///
/// .. code::
///
/// y = FillLikeLayer(x)
///
/// Input
/// A N-Dimensional tensor, whose values are ignored. Only the shape is used to
/// infer the shape of the output.
///
/// Output
/// A N-Dimensional tensor with the same shape as the input tensor.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FillLikeLayerParams {
#[prost(float, tag = "1")]
pub value: f32,
}
///
/// A layer that generates an output tensor with a constant value.
/// This layer is used to allocate a tensor with a static shape and constant value.
///
/// Requires no input and produces 1 output.
///
/// .. code::
///
/// y = FillStaticLayer(x)
///
/// Output
/// A N-Dimensional tensor of shape "targetShape".
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FillStaticLayerParams {
#[prost(float, tag = "1")]
pub value: f32,
#[prost(uint64, repeated, tag = "2")]
pub target_shape: ::prost::alloc::vec::Vec<u64>,
}
///
/// A layer that generates an output tensor with a constant value.
/// This layer is used to allocate a tensor with a dynamic shape (as specified by the input) and constant value.
///
/// Requires 1 input and produces 1 output.
///
/// .. code::
///
/// y = FillDynamicLayer(x)
///
/// Input
/// A rank 1 tensor specifying the shape of the output
///
/// Output
/// An N-Dimensional tensor with the shape specified by the values in the input tensor.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FillDynamicLayerParams {
#[prost(float, tag = "1")]
pub value: f32,
}
///
/// A layer that returns the elements either from tensor x or tensor y,
/// depending on the value in the condition tensor.
/// It is similar in functionality to the numpy.where method with 3 inputs.
///
/// Requires 3 inputs and produces 1 output.
/// Inputs, in order, are the condition tensor, x and y.
///
/// for each vector index (i,...,j):
/// output\[i,...,j\] = x\[i,...,j\] if condition\[i,...,j\] = True
/// y\[i,...,j\] if condition\[i,...,j\] = False
///
/// All the 3 inputs are first broadcasted to a common shape.
/// (the shapes must be broadcastable)
///
/// output.rank = max(input\[0\].rank, input\[1\].rank, input\[2\].rank)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WhereBroadcastableLayerParams {}
///
/// A layer that computes elementwise trigonometric sine function.
///
///
/// .. code::
///
/// y = SinLayer(x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SinLayerParams {}
///
/// A layer that computes elementwise trigonometric cosine function.
///
///
/// .. code::
///
/// y = CosLayer(x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CosLayerParams {}
///
/// A layer that computes elementwise trigonometric tangent function.
///
///
/// .. code::
///
/// y = TanLayer(x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TanLayerParams {}
///
/// A layer that computes elementwise trigonometric arcsine function.
///
///
/// .. code::
///
/// y = AsinLayer(x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AsinLayerParams {}
///
/// A layer that computes elementwise trigonometric arccosine function.
///
///
/// .. code::
///
/// y = AcosLayer(x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AcosLayerParams {}
///
/// A layer that computes elementwise trigonometric arctangent function.
///
///
/// .. code::
///
/// y = AtanLayer(x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AtanLayerParams {}
///
/// A layer that computes elementwise trigonometric hyperbolic sine function.
///
///
/// .. code::
///
/// y = SinhLayer(x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SinhLayerParams {}
///
/// A layer that computes elementwise trigonometric hyperbolic cosine function.
///
///
/// .. code::
///
/// y = CoshLayer(x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CoshLayerParams {}
///
/// A layer that computes elementwise trigonometric hyperbolic tangent function.
///
///
/// .. code::
///
/// y = TanhLayer(x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TanhLayerParams {}
///
/// A layer that computes elementwise trigonometric hyperbolic arcsine function.
///
///
/// .. code::
///
/// y = AsinhLayer(x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AsinhLayerParams {}
///
/// A layer that computes elementwise trigonometric hyperbolic arccosine function.
///
///
/// .. code::
///
/// y = AcoshLayer(x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AcoshLayerParams {}
///
/// A layer that computes elementwise trigonometric hyperbolic arctangent function.
///
///
/// .. code::
///
/// y = AtanhLayer(x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AtanhLayerParams {}
///
/// A layer that raises each element in first tensor to the power of
/// corresponding element in the second tensor.
/// Supports conventional numpy-like broadcasting.
///
/// .. code::
///
/// y = PowBroadcastableLayer(x)
///
/// Requires 2 inputs and produces 1 output.
///
/// Input
/// - First N-Dimensional tensor
/// - Second N-Dimensional tensor
///
/// Output
/// An N-Dimensional tensor with the broadcast shape.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PowBroadcastableLayerParams {}
///
/// A layer that computes the exponential of all elements in the input tensor, with the base 2.
///
///
/// .. code::
///
/// y = Exp2Layer(x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Exp2LayerParams {}
///
/// A layer that returns a tensor containing the indices of all non-zero
/// elements of input tensor.
/// It is similar in functionality to the numpy.where method with 1 input.
///
/// Requires 1 input and produces 1 output.
/// Output is of rank 2, of shape (N,R),
/// where N is the number of non-zero elements in the input and R is the rank of the input.
///
/// Output contains indices represented in the multi-index form
///
/// e.g.:
/// input {shape = (4,)}:
/// \[0 1 0 2\]
/// output {shape = (2,1)}:
/// \[1\]
/// \[3\]
///
///
/// input {shape = (3, 3)}:
/// \[1 2 1\]
/// \[0 2 2\]
/// \[2 1 0\]
/// output {shape = (7,1)}:
/// \[0. 0.\]
/// \[0. 1.\]
/// \[0. 2.\]
/// \[1. 1.\]
/// \[1. 2.\]
/// \[2. 0.\]
/// \[2. 1.\]
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WhereNonZeroLayerParams {}
///
/// A layer that copies a tensor setting everything outside a central band in
/// each inner-most matrix to zero.
///
/// Requires 1 input and produces 1 output.
///
/// Parameters for matrix_band_part layer
/// band(m, n) = (num_lower < 0 || (m-n) <= num_lower) && (num_upper < 0 || (n-m) <= num_upper).
/// output\[i, j, k, ..., m, n\] = band(m, n) * input\[i, j, k, ..., m, n\]
///
///
/// Output shape is same as the input shape.
/// Rank of the input must be at least 2.
/// For rank higher than 2, the last 2 dimensions are treated as the matrix, while the rest are treated as batch.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MatrixBandPartLayerParams {
#[prost(int64, tag = "1")]
pub num_lower: i64,
#[prost(int64, tag = "2")]
pub num_upper: i64,
}
///
/// A layer that copies a tensor setting everything outside upper triangular to zero.
///
/// Requires 1 input and produces 1 output.
///
/// Output shape is same as the input shape.
/// Rank of the input must be at least 2.
/// For rank higher than 2, the last 2 dimensions are treated as the matrix, while the rest are treated as batch.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UpperTriangularLayerParams {
/// Diagonal below which to zero elements. k = 0 (the default) is the main diagonal, k < 0 is below it and k > 0 is above
#[prost(int64, tag = "1")]
pub k: i64,
}
///
/// A layer that copies a tensor setting everything outside lower triangular to zero.
///
/// Requires 1 input and produces 1 output.
///
/// Output shape is same as the input shape.
/// Rank of the input must be at least 2.
/// For rank higher than 2, the last 2 dimensions are treated as the matrix, while the rest are treated as batch.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LowerTriangularLayerParams {
/// Diagonal above which to zero elements. k = 0 (the default) is the main diagonal, k < 0 is below it and k > 0 is above
#[prost(int64, tag = "1")]
pub k: i64,
}
///
///
/// A layer that broadcasts a tensor to a new shape.
///
/// Requires 2 inputs and produces 1 output.
///
/// First input is broadcast to produce the output, while the second input is only
/// used to determine the shape of the output. Values of second input are not used.
///
/// Output is a tensor with the same shape as the second input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BroadcastToLikeLayerParams {}
///
///
/// A layer that broadcasts a tensor to a new shape.
///
/// Requires 1 input and produces 1 output.
///
/// Output tensor is the broadcasted version of the input and has shape as specified in the
/// parameter "targetShape".
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BroadcastToStaticLayerParams {
#[prost(uint64, repeated, tag = "1")]
pub target_shape: ::prost::alloc::vec::Vec<u64>,
}
///
///
/// A layer that broadcasts a tensor to a new shape.
///
/// Requires 2 inputs and produces 1 output.
///
/// First input is the one that is broadcasted to produce the output.
/// Second input is a rank 1 tensor specifying the shape of the output.
/// Output tensor has shape as specified by the values in the 2nd input tensor.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct BroadcastToDynamicLayerParams {}
///
/// A layer that performs element-wise addition operation with broadcast support.
///
/// Requires 2 inputs and produces 1 output.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AddBroadcastableLayerParams {}
///
/// A layer that performs element-wise maximum operation with broadcast support.
///
/// Requires 2 inputs and produces 1 output.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MaxBroadcastableLayerParams {}
///
/// A layer that performs element-wise minimum operation with broadcast support.
///
/// Requires 2 inputs and produces 1 output.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MinBroadcastableLayerParams {}
///
/// A layer that performs element-wise modular operation with broadcast support.
///
/// Requires 2 inputs and produces 1 output.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ModBroadcastableLayerParams {}
///
/// A layer that performs element-wise floor division operation with broadcast support.
///
/// Requires 2 inputs and produces 1 output.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FloorDivBroadcastableLayerParams {}
///
/// A layer that performs element-wise subtract operation with broadcast support.
///
/// Requires 2 inputs and produces 1 output.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SubtractBroadcastableLayerParams {}
///
/// A layer that performs element-wise multiply operation with broadcast support.
///
/// Requires 2 inputs and produces 1 output.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MultiplyBroadcastableLayerParams {}
///
/// A layer that performs element-wise division operation with broadcast support.
///
/// Requires 2 inputs and produces 1 output.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DivideBroadcastableLayerParams {}
///
/// Gather layer that gathers elements from the first input, along a specified axis,
/// at indices specified in the second input.
/// It is similar in functionality to the numpy.take method.
///
/// Requires 2 inputs and produces 1 output.
///
/// Given two inputs, 'data' and 'indices', gather the slices of 'data'
/// and store into output.
/// e.g.
/// for i in \[0, length(indices) - 1\]
/// output\[i\] = data\[indices[i]\] (1-D case, axis=0)
///
/// if axis = 0:
/// for each vector index (i,...,j)
/// output\[i,...,j,:,..,:\] = data\[indices[i,...,j\],:,..,:]
///
/// output.rank = (data.rank - 1) + indices.rank
///
/// Negative indices and negative axis are supported.
///
/// e.g:
///
/// data shape = (2, 3)
/// indices shape = (6, 8)
/// axis = 0
/// output shape = (6, 8) + (3,) = (6, 8, 3)
///
/// data shape = (2, 3, 5)
/// indices shape = (6, 8)
/// axis = 1
/// output shape = (2,) + (6, 8) + (5,) = (2, 6, 8, 5)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GatherLayerParams {
#[prost(int64, tag = "1")]
pub axis: i64,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ScatterLayerParams {
#[prost(int64, tag = "1")]
pub axis: i64,
/// mode of accumulation.
#[prost(enumeration = "ScatterMode", tag = "2")]
pub mode: i32,
}
///
/// A layer that gathers elements from the first input, 'params', at the multi-indices specified
/// by the second input, 'indices'.
///
/// Requires 2 inputs and produces 1 output.
///
/// 'params' = input\[0\], 'indices' = input\[1\]
///
/// '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
/// 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
/// is indices\[0,0,...,0,:\].
///
/// Here is how the output is constructed:
///
/// for i = 0,1,...,(I_0-1)
/// ...
/// for j = 0,1,....,(I_(K-1)-1)
/// output\[i,....,j,:,:,..,:\] = params\[indices[i,...,j,:\], :,:,..,:]
///
/// Hence, output shape is \[I_0, I_1,...,I(K-1)\] + params.shape\[I_K:\]
///
/// output.rank = indices.rank - 1 + params.rank - indices.shape\[-1\]
///
/// e.g:
///
/// input\[0\] shape = (4, 2, 3, 4)
/// input\[1\] shape = (6, 2)
/// output shape = (6,) + (3, 4) = (6, 3, 4)
///
/// input\[0\] shape = (3, 3, 3, 4, 7)
/// input\[1\] shape = (3, 5)
/// output shape = (3,) + () = (3,)
///
/// input\[0\] shape = (5, 3, 2, 5)
/// input\[1\] shape = (2, 7, 3, 2)
/// output shape = (2, 7, 3) + (2, 5) = (2, 7, 3, 2, 5)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GatherNdLayerParams {}
///
/// A layer that scatters data into a new tensor according to multi-indices from the input.
/// This is the inverse operation of GatherND.
///
/// Requires 3 inputs and produces 1 output.
/// 3 inputs, in order are denoted as "container", "indices", "updates".
///
/// '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
/// 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
/// is indices\[0,0,...,0,:\].
///
/// container.rank >= I_K
/// updates.rank = K + (container.rank - I_K)
/// shape of 'updates' = \[I_0, I_1,...,I(K-1)\] + container.shape\[I_K:\]
///
/// output = container
/// For each vector index (i,...,j) s.t. 0<=i<I_0,..., 0<=j<I_K
/// output\[indices[i,...,j,:\], :,:,..,:] = updates\[i,....,j,:,:,..,:\] // if mode == "SCATTER_UPDATE"
///
/// The output has the same shape as the first input.
///
/// e.g:
///
/// container shape = (3, 2)
/// indices shape = (4, 2)
/// updates shape = (4,)
/// output shape = (3, 2)
///
/// container shape = (7, 6)
/// indices shape = (4, 7, 2, 5, 1)
/// updates shape = (4, 7, 2, 5, 6)
/// output shape = (7, 6)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ScatterNdLayerParams {
/// mode of accumulation.
#[prost(enumeration = "ScatterMode", tag = "1")]
pub mode: i32,
}
///
/// Gather layer that gathers elements from the first input, along a specified axis,
/// at indices specified in the second input.
/// It is similar in functionality to the numpy.take_along_axis method.
///
/// Requires 2 inputs and produces 1 output.
///
/// Given two inputs, 'data' and 'indices', gather the slices of 'data'
/// and store into output.
///
/// Both inputs and output have the same rank.
/// Output shape is same as the shape of 'indices'
/// Shapes of 'indices' and 'data' match, except at the 'axis' dimension.
///
/// This operation performs the following operation for axis=0:
/// for each vector index (i,j,....,k)
/// output\[i,j,....,k\] = data\[index[i,j,....,k\],j,....,k]
///
/// Negative indices and negative axis are supported.
///
/// e.g:
///
/// data shape = (4, 4, 7)
/// indices shape = (4, 5, 7)
/// axis = 1
/// output shape = (4, 5, 7)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GatherAlongAxisLayerParams {
#[prost(int64, tag = "1")]
pub axis: i64,
}
///
/// A layer that scatters data into a new tensor according to indices from
/// the input along the given axis into the output tensor.
/// This is the inverse operation of GatherAlongAxis.
/// It is similar in functionality to the numpy.put_along_axis method.
///
/// Requires 3 inputs and produces 1 output.
/// 3 inputs, in order are denoted as "container", "indices", "updates".
///
/// All inputs and output have the same rank.
/// Output shape is same as the shape of 'container'
/// Shapes of 'indices' and 'updates' match, which is same as the shape of 'container' except at the 'axis' dimension.
///
/// Negative indices and negative axis are supported.
///
/// This operation performs the following operation for axis=0:
/// output = container
/// for each vector index (i,j,....,k)
/// output\[index[i,j,....,k\],j,....,k] = updates\[i,j,....,k\]
///
/// e.g.:
///
/// container shape = (2, 5, 6)
/// indices shape = (2, 2, 6)
/// updates shape = (2, 2, 6)
/// axis = -2
/// output shape = (2, 5, 6)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ScatterAlongAxisLayerParams {
#[prost(int64, tag = "1")]
pub axis: i64,
/// mode of accumulation.
#[prost(enumeration = "ScatterMode", tag = "2")]
pub mode: i32,
}
///
/// A layer that stacks the input tensors along the given axis.
/// It is similar in functionality to the numpy.stack method.
///
/// Requires at least 2 inputs and produces 1 output.
/// All inputs must have the same shape.
/// Rank of the output is 1 greater than the rank of the inputs.
///
/// Negative indexing is supported for the "axis" parameter.
///
/// e.g.:
///
/// input shape = (2, 4, 2)
/// number of inputs = 5
/// axis = 3
/// output shape = (2, 4, 2, 5)
///
/// input shape = (2, 4, 2)
/// number of inputs = 5
/// axis = -2
/// output shape = (2, 4, 5, 2)
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StackLayerParams {
#[prost(int64, tag = "1")]
pub axis: i64,
}
///
/// A layer that reshapes a tensor that does not alter the rank of the input.
/// Order of the data is left unchanged.
///
/// Requires 1 input and produces 1 output.
///
/// e.g:
///
/// input shape = (20,10)
/// targetShape = (5,-1)
/// output shape = (5,40)
///
/// input shape = (20,10,5)
/// targetShape = (0,2,25)
/// output shape = (20,2,25)
///
/// input shape = (10,3,5)
/// targetShape = (25,0,-1)
/// output shape = (25,3,2)
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RankPreservingReshapeLayerParams {
///
/// Length of this field must be same as the input/output rank.
/// It can have 0's, in which case the corresponding input dimension is kept intact.
/// At most one element can be -1, in which case the output dimension is calculated from rest of the shape.
#[prost(int64, repeated, tag = "1")]
pub target_shape: ::prost::alloc::vec::Vec<i64>,
}
///
/// Constant padding layer.
/// Pad the input array with a constant value, either along a single given axis or along a set of axes.
///
/// Requires 1 or 2 inputs and produces 1 output.
/// The amount of padding can be either set as a parameter ("padAmounts") or provided as a second input.
///
/// Output rank is same as the rank of the first input.
///
/// when "padToGivenOutputSizeMode" is False:
///
/// output_shape\[i\] = input_shape\[i\] + padAmounts\[2*i\] + padAmounts\[2*i+1\], i=0,...,rank-1
///
/// Examples:
///
/// input shape = (20,10)
/// padAmounts = \[0,1,4,0\]
/// output shape = (21,14)
///
/// input shape = (20,10,5)
/// padAmounts = \[0,0,3,4,0,9\]
/// output shape = (20,17,14)
///
///
/// when "padToGivenOutputSizeMode" is True
///
/// output_shape\[i\] = max(input_shape\[i\], max(padAmounts\[2*i\] + padAmounts\[2*i+1\])), i=0,...,rank-1
///
/// input shape = (20,10)
/// padAmounts = \[0,21,14,0\]
/// output shape = (21,14)
///
/// input shape = (20,10,5)
/// padAmounts = \[0,0,17,0,0,14\]
/// output shape = (20,17,14)
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConstantPaddingLayerParams {
///
/// The value to be used for padding.
#[prost(float, tag = "1")]
pub value: f32,
///
/// Length of this repeated field must be twice the rank of the first input.
/// 2*i-th and (2*i+1)-th values represent the amount of padding to be applied to the the i-th input
/// dimension, "before" and "after" the input values, respectively.
#[prost(uint64, repeated, tag = "2")]
pub pad_amounts: ::prost::alloc::vec::Vec<u64>,
///
/// When this is True, positive values in "padAmounts" are equivalent to the output shape.
/// In that case only one of padAmounts\[2*i\] and padAmounts\[2*i+1\] can be non zero, for i=0,..,rank-1.
#[prost(bool, tag = "3")]
pub pad_to_given_output_size_mode: bool,
}
///
/// A layer that returns a tensor filled with values from the normal distribution.
///
/// Requires 1 input and produces 1 output.
///
/// Parameters
/// seed: seed used for the normal distribution.
/// mean: mean of the normal distribution.
/// stdDev: standard deviation of the normal distribution.
///
/// Input
/// An N-Dimensional tensor, whose values are ignored. Only the shape is used to
/// infer the shape of the output.
///
/// Output
/// An N-Dimensional tensor with the same shape as the input tensor.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RandomNormalLikeLayerParams {
#[prost(int64, tag = "1")]
pub seed: i64,
#[prost(float, tag = "2")]
pub mean: f32,
#[prost(float, tag = "3")]
pub std_dev: f32,
}
///
/// A layer that returns a tensor filled with values from the normal distribution.
///
/// Requires no input and produces 1 output.
///
/// Parameters
/// seed: seed used for the normal distribution.
/// mean: mean of the normal distribution.
/// stdDev: standard deviation of the normal distribution.
/// outputShape: shape of the output tensor.
///
/// Output
/// An N-Dimensional tensor of shape "outputShape".
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RandomNormalStaticLayerParams {
#[prost(int64, tag = "1")]
pub seed: i64,
#[prost(float, tag = "2")]
pub mean: f32,
#[prost(float, tag = "3")]
pub std_dev: f32,
#[prost(uint64, repeated, tag = "4")]
pub output_shape: ::prost::alloc::vec::Vec<u64>,
}
///
/// A layer that returns a tensor filled with values from the normal distribution.
///
/// Requires 1 input and produces 1 output.
///
/// Parameters:
/// seed: seed used for the normal distribution.
/// mean: mean of the normal distribution.
/// stdDev: standard deviation of the normal distribution.
///
/// Input
/// A rank 1 tensor specifying the shape of the output
///
/// Output
/// An N-Dimensional tensor with the shape specified by the values in the input tensor.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RandomNormalDynamicLayerParams {
#[prost(int64, tag = "1")]
pub seed: i64,
#[prost(float, tag = "2")]
pub mean: f32,
#[prost(float, tag = "3")]
pub std_dev: f32,
}
///
/// A layer that returns a tensor filled with values from the uniform distribution.
///
/// Requires 1 input and produces 1 output.
///
/// Parameters
/// seed: seed used for the uniform distribution.
/// minVal: lower bound on the range of random values for the uniform distribution.
/// maxVal: upper bound on the range of random values for the uniform distribution.
///
/// Input
/// An N-Dimensional tensor, whose values are ignored. Only the shape is used to
/// infer the shape of the output.
///
/// Output
/// An N-Dimensional tensor with the same shape as the input tensor.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RandomUniformLikeLayerParams {
#[prost(int64, tag = "1")]
pub seed: i64,
#[prost(float, tag = "2")]
pub min_val: f32,
#[prost(float, tag = "3")]
pub max_val: f32,
}
///
/// A layer that returns a tensor filled with values from the uniform distribution.
///
/// Requires no input and produces 1 output.
///
/// Parameters
/// seed: seed used for the uniform distribution.
/// minVal: lower bound on the range of random values for the uniform distribution.
/// maxVal: upper bound on the range of random values for the uniform distribution.
/// outputShape: shape of the output tensor.
///
/// Output
/// An N-Dimensional tensor of shape "outputShape".
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RandomUniformStaticLayerParams {
#[prost(int64, tag = "1")]
pub seed: i64,
#[prost(float, tag = "2")]
pub min_val: f32,
#[prost(float, tag = "3")]
pub max_val: f32,
#[prost(uint64, repeated, tag = "4")]
pub output_shape: ::prost::alloc::vec::Vec<u64>,
}
///
/// A layer that returns a tensor filled with values from the uniform distribution.
///
/// Requires 1 input and produces 1 output.
///
/// Parameters:
/// seed: seed used for the uniform distribution.
/// minVal: lower bound on the range of random values for the uniform distribution.
/// maxVal: upper bound on the range of random values for the uniform distribution.
///
/// Input
/// A rank 1 tensor specifying the shape of the output
///
/// Output
/// An N-Dimensional tensor with the shape specified by the values in the input tensor.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RandomUniformDynamicLayerParams {
#[prost(int64, tag = "1")]
pub seed: i64,
#[prost(float, tag = "2")]
pub min_val: f32,
#[prost(float, tag = "3")]
pub max_val: f32,
}
///
/// A layer that returns a tensor filled with values from the Bernoulli distribution.
///
/// Requires 1 input and produces 1 output.
///
/// Parameters
/// seed: seed used for the Bernoulli distribution.
/// prob: probability of a 1 event.
///
/// Input
/// An N-Dimensional tensor, whose values are ignored. Only the shape is used to
/// infer the shape of the output.
///
/// Output
/// An N-Dimensional tensor with the same shape as the input tensor.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RandomBernoulliLikeLayerParams {
#[prost(int64, tag = "1")]
pub seed: i64,
#[prost(float, tag = "2")]
pub prob: f32,
}
///
/// A layer that returns a tensor filled with values from the Bernoulli distribution.
///
/// Requires no input and produces 1 output.
///
/// Parameters
/// seed: seed used for the Bernoulli distribution.
/// prob: probability of a 1 event.
/// outputShape: shape of the output tensor.
///
/// Output
/// An N-Dimensional tensor of shape "outputShape".
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RandomBernoulliStaticLayerParams {
#[prost(int64, tag = "1")]
pub seed: i64,
#[prost(float, tag = "2")]
pub prob: f32,
#[prost(uint64, repeated, tag = "3")]
pub output_shape: ::prost::alloc::vec::Vec<u64>,
}
///
/// A layer that returns a tensor filled with values from the Bernoulli distribution.
///
/// Requires 1 input and produces 1 output.
///
/// Parameters:
/// seed: seed used for the Bernoulli distribution.
/// prob: probability of a 1 event.
///
/// Input
/// A rank 1 tensor specifying the shape of the output
///
/// Output
/// An N-Dimensional tensor with the shape specified by the values in the input tensor.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RandomBernoulliDynamicLayerParams {
#[prost(int64, tag = "1")]
pub seed: i64,
#[prost(float, tag = "2")]
pub prob: f32,
}
///
/// A layer that returns a tensor of the specified shape filled with values from the categorical distribution.
///
/// Requires 1 input and produces 1 output.
///
/// Parameter:
/// seed: seed used for the categorical distribution.
/// numSamples: number of samples to draw.
/// isLogits: true if the inputs are logits, false if the inputs are probabilities.
/// eps: default value is 1e-10.
/// temperature: default value is 1.0.
///
/// Input tensor shape = \[D_1, D_2, ... , D_(R-1), D_R\] (Rank = R)
/// Then the shape of the output is \[D_1, D_2, ... , D_(R-1), numSamples\] (Rank = R)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CategoricalDistributionLayerParams {
#[prost(int64, tag = "1")]
pub seed: i64,
#[prost(int64, tag = "2")]
pub num_samples: i64,
#[prost(bool, tag = "3")]
pub is_logits: bool,
#[prost(float, tag = "4")]
pub eps: f32,
#[prost(float, tag = "5")]
pub temperature: f32,
}
///
/// A layer that performs reduction with L1 normalization operation.
///
/// Negative indexing is supported.
/// Requires 1 input and produces 1 output.
///
/// Parameters:
/// axes: dimensions along which to perform reduction
/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReduceL1LayerParams {
#[prost(int64, repeated, tag = "1")]
pub axes: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, tag = "2")]
pub keep_dims: bool,
#[prost(bool, tag = "3")]
pub reduce_all: bool,
}
///
/// A layer that performs reduction with L2 normalization operation.
///
/// Negative indexing is supported.
/// Requires 1 input and produces 1 output.
///
/// Parameters:
/// axes: dimensions along which to perform reduction
/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReduceL2LayerParams {
#[prost(int64, repeated, tag = "1")]
pub axes: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, tag = "2")]
pub keep_dims: bool,
#[prost(bool, tag = "3")]
pub reduce_all: bool,
}
///
/// A layer that performs reduction with max operation.
///
/// Negative indexing is supported.
/// Requires 1 input and produces 1 output.
///
/// Parameters:
/// axes: dimensions along which to perform reduction
/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReduceMaxLayerParams {
#[prost(int64, repeated, tag = "1")]
pub axes: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, tag = "2")]
pub keep_dims: bool,
#[prost(bool, tag = "3")]
pub reduce_all: bool,
}
///
/// A layer that performs reduction with min operation.
///
/// Negative indexing is supported.
/// Requires 1 input and produces 1 output.
///
/// Parameters:
/// axes: dimensions along which to perform reduction
/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReduceMinLayerParams {
#[prost(int64, repeated, tag = "1")]
pub axes: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, tag = "2")]
pub keep_dims: bool,
#[prost(bool, tag = "3")]
pub reduce_all: bool,
}
///
/// A layer that performs reduction with sum operation.
///
/// Negative indexing is supported.
/// Requires 1 input and produces 1 output.
///
/// Parameters:
/// axes: dimensions along which to perform reduction
/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReduceSumLayerParams {
#[prost(int64, repeated, tag = "1")]
pub axes: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, tag = "2")]
pub keep_dims: bool,
#[prost(bool, tag = "3")]
pub reduce_all: bool,
}
///
/// A layer that performs reduction with prod operation.
///
/// Negative indexing is supported.
/// Requires 1 input and produces 1 output.
///
/// Parameters:
/// axes: dimensions along which to perform reduction
/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReduceProdLayerParams {
#[prost(int64, repeated, tag = "1")]
pub axes: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, tag = "2")]
pub keep_dims: bool,
#[prost(bool, tag = "3")]
pub reduce_all: bool,
}
///
/// A layer that performs reduction with mean operation.
///
/// Negative indexing is supported.
/// Requires 1 input and produces 1 output.
///
/// Parameters:
/// axes: dimensions along which to perform reduction
/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReduceMeanLayerParams {
#[prost(int64, repeated, tag = "1")]
pub axes: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, tag = "2")]
pub keep_dims: bool,
#[prost(bool, tag = "3")]
pub reduce_all: bool,
}
///
/// A layer that performs reduction with logSum operation.
///
/// Negative indexing is supported.
/// Requires 1 input and produces 1 output.
///
/// Parameters:
/// axes: dimensions along which to perform reduction
/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReduceLogSumLayerParams {
#[prost(int64, repeated, tag = "1")]
pub axes: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, tag = "2")]
pub keep_dims: bool,
#[prost(bool, tag = "3")]
pub reduce_all: bool,
}
///
/// A layer that performs reduction with logSumExp operation.
///
/// Negative indexing is supported.
/// Requires 1 input and produces 1 output.
///
/// Parameters:
/// axes: dimensions along which to perform reduction
/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReduceSumSquareLayerParams {
#[prost(int64, repeated, tag = "1")]
pub axes: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, tag = "2")]
pub keep_dims: bool,
#[prost(bool, tag = "3")]
pub reduce_all: bool,
}
///
/// A layer that performs reduction with logSumExp operation.
///
/// Negative indexing is supported.
/// Requires 1 input and produces 1 output.
///
/// Parameters:
/// axes: dimensions along which to perform reduction
/// keepDims: if True, keep the reduced dimensions (value will be 1), otherwise, reduced dimensions are squeezed
/// reduceAll: ignore the "axes" parameter, perform reduction along all axes
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReduceLogSumExpLayerParams {
#[prost(int64, repeated, tag = "1")]
pub axes: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, tag = "2")]
pub keep_dims: bool,
#[prost(bool, tag = "3")]
pub reduce_all: bool,
}
///
/// A layer that increases the rank of the input tensor by adding unit dimensions.
///
/// Requires 1 input and produces 1 output.
///
/// e.g.:
///
/// input shape = (10,5)
/// axes = (0,1)
/// output shape = (1,1,10,5)
///
/// input shape = (10,5)
/// axes = (0,2)
/// output shape = (1,10,1,5)
///
/// input shape = (10,5)
/// axes = (-2,-1)
/// output shape = (10,5,1,1)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExpandDimsLayerParams {
///
/// Axis values provided here get dimension 1 in the output tensor.
/// Negative indexing is supported.
#[prost(int64, repeated, tag = "1")]
pub axes: ::prost::alloc::vec::Vec<i64>,
}
///
/// A layer that flattens the input tensor into a 2-dimensional matrix.
///
/// Requires 1 input and produces 1 output.
/// Output tensor is always rank 2.
///
/// First dimension of output is the product of all the dimensions in input\[:axis\] ("axis" is exclusive)
/// Second dimension of output is the product of all the dimensions in input\[axis:\] ("axis" is inclusive)
///
/// e.g.:
/// input shape: (3,)
/// axis: -1
/// output shape: (1, 3)
///
/// input shape: (3,)
/// axis: 1
/// output shape: (3, 1)
///
/// input shape: (4, 3)
/// axis: -1
/// output shape: (4, 3)
///
/// input shape: (5, 2)
/// axis: 0
/// output shape: (1, 10)
///
/// input shape: (5, 5, 3)
/// axis: -2
/// output shape: (5, 15)
///
/// input shape: (2, 3, 2)
/// axis: -1
/// output shape: (6, 2)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FlattenTo2DLayerParams {
#[prost(int64, tag = "1")]
pub axis: i64,
}
///
/// A layer that reshapes a tensor.
///
/// Requires 1 input and produces 1 output.
///
/// Output tensor is the reshaped version of the input and has shape as specified in the
/// parameter "targetShape".
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReshapeStaticLayerParams {
#[prost(int64, repeated, tag = "1")]
pub target_shape: ::prost::alloc::vec::Vec<i64>,
}
///
/// A layer that reshapes a tensor.
///
/// Requires 2 inputs and produces 1 output.
///
/// First input is reshaped to produce the output, while the second input is only
/// used to determine the shape of the output. Values of the second input are not used.
///
/// Output is a tensor with the same shape as the second input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReshapeLikeLayerParams {}
///
/// A layer that reshapes a tensor.
///
/// Requires 2 inputs and produces 1 output.
///
/// First input is the one that is reshaped to produce the output.
/// Second input is a rank 1 tensor specifying the shape of the output.
/// Output tensor has shape as specified by the values in the 2nd input tensor.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ReshapeDynamicLayerParams {}
///
/// A layer that decreases the rank of the input tensor by removing unit dimensions.
///
/// Requires 1 input and produces 1 output.
///
/// Output rank is one less than input rank, if input rank is more than 1.
/// If input rank is 1, output rank is also 1.
///
/// e.g.:
///
/// input shape = (1,1,10,5)
/// axes = (0,1)
/// output shape = (10,5)
///
/// input shape = (1,10,5,1)
/// axes = (0,3)
/// output shape = (10,5)
///
/// input shape = (10,5,1,1)
/// axes = (-2,-1)
/// output shape = (10,5)
///
/// input shape = (1,)
/// axes = (0)
/// output shape = (1,)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SqueezeLayerParams {
///
/// Axis values provided here get removed from the input tensor.
/// Negative indexing is supported.
#[prost(int64, repeated, tag = "1")]
pub axes: ::prost::alloc::vec::Vec<i64>,
/// if true squeeze all dimensions that are 1.
#[prost(bool, tag = "2")]
pub squeeze_all: bool,
}
///
/// A layer that returns top K (or bottom K) values and the corresponding indices
/// of the input along a given axis.
///
/// Requires 1 or 2 inputs and produces 2 outputs.
///
/// The second input is the value of the K, and is optional.
/// If there is only one input, value of K that is specified in the layer parameter is used.
///
/// Both outputs have the same rank as the first input.
/// Second input must correspond to a scalar tensor.
///
/// e.g.:
///
/// first input's shape = (45, 34, 10, 5)
/// axis = 1
/// output shape, for both outputs = (45, K, 10, 5)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TopKLayerParams {
/// negative indexing is supported
#[prost(int64, tag = "1")]
pub axis: i64,
/// is ignored if a second input is present.
#[prost(uint64, tag = "2")]
pub k: u64,
/// if true, bottom K (values, indices) are returned instead
#[prost(bool, tag = "3")]
pub use_bottom_k: bool,
}
///
/// A layer that returns the indices of the maximum value along a specified axis in a tensor.
///
/// Requires 1 input and produces 1 output. Negative indexing is supported.
///
/// Output has the same rank as the input if "removeDim" is False (default).
/// Output has rank one less than the input if "removeDim" is True and input rank is more than 1.
///
/// e.g.:
///
/// input shape = (45, 34, 10, 5)
/// axis = -2
/// output shape = (45, 1, 10, 5), if removeDim = False (default)
/// output shape = (45, 10, 5), if removeDim = True
///
/// input shape = (5,)
/// axis = 0
/// output shape = (1,), if removeDim = False or True
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ArgMaxLayerParams {
#[prost(int64, tag = "1")]
pub axis: i64,
#[prost(bool, tag = "2")]
pub remove_dim: bool,
}
///
/// A layer that returns the indices of the minimum value along a specified axis in a tensor.
///
/// Requires 1 input and produces 1 output. Negative indexing is supported.
///
/// Output has the same rank as the input if "removeDim" is False (default).
/// Output has rank one less than the input if "removeDim" is True and input rank is more than 1.
///
/// e.g.:
///
/// input shape = (45, 34, 10, 5)
/// axis = -2
/// output shape = (45, 1, 10, 5), if removeDim = False (default)
/// output shape = (45, 10, 5), if removeDim = True
///
/// input shape = (5,)
/// axis = 0
/// output shape = (1,), if removeDim = False or True
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ArgMinLayerParams {
#[prost(int64, tag = "1")]
pub axis: i64,
#[prost(bool, tag = "2")]
pub remove_dim: bool,
}
///
/// A layer layer that splits the input tensor into multiple output tensors,
/// along the specified axis.
///
/// The layer either uniformly splits the input tensor into ``num_splits`` tensors, or
/// splits according to the given split sizes in ``split_sizes``.
/// Supports unequal splits and negative indexing.
///
/// Requires 1 input and produces at least 2 outputs.
/// Rank of all the outputs is same as that of the input.
///
/// If parameter "splitSizes" is provided, value of the parameter "numSplits" is ignored, since in that case
/// "numSplits" is automatically inferred to be the length of "splitSizes".
///
///
/// e.g.:
/// input shape: (5, 3, 4)
/// axis = -3, split_sizes = \[3, 2\]
/// output shape: (3, 3, 4)
/// output shape: (2, 3, 4)
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SplitNdLayerParams {
#[prost(int64, tag = "1")]
pub axis: i64,
#[prost(uint64, tag = "2")]
pub num_splits: u64,
#[prost(uint64, repeated, tag = "3")]
pub split_sizes: ::prost::alloc::vec::Vec<u64>,
}
///
/// A layer that performs element-wise ceil operation on the input tensor that
/// rounds the value to the smallest integer not less than x.
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CeilLayerParams {}
///
/// A layer that performs element-wise round operation on the input tensor
/// that rounds the value to the nearest integer.
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RoundLayerParams {}
///
/// A layer that performs element-wise floor operation on the input tensor
/// that rounds the value to the largest integer not greater than x.
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct FloorLayerParams {}
///
/// A layer that performs element-wise sign operation (+1 for positive values,
/// -1 for negative values, 0 for zeros).
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SignLayerParams {}
///
/// A layer that performs element-wise clip operation. Clip the values in the
/// input tensor to the threshold values \[min_value, max_value\].
///
/// Requires 1 input and produces 1 output.
///
/// Parameter minVal: the minimum threshold.
/// Parameter maxVal: the maximum threshold.
///
/// output = min(max(input, minVal), maxVal)
///
/// Output shape is same as the input.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ClipLayerParams {
#[prost(float, tag = "1")]
pub min_val: f32,
#[prost(float, tag = "2")]
pub max_val: f32,
}
///
/// A layer that extracts a slice of size ``(end - begin) / stride``
/// from the given input tensor.
/// Support negative indexing and negative strides.
///
/// Requires 1 input and produces 1 output.
/// Output rank is same as the input rank.
///
/// Value of beginIds, beginMasks, endIds, endMasks, strides are required parameters.
/// Lengths of all the parameters must equal the rank of the input.
///
/// i-th element of "beginIds" is ignored and assumed to be 0 if the i-th element of
/// "beginMasks" is True
///
/// i-th element of "endIds" is ignored and assumed to be -1 if the i-th element of
/// "endMasks" is True
///
/// e.g.:
/// if i-th element of "squeezeMasks" is set to True, only beginIds\[i\] would be sliced
/// out, and all other masks and inputs are ignored.
///
/// e.g. (without squeezeMasks):
/// input shape: (5, 5, 5)
/// beginIds: \[1, 2, 3\]
/// beginMasks: \[True, False, True\]
/// endIds: \[3, -3, 2\]
/// endMasks: \[False, True, True\]
/// strides: \[2, 2, 2\]
/// SqueezeMasks: \[False, False, False\]
/// output shape: (2, 2, 3)
/// This is equivalent to input\[:3:2, 2::2, ::2\]
///
/// e.g. (with squeezeMasks):
/// input shape: (5, 5, 5)
/// beginIds: \[1, 2, 3\]
/// beginMasks: \[True, False, True\]
/// endIds: \[3, -3, 2\]
/// endMasks: \[False, True, True\]
/// strides: \[2, 2, 2\]
/// SqueezeMasks: \[False, True, False\]
/// output shape: (2, 3)
/// This is equivalent to input\[:3:2, 2, ::2\]
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SliceStaticLayerParams {
#[prost(int64, repeated, tag = "1")]
pub begin_ids: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, repeated, tag = "2")]
pub begin_masks: ::prost::alloc::vec::Vec<bool>,
#[prost(int64, repeated, tag = "3")]
pub end_ids: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, repeated, tag = "4")]
pub end_masks: ::prost::alloc::vec::Vec<bool>,
#[prost(int64, repeated, tag = "5")]
pub strides: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, repeated, tag = "6")]
pub squeeze_masks: ::prost::alloc::vec::Vec<bool>,
}
///
/// A layer that extracts a slice of size ``(end - begin) / stride``
/// from the given input tensor.
/// Support negative indexing and negative strides.
/// See "SliceStaticLayerParams" for the description and an example of the functionality of the layer.
///
/// Requires 2 to 7 inputs and produces 1 output.
/// Rank of the output is same as the rank of the first input unless squeezeMask is set.
///
/// Value of beginIds, beginMasks, endIds, endMasks, strides can be passed in either
/// as dynamic inputs or as static parameters.
/// Lengths of all the parameters or inputs from 2-6 must equal the rank of the first input.
///
/// The 2nd input represents the "beginIds".
/// The 3rd input, if present, corresponds to "endIds". In this case the value of the "endIds" parameter is ignored.
/// The 4th input, if present, corresponds to "strides". In this case the value of the "strides" parameter is ignored.
/// The 5th input, if present, corresponds to "beginMasks". In this case the value of the "beginMasks" parameter is ignored.
/// The 6th input, if present, corresponds to "endMasks". In this case the value of the "endMasks" parameter is ignored.
/// The 7th input, if present, corresponds to "squeezeMasks". In this case the value of the "squeezeMasks" parameter is ignored.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SliceDynamicLayerParams {
#[prost(bool, repeated, tag = "2")]
pub begin_masks: ::prost::alloc::vec::Vec<bool>,
#[prost(int64, repeated, tag = "3")]
pub end_ids: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, repeated, tag = "4")]
pub end_masks: ::prost::alloc::vec::Vec<bool>,
#[prost(int64, repeated, tag = "5")]
pub strides: ::prost::alloc::vec::Vec<i64>,
#[prost(bool, repeated, tag = "6")]
pub squeeze_masks: ::prost::alloc::vec::Vec<bool>,
}
///
/// A layer that constructs a tensor by repeating the input tensor multiple
/// number of times.
///
/// Requires 1 or 2 inputs and produces 1 output.
/// Output rank is same as the input rank.
///
/// If two inputs are provided, second input is used as "reps"
/// and "reps" parameter is ignored.
///
/// If only one input is provided,
/// length of the "reps" parameter must be at least 1 and
/// not greater than the rank of the input.
/// If it is less than the input rank, it is made equal to the input rank by prepending 1's to it.
///
/// e.g.:
///
/// input shape = (2, 4, 2)
/// reps = (1, 2, 6)
/// output shape = (2, 8, 12)
///
/// input shape = (2, 4, 2)
/// reps = (6)
/// reps after prepending ones = (1, 1, 6)
/// output shape = (2, 4, 12)
///
/// input shape = (2, 4, 2)
/// second input = \[1, 2, 6\] -> shape: (3,)
/// reps = N/A \[Ignored\]
/// output shape = (2, 8, 12)
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TileLayerParams {
#[prost(uint64, repeated, tag = "1")]
pub reps: ::prost::alloc::vec::Vec<u64>,
}
///
/// A layer that returns the shape of an input tensor.
///
/// Requires 1 input and produces 1 output.
///
/// Input: a tensor.
/// Output: a vector of length R, where R is the rank of the input tensor
/// Output is always a rank 1 tensor.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetShapeLayerParams {}
///
/// A layer that computes the Gauss error function,
/// which is defined as:
///
/// .. math::
/// f(x) = \dfrac{1}{\sqrt{\pi}}\int_{-x}^{x}{e^{-t^2}dt}
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ErfLayerParams {}
///
/// A layer that evaluates the Gaussian Error Linear Unit (GELU) activation.
/// Following equations are used to compute the activation based on the value of the "mode" parameter:
///
/// mode == 'EXACT':
/// .. math::
/// f(x) = 0.5x\left ( 1+\rm{erf}\left ( \frac{x}{\sqrt{2}} \right ) \right )
///
/// mode == 'TANH_APPROXIMATION':
/// .. math::
/// f(x) = 0.5x\left ( 1+\rm{tanh}\left ( \sqrt{2/\pi}\left ( x + 0.044715x^3 \right ) \right ) \right )
///
/// mode == 'SIGMOID_APPROXIMATION':
/// .. math::
/// f(x) = x*\rm{sigmoid}(1.702x)
///
/// Requires 1 input and produces 1 output.
/// Output shape is same as the input.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GeluLayerParams {
/// mode of GELU operation.
#[prost(enumeration = "gelu_layer_params::GeluMode", tag = "1")]
pub mode: i32,
}
/// Nested message and enum types in `GeluLayerParams`.
pub mod gelu_layer_params {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum GeluMode {
Exact = 0,
TanhApproximation = 1,
SigmoidApproximation = 2,
}
impl GeluMode {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Exact => "EXACT",
Self::TanhApproximation => "TANH_APPROXIMATION",
Self::SigmoidApproximation => "SIGMOID_APPROXIMATION",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"EXACT" => Some(Self::Exact),
"TANH_APPROXIMATION" => Some(Self::TanhApproximation),
"SIGMOID_APPROXIMATION" => Some(Self::SigmoidApproximation),
_ => None,
}
}
}
}
///
/// RangeStatic layer that returns a tensor that contains evenly spaced values.
/// It is similar in functionality to the numpy.arange method.
///
/// Requires no input and produces 1 output.
/// Output is a rank 1 tensor.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RangeStaticLayerParams {
#[prost(float, tag = "1")]
pub end_value: f32,
#[prost(float, tag = "2")]
pub start_value: f32,
#[prost(float, tag = "3")]
pub step_size_value: f32,
}
///
/// A layer that returns a tensor that contains evenly spaced values.
/// Its functionality is similar to the numpy.arange method.
///
/// Requires at least 1 input, up to a maximum of 3 inputs.
/// Produces 1 output, which is a rank 1 tensor.
///
/// Each input must be a scalar, or rank 1 and shape (1,).
///
/// The first input represents the "endValue".
/// The second input, if present, corresponds to "startValue". In this case the value of the "startValue" parameter is ignored.
/// The third input, if present, corresponds to "stepSizeValue". In this case the value of the "stepSizeValue" parameter is ignored.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RangeDynamicLayerParams {
#[prost(float, tag = "2")]
pub start_value: f32,
#[prost(float, tag = "3")]
pub step_size_value: f32,
}
///
/// A layer that returns a tensor containing all windows of size ``windowSize``
/// separated by ``step`` along the dimension ``axis``.
///
/// .. code::
///
/// y = SlidingWindows(x)
///
/// Requires 1 input and produces 1 output.
///
/// Input
/// An N-Dimensional tensor.
///
/// Output
/// An (N+1)-Dimensional tensor.
///
/// This operation behaves as following:
/// - if axis = 0 & input is rank 1 (L,). Output shape will be (M, W).
/// - if axis = 1 & input is rank 3 (B1, L, C1). Output shape will be (B1, M, W, C1)
/// - 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)
/// - etc.
/// where
/// - L, C, B refer to input length, feature dimension length & batch size respectively
/// - W is the window size.
/// - M is the number of windows/slices calculated as M = (L - W) / step + 1
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SlidingWindowsLayerParams {
#[prost(int64, tag = "1")]
pub axis: i64,
#[prost(uint64, tag = "2")]
pub window_size: u64,
#[prost(uint64, tag = "3")]
pub step: u64,
}
///
/// A layer that applies layer normalization over the input tensor.
///
/// Requires 1 input and produces 1 output.
///
/// output = gamma * (input - computed_mean) / (sqrt(computed_variance + eps)) + beta
///
/// Parameters
/// 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.
/// gamma: must have shape = "normalizedShape"
/// beta: must have shape = "normalizedShape"
/// eps: small constant to avoid division by 0
///
/// Output shape is same as the input.
///
/// e.g.:
/// input shape = (10,5)
/// normalized shape = (5,) or (10,5)
///
/// input shape = (10,5,6,7)
/// normalized shape = (7,) or (6,7) or (5,6,7) or (10,5,6,7)
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LayerNormalizationLayerParams {
#[prost(int64, repeated, tag = "1")]
pub normalized_shape: ::prost::alloc::vec::Vec<i64>,
#[prost(float, tag = "2")]
pub eps: f32,
#[prost(message, optional, tag = "3")]
pub gamma: ::core::option::Option<WeightParams>,
#[prost(message, optional, tag = "4")]
pub beta: ::core::option::Option<WeightParams>,
}
///
/// Non maximum suppression (NMS) layer.
/// Applies the non maximum suppression algorithm to input bounding box coordinates.
/// The effect of this layer is similar to the functionality of the "NonMaximumSuppression"
/// model type (for details please see NonMaximumSuppression.proto) with a couple of differences.
/// One, this is a layer in a neural network model, whereas that is a different model type. Second,
/// this layer supports a batch of bounding boxes.
///
/// The NMS layer requires at least 2 inputs, and up to a maximum of 5 inputs. It produces 4 outputs.
/// Following is the description of inputs and outputs:
///
/// input 1, shape (B,N,4): coordinates of N boxes, for a batch size B.
/// 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.
///
/// input 3, optional, shape (1,): IoU threshold. When present, it overwrites the value provided in layer parameter "iouThreshold".
/// input 4, optional, shape (1,): Score threshold. When present, it overwrites the value provided in layer parameter "scoreThreshold".
/// input 5, optional, shape (1,): Maximum number of boxes. When present, it overwrites the value provided in layer parameter "maxBoxes".
///
/// output 1, shape (B,maxBoxes,4): box coordinates, corresponding to the surviving boxes.
/// output 2, shape (B,maxBoxes,C): box scores, corresponding to the surviving boxes.
/// output 3, shape (B,maxBoxes): indices of the surviving boxes. Hence it will have values in the range \[0,N-1\], except for padding.
/// output 4, shape (B,): number of boxes selected after the NMS algorithm, for each batch.
///
/// When surviving boxes are less than "maxBoxes", the first 3 outputs are padded.
/// For the first two outputs, the padding is done using values 0, whereas for the third output the
/// padding value used is -1, since the output values represent indices.
///
/// If no box survives, that is, all the scores are below the "scoreThreshold",
/// then for that batch, number of boxes (value of the fourth output) will be 1. The first 3 outputs will
/// correspond to the box with the highest score. This is to avoid generating an "empty" output.
///
/// The four values that describe the box dimensions are (in order):
///
/// - x (center location of the box along the horizontal axis)
/// - y (center location of the box along the vertical axis)
/// - width (size of box along the horizontal axis)
/// - height (size of box on along the vertical axis)
///
/// In each batch,
/// the N scores for N boxes, used for suppression, are generated by taking the max of the matrix (N,C)
/// along the columns.
/// If "perClassSuppression" flag is false, suppression happens across all classes.
/// If "perClassSuppression" flag is true, each box is assigned to the class with the highest
/// score and then the suppression happens separately for boxes within the same class.
///
/// Note that the 4th output can be used to dynamically slice the first 3 outputs, in case
/// the padded outputs are not required.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct NonMaximumSuppressionLayerParams {
///
/// The intersection over union (IoU) threshold over which boxes are suppressed.
#[prost(float, tag = "1")]
pub iou_threshold: f32,
///
/// Before IoU suppression is performed, boxes with class scores below this threshold are rejected.
#[prost(float, tag = "2")]
pub score_threshold: f32,
///
/// The maximum number of boxes to be given out as output.
/// If the number of surviving boxes are less, output is padded up to this number.
#[prost(uint64, tag = "3")]
pub max_boxes: u64,
///
/// If true, suppression is performed independently within boxes of each class.
#[prost(bool, tag = "4")]
pub per_class_suppression: bool,
}
///
/// A layer that performs element-wise clamped ReLU operation.
///
/// Requires 1 input and produces 1 output.
///
/// This function has the following formula:
///
/// .. math::
/// f(x) = \begin{cases}
/// \text{min}(\text{beta},x) \;\; \text{if} \;\; x \geq 0\\
/// \text{min}(\text{beta} ,\text{alpha}\cdot x) \;\; \text{if} \;\; x<0
/// \end{cases}
///
/// Output shape is same as the input.
///
/// Available (iOS >= 14, macOS >= 11.0, watchOS >= 7)
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ClampedReLuLayerParams {
#[prost(float, tag = "1")]
pub alpha: f32,
#[prost(float, tag = "2")]
pub beta: f32,
}
///
/// A layer that returns the indices that would sort the input tensor, along a specified axis.
///
/// Requires 1 input and produces 1 output.
///
/// Output has the same rank and shape as the input.
///
/// Value of "axis" must be positive and less than the rank of the input.
///
/// e.g.:
///
/// input shape = (5,)
/// axis = 0
/// input values = \[3.1, 5.4, 32.9, 3.2, 77.0\]
/// output shape = (5,)
/// output values = \[0, 3, 1, 2, 4\], descending = False
/// output values = \[4, 2, 1, 3, 0\], descending = True
///
/// input shape = (2,3)
/// axis = 1
/// input values = \[[3, 5, 32\], \[3, 77, 6]\]
/// output shape = (2,3)
/// output values = \[[0, 1, 2\], \[0, 2, 1]\], descending = False
/// output values = \[[2, 1, 0\], \[1, 2, 0]\], descending = True
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ArgSortLayerParams {
/// must be between \[0, input_rank - 1\]
#[prost(int64, tag = "1")]
pub axis: i64,
#[prost(bool, tag = "2")]
pub descending: bool,
}
///
/// A layer that does slice operation by providing size to be extracted
/// from the given input tensor.
///
/// Requires 2 inputs and produces 1 output.
/// Rank of the output is same as the rank of the first input.
///
/// The 1st input represents the tensor to be sliced.
/// The 2nd input represents the beginning index to be sliced from.
///
/// Example:
/// Input 1: x (x.shape = (2, 3, 4))
/// Input 2: begin
/// size: 2
/// axis: 1
///
/// Output: x\[:, begin:begin+2, :\]
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SliceBySizeLayerParams {
#[prost(int64, tag = "2")]
pub size: i64,
#[prost(int64, tag = "3")]
pub axis: i64,
}
///
/// A neural network specialized as a classifier.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NeuralNetworkClassifier {
#[prost(message, repeated, tag = "1")]
pub layers: ::prost::alloc::vec::Vec<NeuralNetworkLayer>,
#[prost(message, repeated, tag = "2")]
pub preprocessing: ::prost::alloc::vec::Vec<NeuralNetworkPreprocessing>,
/// use this enum value to determine the input tensor shapes to the neural network, for multiarray inputs
#[prost(enumeration = "NeuralNetworkMultiArrayShapeMapping", tag = "5")]
pub array_input_shape_mapping: i32,
/// use this enum value to determine the input tensor shapes to the neural network, for image inputs
#[prost(enumeration = "NeuralNetworkImageShapeMapping", tag = "6")]
pub image_input_shape_mapping: i32,
#[prost(message, optional, tag = "10")]
pub update_params: ::core::option::Option<NetworkUpdateParameters>,
/// The name of the output blob containing the probability of each class.
/// In other words, the score vector. Must be a 1-D tensor with the same
/// number and order of elements as ClassLabels.
#[prost(string, tag = "200")]
pub label_probability_layer_name: ::prost::alloc::string::String,
/// The set of labels for every possible class.
#[prost(oneof = "neural_network_classifier::ClassLabels", tags = "100, 101")]
pub class_labels: ::core::option::Option<neural_network_classifier::ClassLabels>,
}
/// Nested message and enum types in `NeuralNetworkClassifier`.
pub mod neural_network_classifier {
/// The set of labels for every possible class.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum ClassLabels {
#[prost(message, tag = "100")]
StringClassLabels(super::StringVector),
#[prost(message, tag = "101")]
Int64ClassLabels(super::Int64Vector),
}
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct OneHotLayerParams {
/// size of the one hot vector
#[prost(uint64, tag = "1")]
pub one_hot_vector_size: u64,
/// negative indexing is supported. It refers to the axis in the output tensor.
#[prost(int64, tag = "2")]
pub axis: i64,
#[prost(float, tag = "3")]
pub on_value: f32,
#[prost(float, tag = "4")]
pub off_value: f32,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CumSumLayerParams {
/// negative indexing is supported
#[prost(int64, tag = "1")]
pub axis: i64,
/// 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
/// 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
/// (this behavior is reversed when "reverse" flag is True)
#[prost(bool, tag = "2")]
pub exclude_final_sum: bool,
/// if true, cumsum is performed in the opposite direction
#[prost(bool, tag = "3")]
pub reverse: bool,
}
///
/// A neural network specialized as a regressor.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NeuralNetworkRegressor {
#[prost(message, repeated, tag = "1")]
pub layers: ::prost::alloc::vec::Vec<NeuralNetworkLayer>,
#[prost(message, repeated, tag = "2")]
pub preprocessing: ::prost::alloc::vec::Vec<NeuralNetworkPreprocessing>,
/// use this enum value to determine the input tensor shapes to the neural network, for multiarray inputs
#[prost(enumeration = "NeuralNetworkMultiArrayShapeMapping", tag = "5")]
pub array_input_shape_mapping: i32,
/// use this enum value to determine the input tensor shapes to the neural network, for image inputs
#[prost(enumeration = "NeuralNetworkImageShapeMapping", tag = "6")]
pub image_input_shape_mapping: i32,
#[prost(message, optional, tag = "10")]
pub update_params: ::core::option::Option<NetworkUpdateParameters>,
}
///
/// Details on how the network will be updated
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NetworkUpdateParameters {
#[prost(message, repeated, tag = "1")]
pub loss_layers: ::prost::alloc::vec::Vec<LossLayer>,
#[prost(message, optional, tag = "2")]
pub optimizer: ::core::option::Option<Optimizer>,
#[prost(message, optional, tag = "3")]
pub epochs: ::core::option::Option<Int64Parameter>,
///
/// Describes whether to shuffle the batch of data between epochs.
#[prost(message, optional, tag = "10")]
pub shuffle: ::core::option::Option<BoolParameter>,
///
/// The seed to be used in an associated random number generator.
#[prost(message, optional, tag = "20")]
pub seed: ::core::option::Option<Int64Parameter>,
}
///
/// Loss layer - categorical cross entropy and mean squared error are the only supported loss functions currently
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LossLayer {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(oneof = "loss_layer::LossLayerType", tags = "10, 11")]
pub loss_layer_type: ::core::option::Option<loss_layer::LossLayerType>,
}
/// Nested message and enum types in `LossLayer`.
pub mod loss_layer {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum LossLayerType {
#[prost(message, tag = "10")]
CategoricalCrossEntropyLossLayer(super::CategoricalCrossEntropyLossLayer),
#[prost(message, tag = "11")]
MeanSquaredErrorLossLayer(super::MeanSquaredErrorLossLayer),
}
}
///
/// Categorical cross entropy loss layer
/// Categorical cross entropy is used for single label categorization (only one category is applicable for each data point).
///
/// The input is a vector of length N representing the distribution over N categories. It must be the output of a softmax.
///
/// 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.
///
/// math:
/// Loss_{CCE}(input, target) = -\sum_{i=1}^{N} (target == i) log( input\[i\] ) = - log (input\[target\])
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CategoricalCrossEntropyLossLayer {
#[prost(string, tag = "1")]
pub input: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub target: ::prost::alloc::string::String,
}
///
/// Mean squared error loss layer,
/// specifying input and target
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MeanSquaredErrorLossLayer {
#[prost(string, tag = "1")]
pub input: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub target: ::prost::alloc::string::String,
}
///
/// Optimizer - stochastic gradient descent and adam are the only supported optimizers currently
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Optimizer {
#[prost(oneof = "optimizer::OptimizerType", tags = "10, 11")]
pub optimizer_type: ::core::option::Option<optimizer::OptimizerType>,
}
/// Nested message and enum types in `Optimizer`.
pub mod optimizer {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum OptimizerType {
#[prost(message, tag = "10")]
SgdOptimizer(super::SgdOptimizer),
#[prost(message, tag = "11")]
AdamOptimizer(super::AdamOptimizer),
}
}
///
/// Stochastic gradient descent optimizer,
/// specifying configurable learning rate, mini batch size, and momentum
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SgdOptimizer {
#[prost(message, optional, tag = "1")]
pub learning_rate: ::core::option::Option<DoubleParameter>,
#[prost(message, optional, tag = "2")]
pub mini_batch_size: ::core::option::Option<Int64Parameter>,
#[prost(message, optional, tag = "3")]
pub momentum: ::core::option::Option<DoubleParameter>,
}
///
/// Adam optimizer,
/// specifying configurable learning rate, mini batch size, betas, and eps
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AdamOptimizer {
#[prost(message, optional, tag = "1")]
pub learning_rate: ::core::option::Option<DoubleParameter>,
#[prost(message, optional, tag = "2")]
pub mini_batch_size: ::core::option::Option<Int64Parameter>,
#[prost(message, optional, tag = "3")]
pub beta1: ::core::option::Option<DoubleParameter>,
#[prost(message, optional, tag = "4")]
pub beta2: ::core::option::Option<DoubleParameter>,
#[prost(message, optional, tag = "5")]
pub eps: ::core::option::Option<DoubleParameter>,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum NeuralNetworkMultiArrayShapeMapping {
///
/// Default legacy value. Only supported for Core ML Specification version <= 3.
///
/// The default legacy shape mapping resolves all input shapes to a rank 5 equivalent
/// with axis notation of \[Seq, Batch, Channel, Height, Width\].
///
/// When this enum value is selected,
/// the repeated shape field in the message "ArrayFeatureType" in feature types proto,
/// must be either length 1 or length 3.
///
/// The following rule is used to map the values in the shape field to the actual tensor shape:
/// rank 1 shape is mapped to shape \[1,1,C,1,1\]
/// rank 3 shape is mapped to shape \[1,1,C,H,W\]
/// At runtime, the first two dimensions (Seq or Batch) can be presented as well, with non-1 values.
///
/// It is invalid to use this enum value if any of the layers added
/// Specification version 4 (iOS >= 13, macOS >= 10.15) onwards are used in the network.
/// Validator will raise an error in that case.
Rank5ArrayMapping = 0,
///
/// The exact shape and rank (i.e. number of dimensions in the shape) of the input,
/// as specified in the message "ArrayFeatureType", is passed through to the layers.
/// Supported only for Specification version >= 4 (iOS >= 13, macOS >= 10.15).
ExactArrayMapping = 1,
}
impl NeuralNetworkMultiArrayShapeMapping {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Rank5ArrayMapping => "RANK5_ARRAY_MAPPING",
Self::ExactArrayMapping => "EXACT_ARRAY_MAPPING",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"RANK5_ARRAY_MAPPING" => Some(Self::Rank5ArrayMapping),
"EXACT_ARRAY_MAPPING" => Some(Self::ExactArrayMapping),
_ => None,
}
}
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum NeuralNetworkImageShapeMapping {
///
/// In this case, image input is mapped to a rank 5 tensor.
/// For Color images, input tensor is shaped as \[1,1,3,H,W\].
/// For Gray images, input tensor is shaped as \[1,1,1,H,W\].
Rank5ImageMapping = 0,
///
/// For Color images, input tensor is shaped as \[1,3,H,W\].
/// For Gray images, input tensor is shaped as \[1,1,H,W\].
/// Supported only for Specification version >= 4 (iOS >= 13, macOS >= 10.15).
Rank4ImageMapping = 1,
}
impl NeuralNetworkImageShapeMapping {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Rank5ImageMapping => "RANK5_IMAGE_MAPPING",
Self::Rank4ImageMapping => "RANK4_IMAGE_MAPPING",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"RANK5_IMAGE_MAPPING" => Some(Self::Rank5ImageMapping),
"RANK4_IMAGE_MAPPING" => Some(Self::Rank4ImageMapping),
_ => None,
}
}
}
///
/// Scatter accumulation mode.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ScatterMode {
ScatterUpdate = 0,
/// add
ScatterAdd = 1,
/// subtract
ScatterSub = 2,
/// multiply
ScatterMul = 3,
/// divide
ScatterDiv = 4,
/// maximum
ScatterMax = 5,
/// minimum
ScatterMin = 6,
}
impl ScatterMode {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::ScatterUpdate => "SCATTER_UPDATE",
Self::ScatterAdd => "SCATTER_ADD",
Self::ScatterSub => "SCATTER_SUB",
Self::ScatterMul => "SCATTER_MUL",
Self::ScatterDiv => "SCATTER_DIV",
Self::ScatterMax => "SCATTER_MAX",
Self::ScatterMin => "SCATTER_MIN",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"SCATTER_UPDATE" => Some(Self::ScatterUpdate),
"SCATTER_ADD" => Some(Self::ScatterAdd),
"SCATTER_SUB" => Some(Self::ScatterSub),
"SCATTER_MUL" => Some(Self::ScatterMul),
"SCATTER_DIV" => Some(Self::ScatterDiv),
"SCATTER_MAX" => Some(Self::ScatterMax),
"SCATTER_MIN" => Some(Self::ScatterMin),
_ => None,
}
}
}
///
/// A FeatureVectorizer puts one or more features into a single array.
///
/// The ordering of features in the output array is determined by
/// ``inputList``.
///
/// ``inputDimensions`` is a zero based index.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FeatureVectorizer {
#[prost(message, repeated, tag = "1")]
pub input_list: ::prost::alloc::vec::Vec<feature_vectorizer::InputColumn>,
}
/// Nested message and enum types in `FeatureVectorizer`.
pub mod feature_vectorizer {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InputColumn {
#[prost(string, tag = "1")]
pub input_column: ::prost::alloc::string::String,
#[prost(uint64, tag = "2")]
pub input_dimensions: u64,
}
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClassConfidenceThresholding {
/// *
/// The precision-recall curve for each class label.
///
/// The field is optional. When it exists, the number of curves
/// must match the number of class labels.
#[prost(message, repeated, tag = "100")]
pub precision_recall_curves: ::prost::alloc::vec::Vec<PrecisionRecallCurve>,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BayesianProbitRegressor {
#[prost(uint32, tag = "1")]
pub number_of_features: u32,
/// bias term
#[prost(message, optional, tag = "2")]
pub bias: ::core::option::Option<bayesian_probit_regressor::Gaussian>,
///
/// Set of features with associated weights
///
/// feature weights
#[prost(message, repeated, tag = "3")]
pub features: ::prost::alloc::vec::Vec<bayesian_probit_regressor::FeatureWeight>,
///
/// Set this name to be the same as input feature of type multi-array (1D)
/// in the model description you want to use as the regression input
#[prost(string, tag = "10")]
pub regression_input_feature_name: ::prost::alloc::string::String,
///
/// Set this name to be the same as optional input feature of type double
/// in the model description you want to use as the optimism input
#[prost(string, tag = "11")]
pub optimism_input_feature_name: ::prost::alloc::string::String,
///
/// Set this name to be the same as optional input feature of type double
/// in the model description you want to use as the samplingScale input
#[prost(string, tag = "12")]
pub sampling_scale_input_feature_name: ::prost::alloc::string::String,
///
/// Set this name to be the same as optional input feature of type double
/// in the model description you want to use as the samplingBounds input
#[prost(string, tag = "13")]
pub sampling_truncation_input_feature_name: ::prost::alloc::string::String,
///
/// name of 'mean' output feature
#[prost(string, tag = "20")]
pub mean_output_feature_name: ::prost::alloc::string::String,
///
/// name of 'variance' output feature
#[prost(string, tag = "21")]
pub variance_output_feature_name: ::prost::alloc::string::String,
///
/// name of 'pessimistic' output feature
#[prost(string, tag = "22")]
pub pessimistic_probability_output_feature_name: ::prost::alloc::string::String,
///
/// name of 'sampled' output feature: samples from the scaled posterior probability distribuiton
#[prost(string, tag = "23")]
pub sampled_probability_output_feature_name: ::prost::alloc::string::String,
}
/// Nested message and enum types in `BayesianProbitRegressor`.
pub mod bayesian_probit_regressor {
///
/// Parameterization of a Gaussian distribution
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Gaussian {
#[prost(double, tag = "1")]
pub mean: f64,
/// inverse of the variance
#[prost(double, tag = "2")]
pub precision: f64,
}
///
/// Weight for a specific feature value
/// The weight is represented as a Gaussian distribution
/// with a mean and precision (1/variance) to capture
/// uncertainty in the weight
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FeatureValueWeight {
#[prost(uint32, tag = "1")]
pub feature_value: u32,
#[prost(message, optional, tag = "2")]
pub feature_weight: ::core::option::Option<Gaussian>,
}
///
/// Feature with associated weights (for different values)
/// Each feature has a set of weights for the (discrete) values
/// it can take
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FeatureWeight {
#[prost(uint32, tag = "1")]
pub feature_id: u32,
#[prost(message, repeated, tag = "2")]
pub weights: ::prost::alloc::vec::Vec<FeatureValueWeight>,
}
}
///
/// Tree ensemble parameters.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TreeEnsembleParameters {
#[prost(message, repeated, tag = "1")]
pub nodes: ::prost::alloc::vec::Vec<tree_ensemble_parameters::TreeNode>,
///
/// The number of prediction dimensions or classes in the model.
///
/// All instances of ``evaluationIndex`` in a leaf node
/// must be less than this value,
/// and the number of values in the ``basePredictionValue`` field
/// must be equal to this value.
///
/// For regression,
/// this is the dimension of the prediction.
/// For classification,
/// this is the number of classes.
#[prost(uint64, tag = "2")]
pub num_prediction_dimensions: u64,
///
/// The base prediction value.
///
/// The number of values in this must match
/// the default values of the tree model.
#[prost(double, repeated, tag = "3")]
pub base_prediction_value: ::prost::alloc::vec::Vec<f64>,
}
/// Nested message and enum types in `TreeEnsembleParameters`.
pub mod tree_ensemble_parameters {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TreeNode {
#[prost(uint64, tag = "1")]
pub tree_id: u64,
#[prost(uint64, tag = "2")]
pub node_id: u64,
///
/// The branch mode parameters.
///
/// If branch is false,
/// then the parameters in this section must be filled in
/// to determine how the branching functions.
#[prost(enumeration = "tree_node::TreeNodeBehavior", tag = "3")]
pub node_behavior: i32,
///
/// If the node behavior mode is a branch mode,
/// then these values must be filled in.
#[prost(uint64, tag = "10")]
pub branch_feature_index: u64,
#[prost(double, tag = "11")]
pub branch_feature_value: f64,
#[prost(uint64, tag = "12")]
pub true_child_node_id: u64,
#[prost(uint64, tag = "13")]
pub false_child_node_id: u64,
#[prost(bool, tag = "14")]
pub missing_value_tracks_true_child: bool,
#[prost(message, repeated, tag = "20")]
pub evaluation_info: ::prost::alloc::vec::Vec<tree_node::EvaluationInfo>,
///
/// The relative hit rate of a node for optimization purposes.
///
/// This value has no effect on the accuracy of the result;
/// it allows the tree to optimize for frequent branches.
/// The value is relative,
/// compared to the hit rates of other branch nodes.
///
/// You typically use a proportion of training samples
/// that reached this node
/// or some similar metric to derive this value.
#[prost(double, tag = "30")]
pub relative_hit_rate: f64,
}
/// Nested message and enum types in `TreeNode`.
pub mod tree_node {
///
/// The leaf mode.
///
/// If ``nodeBahavior`` == ``LeafNode``,
/// then the evaluationValue is added to the base prediction value
/// in order to get the final prediction.
/// To support multiclass classification
/// as well as regression and binary classification,
/// the evaluation value is encoded here as a sparse vector,
/// with evaluationIndex being the index of the base vector
/// that evaluation value is added to.
/// In the single class case,
/// it is expected that evaluationIndex is exactly 0.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct EvaluationInfo {
#[prost(uint64, tag = "1")]
pub evaluation_index: u64,
#[prost(double, tag = "2")]
pub evaluation_value: f64,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum TreeNodeBehavior {
BranchOnValueLessThanEqual = 0,
BranchOnValueLessThan = 1,
BranchOnValueGreaterThanEqual = 2,
BranchOnValueGreaterThan = 3,
BranchOnValueEqual = 4,
BranchOnValueNotEqual = 5,
LeafNode = 6,
}
impl TreeNodeBehavior {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::BranchOnValueLessThanEqual => "BranchOnValueLessThanEqual",
Self::BranchOnValueLessThan => "BranchOnValueLessThan",
Self::BranchOnValueGreaterThanEqual => {
"BranchOnValueGreaterThanEqual"
}
Self::BranchOnValueGreaterThan => "BranchOnValueGreaterThan",
Self::BranchOnValueEqual => "BranchOnValueEqual",
Self::BranchOnValueNotEqual => "BranchOnValueNotEqual",
Self::LeafNode => "LeafNode",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"BranchOnValueLessThanEqual" => {
Some(Self::BranchOnValueLessThanEqual)
}
"BranchOnValueLessThan" => Some(Self::BranchOnValueLessThan),
"BranchOnValueGreaterThanEqual" => {
Some(Self::BranchOnValueGreaterThanEqual)
}
"BranchOnValueGreaterThan" => Some(Self::BranchOnValueGreaterThan),
"BranchOnValueEqual" => Some(Self::BranchOnValueEqual),
"BranchOnValueNotEqual" => Some(Self::BranchOnValueNotEqual),
"LeafNode" => Some(Self::LeafNode),
_ => None,
}
}
}
}
}
///
/// A tree ensemble classifier.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TreeEnsembleClassifier {
#[prost(message, optional, tag = "1")]
pub tree_ensemble: ::core::option::Option<TreeEnsembleParameters>,
#[prost(enumeration = "TreeEnsemblePostEvaluationTransform", tag = "2")]
pub post_evaluation_transform: i32,
/// Required class label mapping
#[prost(oneof = "tree_ensemble_classifier::ClassLabels", tags = "100, 101")]
pub class_labels: ::core::option::Option<tree_ensemble_classifier::ClassLabels>,
}
/// Nested message and enum types in `TreeEnsembleClassifier`.
pub mod tree_ensemble_classifier {
/// Required class label mapping
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum ClassLabels {
#[prost(message, tag = "100")]
StringClassLabels(super::StringVector),
#[prost(message, tag = "101")]
Int64ClassLabels(super::Int64Vector),
}
}
///
/// A tree ensemble regressor.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TreeEnsembleRegressor {
#[prost(message, optional, tag = "1")]
pub tree_ensemble: ::core::option::Option<TreeEnsembleParameters>,
#[prost(enumeration = "TreeEnsemblePostEvaluationTransform", tag = "2")]
pub post_evaluation_transform: i32,
}
///
/// A tree ensemble post-evaluation transform.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum TreeEnsemblePostEvaluationTransform {
NoTransform = 0,
ClassificationSoftMax = 1,
RegressionLogistic = 2,
ClassificationSoftMaxWithZeroClassReference = 3,
}
impl TreeEnsemblePostEvaluationTransform {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::NoTransform => "NoTransform",
Self::ClassificationSoftMax => "Classification_SoftMax",
Self::RegressionLogistic => "Regression_Logistic",
Self::ClassificationSoftMaxWithZeroClassReference => {
"Classification_SoftMaxWithZeroClassReference"
}
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NoTransform" => Some(Self::NoTransform),
"Classification_SoftMax" => Some(Self::ClassificationSoftMax),
"Regression_Logistic" => Some(Self::RegressionLogistic),
"Classification_SoftMaxWithZeroClassReference" => {
Some(Self::ClassificationSoftMaxWithZeroClassReference)
}
_ => None,
}
}
}
///
/// A scaling operation.
///
/// This function has the following formula:
///
/// .. math::
/// f(x) = scaleValue \cdot (x + shiftValue)
///
/// If the ``scaleValue`` is not given, the default value 1 is used.
/// If the ``shiftValue`` is not given, the default value 0 is used.
///
/// If ``scaleValue`` and ``shiftValue`` are each a single value
/// and the input is an array, then the scale and shift are applied
/// to each element of the array.
///
/// If the input is an integer, then it is converted to a double to
/// perform the scaling operation. If the output type is an integer,
/// then it is cast to an integer. If that cast is lossy, then an
/// error is generated.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Scaler {
#[prost(double, repeated, tag = "1")]
pub shift_value: ::prost::alloc::vec::Vec<f64>,
#[prost(double, repeated, tag = "2")]
pub scale_value: ::prost::alloc::vec::Vec<f64>,
}
///
/// An array feature extractor.
///
/// Given an index, extracts the value at that index from its array input.
/// Indexes are zero-based.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ArrayFeatureExtractor {
#[prost(uint64, repeated, tag = "1")]
pub extract_index: ::prost::alloc::vec::Vec<u64>,
}
///
/// A parameterized model whose function is defined in code
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CustomModel {
/// The name of the class (conforming to MLCustomModel) corresponding to this model
#[prost(string, tag = "10")]
pub class_name: ::prost::alloc::string::String,
#[prost(map = "string, message", tag = "30")]
pub parameters: ::std::collections::HashMap<
::prost::alloc::string::String,
custom_model::CustomModelParamValue,
>,
/// 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.
#[prost(string, tag = "40")]
pub description: ::prost::alloc::string::String,
}
/// Nested message and enum types in `CustomModel`.
pub mod custom_model {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CustomModelParamValue {
#[prost(
oneof = "custom_model_param_value::Value",
tags = "10, 20, 30, 40, 50, 60"
)]
pub value: ::core::option::Option<custom_model_param_value::Value>,
}
/// Nested message and enum types in `CustomModelParamValue`.
pub mod custom_model_param_value {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Value {
#[prost(double, tag = "10")]
DoubleValue(f64),
#[prost(string, tag = "20")]
StringValue(::prost::alloc::string::String),
#[prost(int32, tag = "30")]
IntValue(i32),
#[prost(int64, tag = "40")]
LongValue(i64),
#[prost(bool, tag = "50")]
BoolValue(bool),
#[prost(bytes, tag = "60")]
BytesValue(::prost::alloc::vec::Vec<u8>),
}
}
}
///
/// A normalization preprocessor.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Normalizer {
#[prost(enumeration = "normalizer::NormType", tag = "1")]
pub norm_type: i32,
}
/// Nested message and enum types in `Normalizer`.
pub mod normalizer {
///
/// There are three normalization modes,
/// which have the corresponding formulas:
///
/// Max
/// .. math::
/// max(x_i)
///
/// L1
/// .. math::
/// z = ||x||_1 = \sum_{i=1}^{n} |x_i|
///
/// L2
/// .. math::
/// z = ||x||_2 = \sqrt{\sum_{i=1}^{n} x_i^2}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum NormType {
LMax = 0,
L1 = 1,
L2 = 2,
}
impl NormType {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::LMax => "LMax",
Self::L1 => "L1",
Self::L2 => "L2",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"LMax" => Some(Self::LMax),
"L1" => Some(Self::L1),
"L2" => Some(Self::L2),
_ => None,
}
}
}
}
///
/// Non-maximum suppression of axis-aligned bounding boxes.
///
/// This is used primarily for object detectors that tend to produce multiple
/// boxes around a single object. This is a byproduct of the detector's
/// robustness to spatial translation. If there are two or more bounding boxes
/// that are very similar to one another, the algorithm should return only a
/// single representative.
///
/// Similarity between two bounding boxes is measured by intersection-over-union
/// (IOU), the fraction between the area of intersection and area of the union.
/// Here is an example where the areas can be calculated by hand by counting glyphs::
///
/// +-------+ +-------+
/// | | | |
/// | +------+ +--+ | +---+
/// | | | | | | | |
/// +-------+ | +--+ +----+ |
/// | | | |
/// +------+ +------+
/// Intersection Union
/// IOU: 0.16 = 12 / 73
///
/// All IOU scores are fractions between 0.0 (fully disjoint) and 1.0 (perfect
/// overlap). The standard algorithm (PickTop) is defined as follows:
///
/// 1. Sort boxes by descending order of confidence
/// 2. Take the top one and mark it as keep
/// 3. Suppress (mark it as discard) all boxes within a fixed IOU radius of the
/// keep box
/// 4. Go to 2 and repeat on the subset of boxes not already kept or discarded
/// 5. When all boxes are processed, output only the ones marked as keep
///
/// Before the algorithm, boxes that fall below the confidence threshold are
/// discarded.
///
/// Suppression methods:
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NonMaximumSuppression {
///
/// This defines the radius of suppression. A box is considered to be within
/// the radius of another box if their IOU score is less than this value.
#[prost(double, tag = "110")]
pub iou_threshold: f64,
///
/// Remove bounding boxes below this threshold. The algorithm run-time is
/// proportional to the square of the number of incoming bounding boxes
/// (O(N^2)). This threshold is a way to reduce N to make the algorithm
/// faster. The confidence threshold can be any non-negative value. Negative
/// confidences are not allowed, since if the output shape is specified to be
/// larger than boxes after suppression, the unused boxes are filled with
/// zero confidence. If the prediction is handled by Core Vision, it is also
/// important that confidences are defined with the following semantics:
///
/// 1. Confidences should be between 0 and 1
/// 2. The sum of the confidences for a prediction should not exceed 1, but is
/// allowed to be less than 1
/// 3. The sum of the confidences will be interpreted as the confidence of
/// any object (e.g. if the confidences for two classes are 0.2 and 0.4,
/// it means there is a 60% (0.2 + 0.4) confidence that an object is
/// present)
#[prost(double, tag = "111")]
pub confidence_threshold: f64,
///
/// Set the name of the confidence input.
///
/// The input should be a multi-array of type double and shape N x C. N is
/// the number of boxes and C the number of classes. Each row describes the
/// confidences of each object category being present at that particular
/// location. Confidences should be nonnegative, where 0.0 means the highest
/// certainty the object is not present.
///
/// Specifying shape is optional.
#[prost(string, tag = "200")]
pub confidence_input_feature_name: ::prost::alloc::string::String,
///
/// Set the name of the coordinates input.
///
/// The input should be a multi-array of type double and shape N x 4. The
/// rows correspond to the rows of the confidence matrix. The four values
/// describe (in order):
///
/// - x (center location of the box along the horizontal axis)
/// - y (center location of the box along the vertical axis)
/// - width (size of box along the horizontal axis)
/// - height (size of box on along the vertical axis)
///
/// Specifying shape is optional.
#[prost(string, tag = "201")]
pub coordinates_input_feature_name: ::prost::alloc::string::String,
///
/// The iouThreshold can be optionally overridden by specifying this string
/// and providing a corresponding input of type double. This allows changing
/// the value of the parameter during run-time.
///
/// The input should be a scalar double between 0.0 and 1.0. Setting it to 1.0
/// means there will be no suppression based on IOU.
#[prost(string, tag = "202")]
pub iou_threshold_input_feature_name: ::prost::alloc::string::String,
///
/// The confidenceThreshold can be optionally overridden by specifying this
/// string and providing a corresponding input. This allows changing the
/// value of the parameter during run-time, which can aid setting it just
/// right for a particular use case.
///
/// The input should be a scalar double with nonnegative value.
#[prost(string, tag = "203")]
pub confidence_threshold_input_feature_name: ::prost::alloc::string::String,
///
/// Set the name of the confidence output. The output will be the same type
/// and shape as the corresponding input. The only difference is that the
/// number of rows may have been reduced.
///
/// Specifying shape is optional. One reason to specify shape is to limit
/// the number of output boxes. This can be done is several ways:
///
/// Fixed shape:
/// The output can be pinned to a fixed set of boxes. If this number is larger
/// than the number of boxes that would have been returned, the output is padded
/// with zeros for both confidence and coordinates. Specifying a fixed shape
/// can be done by setting either shape (deprecated) or allowedShapes set to
/// fixedsize.
///
/// Min/max:
/// It is also possible to set both a minimum and a maximum. The same zero-padding
/// as for fixed shape is applied when necessary. Setting min/max is done by defining
/// two allowedShapes, where the first dimension uses a rangeofsizes defining lowerbound
/// and upperbound.
#[prost(string, tag = "210")]
pub confidence_output_feature_name: ::prost::alloc::string::String,
///
/// Set the name of the coordinates output. The output will be the same type
/// and shape as the corresponding input. The only difference is that the
/// number of rows may have been reduced.
///
/// Specifying shape is optional. See confidence output for a more detailed
/// description. Note that to achieve either fixed shape output or a
/// constraint range of boxes, only one of confidence or coordinates need to
/// set a shape. Both shapes are allowed to be defined, but in such case they
/// have to be consistent along dimension 0.
#[prost(string, tag = "211")]
pub coordinates_output_feature_name: ::prost::alloc::string::String,
///
/// Choose which underlying suppression method to use
#[prost(oneof = "non_maximum_suppression::SuppressionMethod", tags = "1")]
pub suppression_method: ::core::option::Option<
non_maximum_suppression::SuppressionMethod,
>,
///
/// Optional class label mapping.
#[prost(oneof = "non_maximum_suppression::ClassLabels", tags = "100, 101")]
pub class_labels: ::core::option::Option<non_maximum_suppression::ClassLabels>,
}
/// Nested message and enum types in `NonMaximumSuppression`.
pub mod non_maximum_suppression {
///
/// Pick the bounding box of the top confidence, suppress all within a radius.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PickTop {
///
/// Suppression is only done among predictions with the same label
/// (argmax of the confidence).
#[prost(bool, tag = "1")]
pub per_class: bool,
}
///
/// Choose which underlying suppression method to use
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum SuppressionMethod {
#[prost(message, tag = "1")]
PickTop(PickTop),
}
///
/// Optional class label mapping.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum ClassLabels {
#[prost(message, tag = "100")]
StringClassLabels(super::StringVector),
#[prost(message, tag = "101")]
Int64ClassLabels(super::Int64Vector),
}
}
///
/// Transforms a categorical feature into an array. The array will be all
/// zeros expect a single entry of one.
///
/// Each categorical value will map to an index, this mapping is given by
/// either the ``stringCategories`` parameter or the ``int64Categories``
/// parameter.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct OneHotEncoder {
/// Output can be a dictionary with only one entry, instead of an array.
#[prost(bool, tag = "10")]
pub output_sparse: bool,
#[prost(enumeration = "one_hot_encoder::HandleUnknown", tag = "11")]
pub handle_unknown: i32,
///
/// Mapping to be used for the encoding. The position of the category in
/// the below vector determines where the single one entry will be in the
/// output.
#[prost(oneof = "one_hot_encoder::CategoryType", tags = "1, 2")]
pub category_type: ::core::option::Option<one_hot_encoder::CategoryType>,
}
/// Nested message and enum types in `OneHotEncoder`.
pub mod one_hot_encoder {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum HandleUnknown {
ErrorOnUnknown = 0,
/// Output will be all zeros for unknown values.
IgnoreUnknown = 1,
}
impl HandleUnknown {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::ErrorOnUnknown => "ErrorOnUnknown",
Self::IgnoreUnknown => "IgnoreUnknown",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ErrorOnUnknown" => Some(Self::ErrorOnUnknown),
"IgnoreUnknown" => Some(Self::IgnoreUnknown),
_ => None,
}
}
}
///
/// Mapping to be used for the encoding. The position of the category in
/// the below vector determines where the single one entry will be in the
/// output.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum CategoryType {
#[prost(message, tag = "1")]
StringCategories(super::StringVector),
#[prost(message, tag = "2")]
Int64Categories(super::Int64Vector),
}
}
///
/// Uses an index mapping to convert a dictionary to an array.
///
/// The output array will be equal in length to the index mapping vector parameter.
/// All keys in the input dictionary must be present in the index mapping vector.
///
/// For each item in the input dictionary, insert its value in the output array.
/// The position of the insertion is determined by the position of the item's key
/// in the index mapping. Any keys not present in the input dictionary, will be
/// zero in the output array.
///
/// For example: if the ``stringToIndex`` parameter is set to ``\["a", "c", "b", "z"\]``,
/// then an input of ``{"a": 4, "c": 8}`` will produce an output of ``\[4, 8, 0, 0\]``.
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DictVectorizer {
#[prost(oneof = "dict_vectorizer::Map", tags = "1, 2")]
pub map: ::core::option::Option<dict_vectorizer::Map>,
}
/// Nested message and enum types in `DictVectorizer`.
pub mod dict_vectorizer {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum Map {
/// String keys to indexes
#[prost(message, tag = "1")]
StringToIndex(super::StringVector),
/// Int keys to indexes
#[prost(message, tag = "2")]
Int64ToIndex(super::Int64Vector),
}
}
///
/// A generalized linear model regressor.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GlmRegressor {
#[prost(message, repeated, tag = "1")]
pub weights: ::prost::alloc::vec::Vec<glm_regressor::DoubleArray>,
#[prost(double, repeated, tag = "2")]
pub offset: ::prost::alloc::vec::Vec<f64>,
#[prost(enumeration = "glm_regressor::PostEvaluationTransform", tag = "3")]
pub post_evaluation_transform: i32,
}
/// Nested message and enum types in `GLMRegressor`.
pub mod glm_regressor {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DoubleArray {
#[prost(double, repeated, tag = "1")]
pub value: ::prost::alloc::vec::Vec<f64>,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum PostEvaluationTransform {
NoTransform = 0,
Logit = 1,
Probit = 2,
}
impl PostEvaluationTransform {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::NoTransform => "NoTransform",
Self::Logit => "Logit",
Self::Probit => "Probit",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NoTransform" => Some(Self::NoTransform),
"Logit" => Some(Self::Logit),
"Probit" => Some(Self::Probit),
_ => None,
}
}
}
}
///
/// A linear kernel.
///
/// This function has the following formula:
///
/// .. math::
/// K(\boldsymbol{x}, \boldsymbol{x'}) = \boldsymbol{x}^T \boldsymbol{x'}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LinearKernel {}
///
/// A Gaussian radial basis function (RBF) kernel.
///
/// This function has the following formula:
///
/// .. math::
/// K(\boldsymbol{x}, \boldsymbol{x'}) = \
/// \exp(-\gamma || \boldsymbol{x} - \boldsymbol{x'} ||^2 )
///
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RbfKernel {
#[prost(double, tag = "1")]
pub gamma: f64,
}
///
/// A polynomial kernel.
///
/// This function has the following formula:
///
/// .. math::
/// K(\boldsymbol{x}, \boldsymbol{x'}) = \
/// (\gamma \boldsymbol{x}^T \boldsymbol{x'} + c)^{degree}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct PolyKernel {
#[prost(int32, tag = "1")]
pub degree: i32,
#[prost(double, tag = "2")]
pub c: f64,
#[prost(double, tag = "3")]
pub gamma: f64,
}
///
/// A sigmoid kernel.
///
/// This function has the following formula:
///
/// .. math::
/// K(\boldsymbol{x}, \boldsymbol{x'}) = \
/// \tanh(\gamma \boldsymbol{x}^T \boldsymbol{x'} + c)
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SigmoidKernel {
#[prost(double, tag = "1")]
pub gamma: f64,
#[prost(double, tag = "2")]
pub c: f64,
}
///
/// A kernel.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct Kernel {
#[prost(oneof = "kernel::Kernel", tags = "1, 2, 3, 4")]
pub kernel: ::core::option::Option<kernel::Kernel>,
}
/// Nested message and enum types in `Kernel`.
pub mod kernel {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
pub enum Kernel {
#[prost(message, tag = "1")]
LinearKernel(super::LinearKernel),
#[prost(message, tag = "2")]
RbfKernel(super::RbfKernel),
#[prost(message, tag = "3")]
PolyKernel(super::PolyKernel),
#[prost(message, tag = "4")]
SigmoidKernel(super::SigmoidKernel),
}
}
///
/// A sparse node.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SparseNode {
/// 1-based indexes, like libsvm
#[prost(int32, tag = "1")]
pub index: i32,
#[prost(double, tag = "2")]
pub value: f64,
}
///
/// A sparse vector.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SparseVector {
#[prost(message, repeated, tag = "1")]
pub nodes: ::prost::alloc::vec::Vec<SparseNode>,
}
///
/// One or more sparse support vectors.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SparseSupportVectors {
#[prost(message, repeated, tag = "1")]
pub vectors: ::prost::alloc::vec::Vec<SparseVector>,
}
///
/// A dense vector.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DenseVector {
#[prost(double, repeated, tag = "1")]
pub values: ::prost::alloc::vec::Vec<f64>,
}
///
/// One or more dense support vectors.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DenseSupportVectors {
#[prost(message, repeated, tag = "1")]
pub vectors: ::prost::alloc::vec::Vec<DenseVector>,
}
///
/// One or more coefficients.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Coefficients {
#[prost(double, repeated, tag = "1")]
pub alpha: ::prost::alloc::vec::Vec<f64>,
}
///
/// A support vector regressor.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SupportVectorRegressor {
#[prost(message, optional, tag = "1")]
pub kernel: ::core::option::Option<Kernel>,
/// Coefficients, one for each support vector
#[prost(message, optional, tag = "4")]
pub coefficients: ::core::option::Option<Coefficients>,
#[prost(double, tag = "5")]
pub rho: f64,
/// Support vectors, either sparse or dense format
#[prost(oneof = "support_vector_regressor::SupportVectors", tags = "2, 3")]
pub support_vectors: ::core::option::Option<
support_vector_regressor::SupportVectors,
>,
}
/// Nested message and enum types in `SupportVectorRegressor`.
pub mod support_vector_regressor {
/// Support vectors, either sparse or dense format
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum SupportVectors {
#[prost(message, tag = "2")]
SparseSupportVectors(super::SparseSupportVectors),
#[prost(message, tag = "3")]
DenseSupportVectors(super::DenseSupportVectors),
}
}
///
/// A support vector classifier
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SupportVectorClassifier {
#[prost(message, optional, tag = "1")]
pub kernel: ::core::option::Option<Kernel>,
///
/// The number of support vectors for each class.
#[prost(int32, repeated, tag = "2")]
pub number_of_support_vectors_per_class: ::prost::alloc::vec::Vec<i32>,
///
/// The coefficients, essentially a two dimensional array of
/// size: (numberOfClasses-1) by (total number of support vectors)
#[prost(message, repeated, tag = "5")]
pub coefficients: ::prost::alloc::vec::Vec<Coefficients>,
///
/// Constants for decision function,
/// with K*(K-1) / 2 elements,
/// where K is the number of classes.
#[prost(double, repeated, tag = "6")]
pub rho: ::prost::alloc::vec::Vec<f64>,
///
/// Pairwise probability information for A vs B classifier.
/// Total of K*(K-1)/2 elements where K is the number of classes.
/// These fields are optional,
/// and only required if you want probabilities or multi class predictions.
#[prost(double, repeated, tag = "7")]
pub prob_a: ::prost::alloc::vec::Vec<f64>,
#[prost(double, repeated, tag = "8")]
pub prob_b: ::prost::alloc::vec::Vec<f64>,
///
/// The support vectors, in either sparse or dense format.
#[prost(oneof = "support_vector_classifier::SupportVectors", tags = "3, 4")]
pub support_vectors: ::core::option::Option<
support_vector_classifier::SupportVectors,
>,
///
/// Class label mapping.
#[prost(oneof = "support_vector_classifier::ClassLabels", tags = "100, 101")]
pub class_labels: ::core::option::Option<support_vector_classifier::ClassLabels>,
}
/// Nested message and enum types in `SupportVectorClassifier`.
pub mod support_vector_classifier {
///
/// The support vectors, in either sparse or dense format.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum SupportVectors {
#[prost(message, tag = "3")]
SparseSupportVectors(super::SparseSupportVectors),
#[prost(message, tag = "4")]
DenseSupportVectors(super::DenseSupportVectors),
}
///
/// Class label mapping.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum ClassLabels {
#[prost(message, tag = "100")]
StringClassLabels(super::StringVector),
#[prost(message, tag = "101")]
Int64ClassLabels(super::Int64Vector),
}
}
///
/// A categorical mapping.
///
/// This allows conversion from integers to strings, or from strings to integers.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CategoricalMapping {
#[prost(oneof = "categorical_mapping::MappingType", tags = "1, 2")]
pub mapping_type: ::core::option::Option<categorical_mapping::MappingType>,
///
/// The value returned if an input is not contained in the map above.
/// If one of these is not set, then an error is raised on an unknown input.
#[prost(oneof = "categorical_mapping::ValueOnUnknown", tags = "101, 102")]
pub value_on_unknown: ::core::option::Option<categorical_mapping::ValueOnUnknown>,
}
/// Nested message and enum types in `CategoricalMapping`.
pub mod categorical_mapping {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum MappingType {
/// Conversion from strings to integers
#[prost(message, tag = "1")]
StringToInt64Map(super::StringToInt64Map),
/// Conversion from integer to string
#[prost(message, tag = "2")]
Int64ToStringMap(super::Int64ToStringMap),
}
///
/// The value returned if an input is not contained in the map above.
/// If one of these is not set, then an error is raised on an unknown input.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum ValueOnUnknown {
/// Default output when converting from an integer to a string.
#[prost(string, tag = "101")]
StrValue(::prost::alloc::string::String),
/// Default output when converting from a string to an integer.
#[prost(int64, tag = "102")]
Int64Value(i64),
}
}
///
/// A generalized linear model classifier.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GlmClassifier {
#[prost(message, repeated, tag = "1")]
pub weights: ::prost::alloc::vec::Vec<glm_classifier::DoubleArray>,
#[prost(double, repeated, tag = "2")]
pub offset: ::prost::alloc::vec::Vec<f64>,
#[prost(enumeration = "glm_classifier::PostEvaluationTransform", tag = "3")]
pub post_evaluation_transform: i32,
#[prost(enumeration = "glm_classifier::ClassEncoding", tag = "4")]
pub class_encoding: i32,
///
/// Required class label mapping.
#[prost(oneof = "glm_classifier::ClassLabels", tags = "100, 101")]
pub class_labels: ::core::option::Option<glm_classifier::ClassLabels>,
}
/// Nested message and enum types in `GLMClassifier`.
pub mod glm_classifier {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DoubleArray {
#[prost(double, repeated, tag = "1")]
pub value: ::prost::alloc::vec::Vec<f64>,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum PostEvaluationTransform {
Logit = 0,
/// Only binary classification is supported for probit
Probit = 1,
}
impl PostEvaluationTransform {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Logit => "Logit",
Self::Probit => "Probit",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"Logit" => Some(Self::Logit),
"Probit" => Some(Self::Probit),
_ => None,
}
}
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum ClassEncoding {
/// First class is the reference class
ReferenceClass = 0,
/// Also called One vs All
OneVsRest = 1,
}
impl ClassEncoding {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
Self::ReferenceClass => "ReferenceClass",
Self::OneVsRest => "OneVsRest",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ReferenceClass" => Some(Self::ReferenceClass),
"OneVsRest" => Some(Self::OneVsRest),
_ => None,
}
}
}
///
/// Required class label mapping.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum ClassLabels {
#[prost(message, tag = "100")]
StringClassLabels(super::StringVector),
#[prost(message, tag = "101")]
Int64ClassLabels(super::Int64Vector),
}
}
///
/// A k-Nearest-Neighbor classifier
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KNearestNeighborsClassifier {
///
/// The "core" nearest neighbor model attributes.
#[prost(message, optional, tag = "1")]
pub nearest_neighbors_index: ::core::option::Option<NearestNeighborsIndex>,
///
/// Number of neighbors to use for classification.
#[prost(message, optional, tag = "3")]
pub number_of_neighbors: ::core::option::Option<Int64Parameter>,
///
/// Type of labels supported by the model. Currently supports String or Int64
/// labels.
#[prost(oneof = "k_nearest_neighbors_classifier::ClassLabels", tags = "100, 101")]
pub class_labels: ::core::option::Option<
k_nearest_neighbors_classifier::ClassLabels,
>,
///
/// Default value of class label (useful when prediction is called on an empty kNN classifier)
#[prost(
oneof = "k_nearest_neighbors_classifier::DefaultClassLabel",
tags = "110, 111"
)]
pub default_class_label: ::core::option::Option<
k_nearest_neighbors_classifier::DefaultClassLabel,
>,
///
/// Weighting scheme to be used when computing the majority label of a
/// new data point.
#[prost(
oneof = "k_nearest_neighbors_classifier::WeightingScheme",
tags = "200, 210"
)]
pub weighting_scheme: ::core::option::Option<
k_nearest_neighbors_classifier::WeightingScheme,
>,
}
/// Nested message and enum types in `KNearestNeighborsClassifier`.
pub mod k_nearest_neighbors_classifier {
///
/// Type of labels supported by the model. Currently supports String or Int64
/// labels.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum ClassLabels {
#[prost(message, tag = "100")]
StringClassLabels(super::StringVector),
#[prost(message, tag = "101")]
Int64ClassLabels(super::Int64Vector),
}
///
/// Default value of class label (useful when prediction is called on an empty kNN classifier)
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum DefaultClassLabel {
#[prost(string, tag = "110")]
DefaultStringLabel(::prost::alloc::string::String),
#[prost(int64, tag = "111")]
DefaultInt64Label(i64),
}
///
/// Weighting scheme to be used when computing the majority label of a
/// new data point.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum WeightingScheme {
#[prost(message, tag = "200")]
UniformWeighting(super::UniformWeighting),
#[prost(message, tag = "210")]
InverseDistanceWeighting(super::InverseDistanceWeighting),
}
}
///
/// The "core" attributes of a Nearest Neighbors model.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct NearestNeighborsIndex {
///
/// Number of dimensions of the input data.
#[prost(int32, tag = "1")]
pub number_of_dimensions: i32,
///
/// Vector of floating point data that makes up the model. Each data point must have 'numberOfDimensions'
/// dimensions.
#[prost(message, repeated, tag = "2")]
pub float_samples: ::prost::alloc::vec::Vec<FloatVector>,
///
/// Backing data structure for the Nearest Neighbors Index. Currently supports
/// a linear index or a kd-tree index.
#[prost(oneof = "nearest_neighbors_index::IndexType", tags = "100, 110")]
pub index_type: ::core::option::Option<nearest_neighbors_index::IndexType>,
///
/// Distance function to be used to find neighbors. Currently only Squared Euclidean
/// Distance is supported.
#[prost(oneof = "nearest_neighbors_index::DistanceFunction", tags = "200")]
pub distance_function: ::core::option::Option<
nearest_neighbors_index::DistanceFunction,
>,
}
/// Nested message and enum types in `NearestNeighborsIndex`.
pub mod nearest_neighbors_index {
///
/// Backing data structure for the Nearest Neighbors Index. Currently supports
/// a linear index or a kd-tree index.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum IndexType {
#[prost(message, tag = "100")]
LinearIndex(super::LinearIndex),
#[prost(message, tag = "110")]
SingleKdTreeIndex(super::SingleKdTreeIndex),
}
///
/// Distance function to be used to find neighbors. Currently only Squared Euclidean
/// Distance is supported.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum DistanceFunction {
#[prost(message, tag = "200")]
SquaredEuclideanDistance(super::SquaredEuclideanDistance),
}
}
///
/// Specifies a uniform weighting scheme (i.e. each neighbor receives equal
/// voting power).
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct UniformWeighting {}
///
/// Specifies a inverse-distance weighting scheme (i.e. closest neighbors receives higher
/// voting power). A nearest neighbor with highest sum of (1 / distance) is picked.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct InverseDistanceWeighting {}
///
/// Specifies a flat index of data points to be searched by brute force.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LinearIndex {}
///
/// Specifies a kd-tree backend for the nearest neighbors model.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SingleKdTreeIndex {
///
/// Number of data points contained within a leaf node of the kd-tree.
#[prost(int32, tag = "1")]
pub leaf_size: i32,
}
///
/// Specifies the Squared Euclidean Distance function.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SquaredEuclideanDistance {}
///
/// An identity model.
///
/// This model returns given inputs as outputs, unchanged.
/// Intended to be used for testing purposes.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Identity {}
///
/// Item Similarity Recommender
///
/// The Item Similarity recommender takes as input a list of items and scores,
/// then uses that information and a table of item similarities to predict similarity
/// scores for all items. By default, the items predicted are most similar to the given
/// items but not part of that item set.
///
/// The predicted score for a given item k is
/// sum_(i in observed items) sim_(k,i) * (score_i - shift_k)
///
/// Because only the most similar scores for each item i are stored,
/// sim_(k,i) is often zero.
///
/// For many models, the score adjustment parameter shift_j is zero -- it's occasionally used
/// to counteract global biases for popular items.
///
///
/// References:
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ItemSimilarityRecommender {
#[prost(message, repeated, tag = "1")]
pub item_item_similarities: ::prost::alloc::vec::Vec<
item_similarity_recommender::SimilarItems,
>,
/// One or none of these are given. If none are given, then the items must number 0, 1, ..., num_items - 1.
/// If either is given, the length must be exactly num_items.
#[prost(message, optional, tag = "2")]
pub item_string_ids: ::core::option::Option<StringVector>,
#[prost(message, optional, tag = "3")]
pub item_int64_ids: ::core::option::Option<Int64Vector>,
/// Input parameter names specifying different possible inputs to the recommender.
///
/// Required
#[prost(string, tag = "10")]
pub item_input_feature_name: ::prost::alloc::string::String,
/// Optional; defaults to all items if not given.
#[prost(string, tag = "11")]
pub num_recommendations_input_feature_name: ::prost::alloc::string::String,
/// Optional.
#[prost(string, tag = "12")]
pub item_restriction_input_feature_name: ::prost::alloc::string::String,
/// Optional; defaults to input item list if not given.
#[prost(string, tag = "13")]
pub item_exclusion_input_feature_name: ::prost::alloc::string::String,
/// The predicted outputs. At least one of these must be specified.
#[prost(string, tag = "20")]
pub recommended_item_list_output_feature_name: ::prost::alloc::string::String,
#[prost(string, tag = "21")]
pub recommended_item_score_output_feature_name: ::prost::alloc::string::String,
}
/// Nested message and enum types in `ItemSimilarityRecommender`.
pub mod item_similarity_recommender {
/// The items similar to a given base item.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ConnectedItem {
#[prost(uint64, tag = "1")]
pub item_id: u64,
#[prost(double, tag = "2")]
pub similarity_score: f64,
}
/// The formula for the score of a given model as given above, with shift_k
/// parameter given by itemScoreAdjustment, and the similar item list filling in
/// all the known sim(k,i) scores for i given by itemID and k given by the itemID parameter in
/// the similarItemList.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SimilarItems {
#[prost(uint64, tag = "1")]
pub item_id: u64,
#[prost(message, repeated, tag = "2")]
pub similar_item_list: ::prost::alloc::vec::Vec<ConnectedItem>,
#[prost(double, tag = "3")]
pub item_score_adjustment: f64,
}
}
///
/// A model which wraps another (compiled) model external to this one
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LinkedModel {
#[prost(oneof = "linked_model::LinkType", tags = "1")]
pub link_type: ::core::option::Option<linked_model::LinkType>,
}
/// Nested message and enum types in `LinkedModel`.
pub mod linked_model {
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum LinkType {
/// A model located via a file system path
#[prost(message, tag = "1")]
LinkedModelFile(super::LinkedModelFile),
}
}
/// Model is referenced by a model file name and search path
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LinkedModelFile {
/// Model file name: e.g. "MyFetureExtractor.mlmodelc"
#[prost(message, optional, tag = "1")]
pub linked_model_file_name: ::core::option::Option<StringParameter>,
/// Search path to find the linked model file
/// Multiple paths can be searched using the unix-style path separator ":"
/// Each path can be relative (to this model) or absolute
///
/// An empty string is the same as the relative search path "."
/// which searches in the same location as this model file
///
/// There are some special paths which start with $
/// - $BUNDLE_MAIN - Indicates to look in the main bundle
/// - $BUNDLE_IDENTIFIER(identifier) - Looks in Bunde with given identifier
#[prost(message, optional, tag = "2")]
pub linked_model_search_path: ::core::option::Option<StringParameter>,
}
///
/// A pipeline consists of one or more models.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Pipeline {
#[prost(message, repeated, tag = "1")]
pub models: ::prost::alloc::vec::Vec<Model>,
/// Optional names given for each model
/// If not supplied it defaults to \["model0",..., "model"(models.size()-1)\]
/// These names can be used to disambiguate the scope / domain of a parameter
#[prost(string, repeated, tag = "2")]
pub names: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
///
/// A classifier pipeline.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PipelineClassifier {
#[prost(message, optional, tag = "1")]
pub pipeline: ::core::option::Option<Pipeline>,
}
///
/// A regressor pipeline.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PipelineRegressor {
#[prost(message, optional, tag = "1")]
pub pipeline: ::core::option::Option<Pipeline>,
}
///
/// A feature description
/// consisting of a name, short description, and type.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FeatureDescription {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub short_description: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub r#type: ::core::option::Option<FeatureType>,
}
///
/// Model metadata,
/// consisting of a short description, a version string,
/// an author, a license, and any other user defined
/// key/value meta data.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Metadata {
#[prost(string, tag = "1")]
pub short_description: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub version_string: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub author: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub license: ::prost::alloc::string::String,
#[prost(map = "string, string", tag = "100")]
pub user_defined: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
///
/// A description of a function.
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FunctionDescription {
/// The function name.
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Input feature descriptions for the function.
#[prost(message, repeated, tag = "2")]
pub input: ::prost::alloc::vec::Vec<FeatureDescription>,
/// Output feature descriptions for the function.
#[prost(message, repeated, tag = "3")]
pub output: ::prost::alloc::vec::Vec<FeatureDescription>,
/// State feature descriptions for the function.
///
/// The `type` of each feature description must be `StateFeatureType`.
#[prost(message, repeated, tag = "6")]
pub state: ::prost::alloc::vec::Vec<FeatureDescription>,
/// \[Required for regressor and classifier functions\]: the name
/// to give to an output feature containing the prediction.
#[prost(string, tag = "4")]
pub predicted_feature_name: ::prost::alloc::string::String,
/// \[Optional for classifier functions\]: the name to give to an
/// output feature containing a dictionary mapping class
/// labels to their predicted probabilities. If not specified,
/// the dictionary will not be returned by the model.
#[prost(string, tag = "5")]
pub predicted_probabilities_name: ::prost::alloc::string::String,
}
///
/// A description of a model,
/// consisting of descriptions of its input and output features.
/// Both regressor and classifier models require the name of the
/// primary predicted output feature (``predictedFeatureName``).
/// Classifier models can specify the output feature containing
/// probabilities for the predicted classes
/// (``predictedProbabilitiesName``).
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ModelDescription {
/// Functions in the model.
///
/// Some model types (e.g. ML Program) support multiple functions. For
/// example, a large language model might have "prompt" and "extend"
/// functions. Each has a different input and output behavior, but
/// they are in a same model and share resources.
///
/// If the model has more than one function, use the multiple
/// function configuration and declare the feature descriptions and
/// associated properties at function level.
///
/// If the model type doesn't support multiple functions or the
/// model has just "main" function, declare the feature
/// descriptions and associated properties at the model level.
///
/// Note: feature descriptions and associated properties mentioned
/// above include input, output, state, predictedFeatureName,
/// predictedProbabilitiesName, and trainingInput fields.
#[prost(message, repeated, tag = "20")]
pub functions: ::prost::alloc::vec::Vec<FunctionDescription>,
/// The default function.
///
/// The default function is the one that is automatically used when
/// one doesn't explicitly specify.
///
/// The value must be one of the names in `functions` message
/// above. If `functions` is empty, this field must not be present.
#[prost(string, tag = "21")]
pub default_function_name: ::prost::alloc::string::String,
/// The metadata (e.g. author, licence, etc) of the model.
#[prost(message, optional, tag = "100")]
pub metadata: ::core::option::Option<Metadata>,
#[prost(message, repeated, tag = "1")]
pub input: ::prost::alloc::vec::Vec<FeatureDescription>,
#[prost(message, repeated, tag = "10")]
pub output: ::prost::alloc::vec::Vec<FeatureDescription>,
/// State feature descriptions for the function.
///
/// The `type` of each feature description must be `StateFeatureType`.
#[prost(message, repeated, tag = "13")]
pub state: ::prost::alloc::vec::Vec<FeatureDescription>,
/// \[Required for regressor and classifier models\]: the name
/// to give to an output feature containing the prediction.
#[prost(string, tag = "11")]
pub predicted_feature_name: ::prost::alloc::string::String,
/// \[Optional for classifier models\]: the name to give to an
/// output feature containing a dictionary mapping class
/// labels to their predicted probabilities. If not specified,
/// the dictionary will not be returned by the model.
#[prost(string, tag = "12")]
pub predicted_probabilities_name: ::prost::alloc::string::String,
#[prost(message, repeated, tag = "50")]
pub training_input: ::prost::alloc::vec::Vec<FeatureDescription>,
}
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SerializedModel {
/// Identifier whose content describes the model type of the serialized protocol buffer message.
#[prost(string, tag = "1")]
pub identifier: ::prost::alloc::string::String,
/// Must be a valid serialized protocol buffer of the above specified type.
#[prost(bytes = "vec", tag = "2")]
pub model: ::prost::alloc::vec::Vec<u8>,
}
///
/// A Core ML model,
/// consisting of a specification version,
/// a model description, and a model type.
///
/// Core ML model compatibility is indicated by
/// a monotonically increasing specification version number,
/// which is incremented anytime a backward-incompatible change is made
/// (this is functionally equivalent to the MAJOR version number
/// described by `Semantic Versioning 2.0.0 <<http://semver.org/>`_>).
///
/// Specification Versions : OS Availability (Core ML Version)
///
/// 1 : iOS 11, macOS 10.13, tvOS 11, watchOS 4 (Core ML 1)
/// - Feedforward & Recurrent Neural Networks
/// - General Linear Models
/// - Tree Ensembles
/// - Support Vector Machines
/// - Pipelines
/// - Feature Engineering
///
/// 2 : iOS 11.2, macOS 10.13.2, tvOS 11.2, watchOS 4.2 (Core ML 1.2)
/// - Custom Layers for Neural Networks
/// - Float 16 support for Neural Network layers
///
/// 3 : iOS 12, macOS 10.14, tvOS 12, watchOS 5 (Core ML 2)
/// - Flexible shapes and image sizes
/// - Categorical sequences
/// - Core ML Vision Feature Print, Text Classifier, Word Tagger
/// - Non Max Suppression
/// - Crop and Resize Bilinear NN layers
/// - Custom Models
///
/// 4 : iOS 13, macOS 10.15, tvOS 13, watchOS 6 (Core ML 3)
/// - Updatable models
/// - Exact shape / general rank mapping for neural networks
/// - Large expansion of supported neural network layers
/// - Generalized operations
/// - Control flow
/// - Dynamic layers
/// - See NeuralNetwork.proto
/// - Nearest Neighbor Classifier
/// - Sound Analysis Prepreocessing
/// - Recommender
/// - Linked Model
/// - NLP Gazeteer
/// - NLP WordEmbedding
///
/// 5 : iOS 14, macOS 11, tvOS 14, watchOS 7 (Core ML 4)
/// - Model Deployment
/// - Model Encryption
/// - Unified converter API with PyTorch and Tensorflow 2 Support in coremltools 4
/// - MIL builder for neural networks and composite ops in coremltools 4
/// - New layers in neural network:
/// - CumSum
/// - OneHot
/// - ClampedReLu
/// - ArgSort
/// - SliceBySize
/// - Convolution3D
/// - Pool3D
/// - Bilinear Upsample with align corners and fractional factors
/// - PixelShuffle
/// - MatMul with int8 weights and int8 activations
/// - Concat interleave
/// - See NeuralNetwork.proto
/// - Enhanced Xcode model view with interactive previews
/// - Enhanced Xcode Playground support for Core ML models
///
/// 6 : iOS 15, macOS 12, tvOS 15, watchOS 8 (Core ML 5)
/// - Core ML Audio Feature Print
/// - new type of model: mlprogram (MILSpec.Program)
///
/// 7 : iOS 16, macOS 13, tvOS 16, watchOS 9 (Core ML 6)
/// - FLOAT16 array data type
/// - GRAYSCALE_FLOAT16 image color space.
///
/// 8 : iOS 17, macOS 14, tvOS 17, watchOS 10 (Core ML 7)
/// - iOS 17 ops
/// - Scene print v2
/// - ClassConfidenceThresholding model
///
/// 9 : iOS 18, macOS 15, tvOS 18, watchOS 11 (Core ML 8)
/// - multiple functions
///
/// 10 : iOS 26, macOS 26, tvOS 26, watchOS 26, visionOS 26 (Core ML 9)
/// - Int8 MultiArray types for ML Programs
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Model {
#[prost(int32, tag = "1")]
pub specification_version: i32,
#[prost(message, optional, tag = "2")]
pub description: ::core::option::Option<ModelDescription>,
///
/// Following model types support on-device update:
///
/// - NeuralNetworkClassifier
/// - NeuralNetworkRegressor
/// - NeuralNetwork
/// - KNearestNeighborsClassifier
#[prost(bool, tag = "10")]
pub is_updatable: bool,
/// start at 200 here
/// model specific parameters:
#[prost(
oneof = "model::Type",
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"
)]
pub r#type: ::core::option::Option<model::Type>,
}
/// Nested message and enum types in `Model`.
pub mod model {
/// start at 200 here
/// model specific parameters:
#[allow(clippy::all)]
#[allow(clippy::pedantic)]
#[allow(clippy::nursery)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Type {
/// pipeline starts at 200
#[prost(message, tag = "200")]
PipelineClassifier(super::PipelineClassifier),
#[prost(message, tag = "201")]
PipelineRegressor(super::PipelineRegressor),
#[prost(message, tag = "202")]
Pipeline(super::Pipeline),
/// regressors start at 300
#[prost(message, tag = "300")]
GlmRegressor(super::GlmRegressor),
#[prost(message, tag = "301")]
SupportVectorRegressor(super::SupportVectorRegressor),
#[prost(message, tag = "302")]
TreeEnsembleRegressor(super::TreeEnsembleRegressor),
#[prost(message, tag = "303")]
NeuralNetworkRegressor(super::NeuralNetworkRegressor),
#[prost(message, tag = "304")]
BayesianProbitRegressor(super::BayesianProbitRegressor),
/// classifiers start at 400
#[prost(message, tag = "400")]
GlmClassifier(super::GlmClassifier),
#[prost(message, tag = "401")]
SupportVectorClassifier(super::SupportVectorClassifier),
#[prost(message, tag = "402")]
TreeEnsembleClassifier(super::TreeEnsembleClassifier),
#[prost(message, tag = "403")]
NeuralNetworkClassifier(super::NeuralNetworkClassifier),
#[prost(message, tag = "404")]
KNearestNeighborsClassifier(super::KNearestNeighborsClassifier),
/// generic models start at 500
#[prost(message, tag = "500")]
NeuralNetwork(super::NeuralNetwork),
#[prost(message, tag = "501")]
ItemSimilarityRecommender(super::ItemSimilarityRecommender),
#[prost(message, tag = "502")]
MlProgram(super::mil_spec::Program),
/// Custom and linked models
#[prost(message, tag = "555")]
CustomModel(super::CustomModel),
#[prost(message, tag = "556")]
LinkedModel(super::LinkedModel),
/// Precision Recall Curve 'container''
#[prost(message, tag = "560")]
ClassConfidenceThresholding(super::ClassConfidenceThresholding),
/// feature engineering starts at 600
#[prost(message, tag = "600")]
OneHotEncoder(super::OneHotEncoder),
#[prost(message, tag = "601")]
Imputer(super::Imputer),
#[prost(message, tag = "602")]
FeatureVectorizer(super::FeatureVectorizer),
#[prost(message, tag = "603")]
DictVectorizer(super::DictVectorizer),
#[prost(message, tag = "604")]
Scaler(super::Scaler),
#[prost(message, tag = "606")]
CategoricalMapping(super::CategoricalMapping),
#[prost(message, tag = "607")]
Normalizer(super::Normalizer),
#[prost(message, tag = "609")]
ArrayFeatureExtractor(super::ArrayFeatureExtractor),
#[prost(message, tag = "610")]
NonMaximumSuppression(super::NonMaximumSuppression),
/// simple mathematical functions used for testing start at 900
#[prost(message, tag = "900")]
Identity(super::Identity),
/// CoreML provided models
#[prost(message, tag = "2000")]
TextClassifier(super::core_ml_models::TextClassifier),
#[prost(message, tag = "2001")]
WordTagger(super::core_ml_models::WordTagger),
#[prost(message, tag = "2002")]
VisionFeaturePrint(super::core_ml_models::VisionFeaturePrint),
#[prost(message, tag = "2003")]
SoundAnalysisPreprocessing(super::core_ml_models::SoundAnalysisPreprocessing),
#[prost(message, tag = "2004")]
Gazetteer(super::core_ml_models::Gazetteer),
#[prost(message, tag = "2005")]
WordEmbedding(super::core_ml_models::WordEmbedding),
#[prost(message, tag = "2006")]
AudioFeaturePrint(super::core_ml_models::AudioFeaturePrint),
/// Reserved private messages start at 3000
/// These messages are subject to change with no notice or support.
#[prost(message, tag = "3000")]
SerializedModel(super::SerializedModel),
}
}