objc2_core_ml/generated/
MLModelDescription.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10    /// A description of a model containing input, output, and state feature descriptions, optionally outputted features
11    /// with special meaning and metadata.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mlmodeldescription?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct MLModelDescription;
17);
18
19extern_conformance!(
20    unsafe impl NSCoding for MLModelDescription {}
21);
22
23extern_conformance!(
24    unsafe impl NSObjectProtocol for MLModelDescription {}
25);
26
27extern_conformance!(
28    unsafe impl NSSecureCoding for MLModelDescription {}
29);
30
31impl MLModelDescription {
32    extern_methods!(
33        #[cfg(feature = "MLFeatureDescription")]
34        /// Description of the inputs to the model
35        #[unsafe(method(inputDescriptionsByName))]
36        #[unsafe(method_family = none)]
37        pub unsafe fn inputDescriptionsByName(
38            &self,
39        ) -> Retained<NSDictionary<NSString, MLFeatureDescription>>;
40
41        #[cfg(feature = "MLFeatureDescription")]
42        /// Description of the outputs from the model
43        #[unsafe(method(outputDescriptionsByName))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn outputDescriptionsByName(
46            &self,
47        ) -> Retained<NSDictionary<NSString, MLFeatureDescription>>;
48
49        #[cfg(feature = "MLFeatureDescription")]
50        /// Description of the state features.
51        #[unsafe(method(stateDescriptionsByName))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn stateDescriptionsByName(
54            &self,
55        ) -> Retained<NSDictionary<NSString, MLFeatureDescription>>;
56
57        /// Name of the primary target / predicted output feature in the output descriptions
58        #[unsafe(method(predictedFeatureName))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn predictedFeatureName(&self) -> Option<Retained<NSString>>;
61
62        /// Key for all predicted probabilities stored as a MLFeatureTypeDictionary in the output descriptions
63        #[unsafe(method(predictedProbabilitiesName))]
64        #[unsafe(method_family = none)]
65        pub unsafe fn predictedProbabilitiesName(&self) -> Option<Retained<NSString>>;
66
67        #[cfg(feature = "MLModelMetadataKeys")]
68        /// Optional metadata describing the model
69        #[unsafe(method(metadata))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn metadata(&self) -> Retained<NSDictionary<MLModelMetadataKey, AnyObject>>;
72
73        /// Array to map a class index to the corresponding label, which is either Number or String.
74        ///
75        /// The property is populated from the classLabels entry specified in the model's protobuf message. When the model is a pipeline, which contains one or more sub models, the property value is calculated as follows.
76        ///
77        /// 1. If the pipeline model's proto message specifies predictedFeatureName parameter, use classLabels property value of the sub model with the output feature with the name.
78        ///
79        /// 2. Otherwise, if the pipeline model has only one sub model with non-nil classLabels property, use the property value.
80        ///
81        /// 3. Otherwise, the property is nil.
82        #[unsafe(method(classLabels))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn classLabels(&self) -> Option<Retained<NSArray<AnyObject>>>;
85    );
86}
87
88/// Methods declared on superclass `NSObject`.
89impl MLModelDescription {
90    extern_methods!(
91        #[unsafe(method(init))]
92        #[unsafe(method_family = init)]
93        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
94
95        #[unsafe(method(new))]
96        #[unsafe(method_family = new)]
97        pub unsafe fn new() -> Retained<Self>;
98    );
99}
100
101/// MLUpdateAdditions.
102/// Additions to model descriptions related to model update API.
103impl MLModelDescription {
104    extern_methods!(
105        #[unsafe(method(isUpdatable))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn isUpdatable(&self) -> bool;
108
109        #[cfg(feature = "MLFeatureDescription")]
110        #[unsafe(method(trainingInputDescriptionsByName))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn trainingInputDescriptionsByName(
113            &self,
114        ) -> Retained<NSDictionary<NSString, MLFeatureDescription>>;
115    );
116}
117
118/// MLParameters.
119/// Additions to model descriptions related to model parameters
120impl MLModelDescription {
121    extern_methods!(
122        #[cfg(all(
123            feature = "MLKey",
124            feature = "MLParameterDescription",
125            feature = "MLParameterKey"
126        ))]
127        #[unsafe(method(parameterDescriptionsByKey))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn parameterDescriptionsByKey(
130            &self,
131        ) -> Retained<NSDictionary<MLParameterKey, MLParameterDescription>>;
132    );
133}