pub struct CoreMLModel { /* private fields */ }Expand description
CoreML model wrapper that provides Candle tensor integration
Implementations§
Source§impl CoreMLModel
impl CoreMLModel
Sourcepub fn load<P: AsRef<Path>>(path: P) -> Result<Self, CandleError>
pub fn load<P: AsRef<Path>>(path: P) -> Result<Self, CandleError>
Load a CoreML model from a .mlmodelc directory with default configuration
Sourcepub fn load_from_file<P: AsRef<Path>>(
path: P,
config: &Config,
) -> Result<Self, CandleError>
pub fn load_from_file<P: AsRef<Path>>( path: P, config: &Config, ) -> Result<Self, CandleError>
Load a CoreML model from a .mlmodelc directory following standard Candle patterns
Note: Unlike other Candle models, CoreML models are pre-compiled and don’t use VarBuilder. This method provides a Candle-compatible interface while loading from CoreML files.
Sourcepub fn forward_single(&self, input: &Tensor) -> Result<Tensor, CandleError>
pub fn forward_single(&self, input: &Tensor) -> Result<Tensor, CandleError>
Run forward pass through the model with multiple inputs
Accepts tensors from CPU or Metal devices, rejects CUDA tensors. Returns output tensor on the same device as the input tensors.
§Arguments
inputs- Slice of tensors corresponding to the input_names in config order
Convenience method for single-input models (backward compatibility)
pub fn forward(&self, inputs: &[&Tensor]) -> Result<Tensor, CandleError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CoreMLModel
impl RefUnwindSafe for CoreMLModel
impl Send for CoreMLModel
impl Sync for CoreMLModel
impl Unpin for CoreMLModel
impl UnwindSafe for CoreMLModel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more