objc2_core_ml/generated/
MLOptimizationHints.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// MLOptimizationHints
12    ///
13    /// An object to hold hints that CoreML could use for further optimization
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/coreml/mloptimizationhints?language=objc)
16    #[unsafe(super(NSObject))]
17    #[derive(Debug, PartialEq, Eq, Hash)]
18    pub struct MLOptimizationHints;
19);
20
21extern_conformance!(
22    unsafe impl NSCoding for MLOptimizationHints {}
23);
24
25extern_conformance!(
26    unsafe impl NSCopying for MLOptimizationHints {}
27);
28
29unsafe impl CopyingHelper for MLOptimizationHints {
30    type Result = Self;
31}
32
33extern_conformance!(
34    unsafe impl NSObjectProtocol for MLOptimizationHints {}
35);
36
37extern_conformance!(
38    unsafe impl NSSecureCoding for MLOptimizationHints {}
39);
40
41impl MLOptimizationHints {
42    extern_methods!(
43        #[cfg(feature = "MLReshapeFrequencyHint")]
44        /// The anticipated reshape frequency
45        ///
46        /// CoreML framework needs to reshape the model with new shapes for models with flexible input.
47        /// Specify the anticipated reshape frequency (frequent or infrequent), so that the framework can optimize for
48        /// fast shape switching or fast prediction on seen shapes.
49        ///
50        /// The default value is frequent, which means CoreML tries to switch to new shapes as fast as possible
51        #[unsafe(method(reshapeFrequency))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn reshapeFrequency(&self) -> MLReshapeFrequencyHint;
54
55        #[cfg(feature = "MLReshapeFrequencyHint")]
56        /// Setter for [`reshapeFrequency`][Self::reshapeFrequency].
57        #[unsafe(method(setReshapeFrequency:))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn setReshapeFrequency(&self, reshape_frequency: MLReshapeFrequencyHint);
60
61        #[cfg(feature = "MLSpecializationStrategy")]
62        /// Optimization strategy for the model specialization.
63        ///
64        /// Core ML segments the model's compute graph and optimizes each segment for the
65        /// target compute device. This process can affect the model loading time and the prediction latency.
66        ///
67        /// Use this option to tailor the specialization strategy for your application.
68        #[unsafe(method(specializationStrategy))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn specializationStrategy(&self) -> MLSpecializationStrategy;
71
72        #[cfg(feature = "MLSpecializationStrategy")]
73        /// Setter for [`specializationStrategy`][Self::specializationStrategy].
74        #[unsafe(method(setSpecializationStrategy:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn setSpecializationStrategy(
77            &self,
78            specialization_strategy: MLSpecializationStrategy,
79        );
80    );
81}
82
83/// Methods declared on superclass `NSObject`.
84impl MLOptimizationHints {
85    extern_methods!(
86        #[unsafe(method(init))]
87        #[unsafe(method_family = init)]
88        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
89
90        #[unsafe(method(new))]
91        #[unsafe(method_family = new)]
92        pub unsafe fn new() -> Retained<Self>;
93    );
94}