pub enum ForwardType {
All,
Auto,
CPU,
}
Expand description
Backend used for running the model
The ForwardType
enum is used to specify the backend that will be used for forward computation
in the MNN framework. Each variant corresponds to a different backend, which may be enabled
or disabled based on the features enabled in the build configuration.
§Variants
All
: Use all available backends.Auto
: Automatically select the best backend based on the current environment and hardware.CPU
: Use the CPU for computation.Metal
: Use the Metal backend for computation (requires themetal
feature).OpenCL
: Use the OpenCL backend for computation (requires theopencl
feature).OpenGL
: Use the OpenGL backend for computation (requires theopengl
feature).Vulkan
: Use the Vulkan backend for computation (requires thevulkan
feature).CoreML
: Use the CoreML backend for computation (requires thecoreml
feature).
§Example
use mnn::schedule::ForwardType;
let forward_type = ForwardType::Auto;
println!("Selected forward type: {:?}", forward_type);
§Note
The availability of certain variants depends on the features enabled during the build.
For example, the Metal
variant is only available if the metal
feature is enabled.
Variants§
All
Use all available backends.
Auto
Try to automatically select the best backend based on the current environment and hardware.
CPU
Use the CPU for computation.
Implementations§
Trait Implementations§
source§impl Clone for ForwardType
impl Clone for ForwardType
source§fn clone(&self) -> ForwardType
fn clone(&self) -> ForwardType
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ForwardType
impl Debug for ForwardType
source§impl Default for ForwardType
impl Default for ForwardType
source§fn default() -> ForwardType
fn default() -> ForwardType
Returns the “default value” for a type. Read more
source§impl FromStr for ForwardType
impl FromStr for ForwardType
source§impl PartialEq for ForwardType
impl PartialEq for ForwardType
impl Copy for ForwardType
impl Eq for ForwardType
impl StructuralPartialEq for ForwardType
Auto Trait Implementations§
impl Freeze for ForwardType
impl RefUnwindSafe for ForwardType
impl Send for ForwardType
impl Sync for ForwardType
impl Unpin for ForwardType
impl UnwindSafe for ForwardType
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)