pub struct WasmTensor { /* private fields */ }Expand description
WebAssembly-friendly tensor wrapper
Implementations§
Source§impl WasmTensor
impl WasmTensor
Sourcepub fn new(data: Vec<f32>, shape: Vec<usize>) -> Result<WasmTensor, JsValue>
pub fn new(data: Vec<f32>, shape: Vec<usize>) -> Result<WasmTensor, JsValue>
Create a new tensor from a flat array and shape
Sourcepub fn zeros(shape: Vec<usize>) -> Result<WasmTensor, JsValue>
pub fn zeros(shape: Vec<usize>) -> Result<WasmTensor, JsValue>
Create a tensor filled with zeros
Sourcepub fn to_string_js(&self) -> String
pub fn to_string_js(&self) -> String
Get a string representation
Trait Implementations§
Source§impl From<WasmTensor> for JsValue
impl From<WasmTensor> for JsValue
Source§fn from(value: WasmTensor) -> Self
fn from(value: WasmTensor) -> Self
Converts to this type from the input type.
Source§impl FromWasmAbi for WasmTensor
impl FromWasmAbi for WasmTensor
Source§impl IntoWasmAbi for WasmTensor
impl IntoWasmAbi for WasmTensor
Source§impl LongRefFromWasmAbi for WasmTensor
impl LongRefFromWasmAbi for WasmTensor
Source§impl OptionFromWasmAbi for WasmTensor
impl OptionFromWasmAbi for WasmTensor
Source§impl OptionIntoWasmAbi for WasmTensor
impl OptionIntoWasmAbi for WasmTensor
Source§impl RefFromWasmAbi for WasmTensor
impl RefFromWasmAbi for WasmTensor
Source§type Anchor = RcRef<WasmTensor>
type Anchor = RcRef<WasmTensor>
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 WasmTensor
impl RefMutFromWasmAbi for WasmTensor
Source§impl TryFromJsValue for WasmTensor
impl TryFromJsValue for WasmTensor
Source§impl VectorFromWasmAbi for WasmTensor
impl VectorFromWasmAbi for WasmTensor
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[WasmTensor]>
Source§impl VectorIntoWasmAbi for WasmTensor
impl VectorIntoWasmAbi for WasmTensor
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[WasmTensor]>) -> Self::Abi
Source§impl WasmDescribeVector for WasmTensor
impl WasmDescribeVector for WasmTensor
impl SupportsConstructor for WasmTensor
impl SupportsInstanceProperty for WasmTensor
impl SupportsStaticProperty for WasmTensor
Auto Trait Implementations§
impl Freeze for WasmTensor
impl !RefUnwindSafe for WasmTensor
impl Send for WasmTensor
impl Sync for WasmTensor
impl Unpin for WasmTensor
impl !UnwindSafe for WasmTensor
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> 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.