Struct Reinitializer
pub struct Reinitializer<B>where
B: Backend,{ /* private fields */ }
Expand description
Overrides float and int tensors of burn modules.
This is useful for testing.
Implementations§
§
impl<B> Reinitializer<B>where
B: Backend,
impl<B> Reinitializer<B>where
B: Backend,
pub fn new() ->
Reinitializer<B>
pub fn new() -> Reinitializer<B>
Create a new reinitializer.
pub fn apply<M>(self, module: M) -> Mwhere
M: Module<B>,
pub fn apply<M>(self, module: M) -> Mwhere
M: Module<B>,
Apply the reinitialization to the given module.
pub fn constant(self, constant: f64)
-> Reinitializer<B>
pub fn constant(self, constant: f64) -> Reinitializer<B>
Set the reinitialization strategy to constant for all tensors.
pub fn constant_float(self, constant: f64)
-> Reinitializer<B>
pub fn constant_float(self, constant: f64) -> Reinitializer<B>
Set the reinitialization strategy to constant for float tensors.
pub fn constant_int(self, constant: i64)
-> Reinitializer<B>
pub fn constant_int(self, constant: i64) -> Reinitializer<B>
Set the reinitialization strategy to constant for int tensors.
pub fn random(self, seed: u64,
min: f64,
max: f64)
-> Reinitializer<B>
pub fn random(self, seed: u64, min: f64, max: f64) -> Reinitializer<B>
Set the reinitialization strategy to random for all tensors.
pub fn random_float(self, seed: u64,
min: f64,
max: f64)
-> Reinitializer<B>
pub fn random_float(self, seed: u64, min: f64, max: f64) -> Reinitializer<B>
Set the reinitialization strategy to random for float tensors.
pub fn random_int(self, seed: u64,
min: i64,
max: i64)
-> Reinitializer<B>
pub fn random_int(self, seed: u64, min: i64, max: i64) -> Reinitializer<B>
Set the reinitialization strategy to random for int tensors.
pub fn range(self, min: f64,
max: f64)
-> Reinitializer<B>
pub fn range(self, min: f64, max: f64) -> Reinitializer<B>
Set the reinitialization strategy to range for all tensors.
pub fn range_float(self, min: f64,
max: f64)
-> Reinitializer<B>
pub fn range_float(self, min: f64, max: f64) -> Reinitializer<B>
Set the reinitialization strategy to range for float tensors.
pub fn range_int(self, min: i64,
max: i64)
-> Reinitializer<B>
pub fn range_int(self, min: i64, max: i64) -> Reinitializer<B>
Set the reinitialization strategy to range for int tensors.
Trait Implementations§
§
impl<B> Debug for Reinitializer<B>
impl<B> Debug for Reinitializer<B>
§
impl<B> Default for Reinitializer<B>where
B: Backend,
impl<B> Default for Reinitializer<B>where
B: Backend,
§
fn default() -> Reinitializer<B>
fn default() -> Reinitializer<B>
Returns the “default value” for a type. Read
more
§
impl<B> ModuleMapper<B> for Reinitializer<B>where
B: Backend,
impl<B> ModuleMapper<B> for Reinitializer<B>where
B: Backend,
Auto Trait Implementations§
impl<B> Freeze for Reinitializer<B>
impl<B> RefUnwindSafe for Reinitializer<B>
impl<B> Send for Reinitializer<B>
impl<B> Sync for Reinitializer<B>
impl<B> Unpin for Reinitializer<B>
impl<B> UnwindSafe for Reinitializer<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<T> Instrument for T
impl<T> Instrument for T
§
fn instrument(self, span: Span) ->
Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§
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
more
Source§
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
§
impl<T> Pointable for T
impl<T> Pointable for T
§
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§
impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§
fn read_from_little_endian(read: &mut
R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian()
.