pub struct VisionBench { /* private fields */ }Expand description
Vision benchmark handle — forward, backward, and SGD on CPU / WebGPU / WebGL.
Implementations§
Source§impl VisionBench
impl VisionBench
pub fn new(slug: &str) -> Result<VisionBench, JsValue>
pub fn info(&self) -> VisionModelInfo
Sourcepub fn init_params(&self, seed: u32) -> Vec<f32>
pub fn init_params(&self, seed: u32) -> Vec<f32>
Deterministic Kaiming-style init; biases are zero.
Sourcepub fn synthetic_batch(&self, seed: u32) -> Vec<f32>
pub fn synthetic_batch(&self, seed: u32) -> Vec<f32>
Synthetic normalized input + integer class label.
Sourcepub fn forward_cpu(
&self,
x: &[f32],
params: &[f32],
) -> Result<Vec<f32>, JsValue>
pub fn forward_cpu( &self, x: &[f32], params: &[f32], ) -> Result<Vec<f32>, JsValue>
Forward pass on CPU — returns logits (num_classes floats).
Trait Implementations§
Source§impl From<VisionBench> for JsValue
impl From<VisionBench> for JsValue
Source§fn from(value: VisionBench) -> Self
fn from(value: VisionBench) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for VisionBench
impl FromWasmAbi for VisionBench
Source§impl IntoWasmAbi for VisionBench
impl IntoWasmAbi for VisionBench
Source§impl LongRefFromWasmAbi for VisionBench
impl LongRefFromWasmAbi for VisionBench
Source§impl OptionFromWasmAbi for VisionBench
impl OptionFromWasmAbi for VisionBench
Source§impl OptionIntoWasmAbi for VisionBench
impl OptionIntoWasmAbi for VisionBench
Source§impl RefFromWasmAbi for VisionBench
impl RefFromWasmAbi for VisionBench
Source§type Anchor = RcRef<VisionBench>
type Anchor = RcRef<VisionBench>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.Source§impl RefMutFromWasmAbi for VisionBench
impl RefMutFromWasmAbi for VisionBench
impl SupportsConstructor for VisionBench
impl SupportsInstanceProperty for VisionBench
impl SupportsStaticProperty for VisionBench
Source§impl TryFromJsValue for VisionBench
impl TryFromJsValue for VisionBench
Source§impl VectorFromWasmAbi for VisionBench
impl VectorFromWasmAbi for VisionBench
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[VisionBench]>
Source§impl VectorIntoWasmAbi for VisionBench
impl VectorIntoWasmAbi for VisionBench
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[VisionBench]>) -> Self::Abi
Source§impl WasmDescribeVector for VisionBench
impl WasmDescribeVector for VisionBench
Auto Trait Implementations§
impl Freeze for VisionBench
impl RefUnwindSafe for VisionBench
impl Send for VisionBench
impl Sync for VisionBench
impl Unpin for VisionBench
impl UnsafeUnpin for VisionBench
impl UnwindSafe for VisionBench
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> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.