Skip to main content

WeightSource

Enum WeightSource 

Source
pub enum WeightSource<'a> {
    Bytes(&'a [u8]),
    File(&'a Path),
    Reader(&'a DataReader),
}
Expand description

Where a network reads its weights from.

Weights have no text form, so a string source names a file.

Variants§

§

Bytes(&'a [u8])

Weight bytes in declaration order.

§

File(&'a Path)

A file the native stdio loader opens.

§

Reader(&'a DataReader)

A reader that owns its bytes or file.

Implementations§

Source§

impl WeightSource<'_>

Source

pub const EMPTY: WeightSource<'static>

No weights, which is what a graph whose layers need none loads.

Trait Implementations§

Source§

impl<'a> From<&'a DataReader> for WeightSource<'a>

Source§

fn from(reader: &'a DataReader) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Path> for WeightSource<'a>

Source§

fn from(path: &'a Path) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a PathBuf> for WeightSource<'a>

Source§

fn from(path: &'a PathBuf) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Vec<u8>> for WeightSource<'a>

Source§

fn from(data: &'a Vec<u8>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a [u8]> for WeightSource<'a>

Source§

fn from(data: &'a [u8]) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a str> for WeightSource<'a>

Source§

fn from(path: &'a str) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<'a> !Send for WeightSource<'a>

§

impl<'a> !Sync for WeightSource<'a>

§

impl<'a> Freeze for WeightSource<'a>

§

impl<'a> RefUnwindSafe for WeightSource<'a>

§

impl<'a> Unpin for WeightSource<'a>

§

impl<'a> UnsafeUnpin for WeightSource<'a>

§

impl<'a> UnwindSafe for WeightSource<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.