pub struct OnnxModel<B: Backend> {
pub model_path: String,
/* private fields */
}Expand description
Represents an imported or executed deep learning model.
Fields§
§model_path: StringImplementations§
Source§impl<B: Backend> OnnxModel<B>
impl<B: Backend> OnnxModel<B>
Sourcepub fn load(path: impl AsRef<Path>, device: &B::Device) -> Result<Self>
pub fn load(path: impl AsRef<Path>, device: &B::Device) -> Result<Self>
Loads a neural network model from the specified file path.
Sourcepub fn predict_raw<const D1: usize, const D2: usize>(
&self,
input: Tensor<B, D1>,
) -> Result<Tensor<B, D2>>
pub fn predict_raw<const D1: usize, const D2: usize>( &self, input: Tensor<B, D1>, ) -> Result<Tensor<B, D2>>
Predicts/evaluates a raw input tensor, returning an output tensor.
Sourcepub fn preprocess(&self, image: &Image<B>) -> Result<Tensor<B, 4>>
pub fn preprocess(&self, image: &Image<B>) -> Result<Tensor<B, 4>>
Helper to convert a standardized image into a model-compatible input tensor of shape [1, C, H, W].
Auto Trait Implementations§
impl<B> Freeze for OnnxModel<B>
impl<B> RefUnwindSafe for OnnxModel<B>
impl<B> Send for OnnxModel<B>
impl<B> Sync for OnnxModel<B>
impl<B> Unpin for OnnxModel<B>
impl<B> UnsafeUnpin for OnnxModel<B>
impl<B> UnwindSafe for OnnxModel<B>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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