objc2-core-ml 0.3.2

Bindings to the CoreML framework
Documentation
//! 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>;
    );
}