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