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///
103/// Additions to model descriptions related to model update API.
104impl MLModelDescription {
105    extern_methods!(
106        #[unsafe(method(isUpdatable))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn isUpdatable(&self) -> bool;
109
110        #[cfg(feature = "MLFeatureDescription")]
111        #[unsafe(method(trainingInputDescriptionsByName))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn trainingInputDescriptionsByName(
114            &self,
115        ) -> Retained<NSDictionary<NSString, MLFeatureDescription>>;
116    );
117}
118
119/// MLParameters.
120///
121/// Additions to model descriptions related to model parameters
122impl MLModelDescription {
123    extern_methods!(
124        #[cfg(all(
125            feature = "MLKey",
126            feature = "MLParameterDescription",
127            feature = "MLParameterKey"
128        ))]
129        #[unsafe(method(parameterDescriptionsByKey))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn parameterDescriptionsByKey(
132            &self,
133        ) -> Retained<NSDictionary<MLParameterKey, MLParameterDescription>>;
134    );
135}