pub struct ParamsBase<S, D = Dim<[usize; 2]>>{ /* private fields */ }Expand description
The ParamsBase struct is a generic container for a set of weights and biases for a
model. The implementation is designed around the ArrayBase type from the
ndarray crate, which allows for flexible and efficient storage of multi-dimensional
arrays.
Implementations§
Source§impl<A, S, D> ParamsBase<S, D>
impl<A, S, D> ParamsBase<S, D>
Sourcepub const fn new(
bias: ArrayBase<S, <D as Dimension>::Smaller>,
weights: ArrayBase<S, D>,
) -> ParamsBase<S, D>
pub const fn new( bias: ArrayBase<S, <D as Dimension>::Smaller>, weights: ArrayBase<S, D>, ) -> ParamsBase<S, D>
create a new instance of the ParamsBase with the given bias and weights
Sourcepub fn from_elems<Sh>(shape: Sh, elem: A) -> ParamsBase<S, D>
pub fn from_elems<Sh>(shape: Sh, elem: A) -> ParamsBase<S, D>
create a new instance of the [ModelParams] from the given shape and element;
Sourcepub fn default<Sh>(shape: Sh) -> ParamsBase<S, D>
pub fn default<Sh>(shape: Sh) -> ParamsBase<S, D>
create an instance of the parameters with all values set to the default value
Sourcepub fn ones<Sh>(shape: Sh) -> ParamsBase<S, D>
pub fn ones<Sh>(shape: Sh) -> ParamsBase<S, D>
initialize the parameters with all values set to zero
Sourcepub fn zeros<Sh>(shape: Sh) -> ParamsBase<S, D>
pub fn zeros<Sh>(shape: Sh) -> ParamsBase<S, D>
create an instance of the parameters with all values set to zero
Sourcepub const fn bias(&self) -> &ArrayBase<S, <D as Dimension>::Smaller>
pub const fn bias(&self) -> &ArrayBase<S, <D as Dimension>::Smaller>
returns an immutable reference to the bias
Sourcepub const fn bias_mut(&mut self) -> &mut ArrayBase<S, <D as Dimension>::Smaller>
pub const fn bias_mut(&mut self) -> &mut ArrayBase<S, <D as Dimension>::Smaller>
returns a mutable reference to the bias
Sourcepub const fn weights_mut(&mut self) -> &mut ArrayBase<S, D>
pub const fn weights_mut(&mut self) -> &mut ArrayBase<S, D>
returns a mutable reference to the weights
Sourcepub fn assign_bias(
&mut self,
bias: &ArrayBase<S, <D as Dimension>::Smaller>,
) -> &mut ParamsBase<S, D>
pub fn assign_bias( &mut self, bias: &ArrayBase<S, <D as Dimension>::Smaller>, ) -> &mut ParamsBase<S, D>
assign the bias
Sourcepub fn assign_weights(
&mut self,
weights: &ArrayBase<S, D>,
) -> &mut ParamsBase<S, D>
pub fn assign_weights( &mut self, weights: &ArrayBase<S, D>, ) -> &mut ParamsBase<S, D>
assign the weights
Sourcepub fn replace_bias(
&mut self,
bias: ArrayBase<S, <D as Dimension>::Smaller>,
) -> ArrayBase<S, <D as Dimension>::Smaller>
pub fn replace_bias( &mut self, bias: ArrayBase<S, <D as Dimension>::Smaller>, ) -> ArrayBase<S, <D as Dimension>::Smaller>
replace the bias and return the previous state; uses replace
Sourcepub fn replace_weights(&mut self, weights: ArrayBase<S, D>) -> ArrayBase<S, D>
pub fn replace_weights(&mut self, weights: ArrayBase<S, D>) -> ArrayBase<S, D>
replace the weights and return the previous state; uses replace
Sourcepub fn set_bias(
&mut self,
bias: ArrayBase<S, <D as Dimension>::Smaller>,
) -> &mut ParamsBase<S, D>
pub fn set_bias( &mut self, bias: ArrayBase<S, <D as Dimension>::Smaller>, ) -> &mut ParamsBase<S, D>
set the bias
Sourcepub fn set_weights(&mut self, weights: ArrayBase<S, D>) -> &mut ParamsBase<S, D>
pub fn set_weights(&mut self, weights: ArrayBase<S, D>) -> &mut ParamsBase<S, D>
set the weights
Sourcepub fn backward<X, Y, Z>(
&mut self,
input: &X,
grad: &Y,
lr: A,
) -> Result<Z, Error>
pub fn backward<X, Y, Z>( &mut self, input: &X, grad: &Y, lr: A, ) -> Result<Z, Error>
perform a single backpropagation step
Sourcepub fn iter(&self) -> Iter<'_, A, D> ⓘwhere
D: RemoveAxis,
S: Data,
pub fn iter(&self) -> Iter<'_, A, D> ⓘwhere
D: RemoveAxis,
S: Data,
an iterator of the parameters; the created iterator zips together an axis iterator over the columns of the weights and an iterator over the bias
Sourcepub fn iter_mut(
&mut self,
) -> Zip<AxisIterMut<'_, A, <D as Dimension>::Smaller>, IterMut<'_, A, <D as Dimension>::Smaller>>where
D: RemoveAxis,
S: DataMut,
pub fn iter_mut(
&mut self,
) -> Zip<AxisIterMut<'_, A, <D as Dimension>::Smaller>, IterMut<'_, A, <D as Dimension>::Smaller>>where
D: RemoveAxis,
S: DataMut,
a mutable iterator of the parameters
Sourcepub fn iter_bias(&self) -> Iter<'_, A, <D as Dimension>::Smaller>where
S: Data,
pub fn iter_bias(&self) -> Iter<'_, A, <D as Dimension>::Smaller>where
S: Data,
returns an iterator over the bias
Sourcepub fn iter_bias_mut(&mut self) -> IterMut<'_, A, <D as Dimension>::Smaller>where
S: DataMut,
pub fn iter_bias_mut(&mut self) -> IterMut<'_, A, <D as Dimension>::Smaller>where
S: DataMut,
returns a mutable iterator over the bias
Sourcepub fn iter_weights(&self) -> Iter<'_, A, D>where
S: Data,
pub fn iter_weights(&self) -> Iter<'_, A, D>where
S: Data,
returns an iterator over the weights
Sourcepub fn iter_weights_mut(&mut self) -> IterMut<'_, A, D>where
S: DataMut,
pub fn iter_weights_mut(&mut self) -> IterMut<'_, A, D>where
S: DataMut,
returns a mutable iterator over the weights; see iter_mut for more
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
returns true if both the weights and bias are empty; uses is_empty
Sourcepub fn is_weights_empty(&self) -> bool
pub fn is_weights_empty(&self) -> bool
returns true if the weights are empty
Sourcepub fn is_bias_empty(&self) -> bool
pub fn is_bias_empty(&self) -> bool
returns true if the bias is empty
Sourcepub fn count_weight(&self) -> usize
pub fn count_weight(&self) -> usize
the total number of elements within the weight tensor
Sourcepub fn count_bias(&self) -> usize
pub fn count_bias(&self) -> usize
the total number of elements within the bias tensor
Sourcepub fn shape(&self) -> &[usize]
pub fn shape(&self) -> &[usize]
returns the shape of the parameters; uses the shape of the weight tensor
Sourcepub fn shape_bias(&self) -> &[usize]
pub fn shape_bias(&self) -> &[usize]
returns the shape of the bias tensor; the shape should be equivalent to that of the weight tensor minus the “zero-th” axis
Sourcepub fn to_owned(&self) -> ParamsBase<OwnedRepr<A>, D>
pub fn to_owned(&self) -> ParamsBase<OwnedRepr<A>, D>
returns an owned instance of the parameters
Sourcepub fn to_shape<Sh>(
&self,
shape: Sh,
) -> Result<ParamsBase<CowRepr<'_, A>, <Sh as ShapeBuilder>::Dim>, Error>
pub fn to_shape<Sh>( &self, shape: Sh, ) -> Result<ParamsBase<CowRepr<'_, A>, <Sh as ShapeBuilder>::Dim>, Error>
change the shape of the parameters; the shape of the bias parameters is determined by removing the “zero-th” axis of the given shape
Source§impl<A, S> ParamsBase<S>where
S: RawData<Elem = A>,
impl<A, S> ParamsBase<S>where
S: RawData<Elem = A>,
Source§impl<A, S, D> ParamsBase<S, D>
impl<A, S, D> ParamsBase<S, D>
pub fn init_rand<G, Dst, Sh>(shape: Sh, distr: G) -> ParamsBase<S, D>where
D: RemoveAxis,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
Dst: Clone + Distribution<A>,
G: Fn(&Sh) -> Dst,
Source§impl<A, S, D> ParamsBase<S, D>
impl<A, S, D> ParamsBase<S, D>
Sourcepub fn apply_gradient<Delta, Z>(
&mut self,
grad: &Delta,
lr: A,
) -> Result<Z, Error>
pub fn apply_gradient<Delta, Z>( &mut self, grad: &Delta, lr: A, ) -> Result<Z, Error>
a convenience method used to apply a gradient to the parameters using the given learning rate.
pub fn apply_gradient_with_decay<Grad, Z>( &mut self, grad: &Grad, lr: A, decay: A, ) -> Result<Z, Error>
pub fn apply_gradient_with_momentum<Grad, V, Z>( &mut self, grad: &Grad, lr: A, momentum: A, velocity: &mut V, ) -> Result<Z, Error>
pub fn apply_gradient_with_decay_and_momentum<Grad, V, Z>( &mut self, grad: &Grad, lr: A, decay: A, momentum: A, velocity: &mut V, ) -> Result<Z, Error>
Trait Implementations§
Source§impl<A, S, T, D> ApplyGradient<ParamsBase<T, D>, A> for ParamsBase<S, D>where
A: Float + FromPrimitive + ScalarOperand,
S: DataMut<Elem = A>,
T: Data<Elem = A>,
D: Dimension,
impl<A, S, T, D> ApplyGradient<ParamsBase<T, D>, A> for ParamsBase<S, D>where
A: Float + FromPrimitive + ScalarOperand,
S: DataMut<Elem = A>,
T: Data<Elem = A>,
D: Dimension,
type Output = ()
fn apply_gradient( &mut self, grad: &ParamsBase<T, D>, lr: A, ) -> Result<<ParamsBase<S, D> as ApplyGradient<ParamsBase<T, D>, A>>::Output, Error>
fn apply_gradient_with_decay( &mut self, grad: &ParamsBase<T, D>, lr: A, decay: A, ) -> Result<<ParamsBase<S, D> as ApplyGradient<ParamsBase<T, D>, A>>::Output, Error>
Source§impl<A, S, T, D> ApplyGradientExt<ParamsBase<T, D>, A> for ParamsBase<S, D>where
A: Float + FromPrimitive + ScalarOperand,
S: DataMut<Elem = A>,
T: Data<Elem = A>,
D: Dimension,
impl<A, S, T, D> ApplyGradientExt<ParamsBase<T, D>, A> for ParamsBase<S, D>where
A: Float + FromPrimitive + ScalarOperand,
S: DataMut<Elem = A>,
T: Data<Elem = A>,
D: Dimension,
type Velocity = ParamsBase<OwnedRepr<A>, D>
fn apply_gradient_with_momentum( &mut self, grad: &ParamsBase<T, D>, lr: A, momentum: A, velocity: &mut <ParamsBase<S, D> as ApplyGradientExt<ParamsBase<T, D>, A>>::Velocity, ) -> Result<(), Error>
fn apply_gradient_with_decay_and_momentum( &mut self, grad: &ParamsBase<T, D>, lr: A, decay: A, momentum: A, velocity: &mut <ParamsBase<S, D> as ApplyGradientExt<ParamsBase<T, D>, A>>::Velocity, ) -> Result<(), Error>
Source§impl<A, S, T> Backward<ArrayBase<S, Dim<[usize; 1]>>, ArrayBase<T, Dim<[usize; 0]>>> for ParamsBase<OwnedRepr<A>, Dim<[usize; 1]>>
impl<A, S, T> Backward<ArrayBase<S, Dim<[usize; 1]>>, ArrayBase<T, Dim<[usize; 0]>>> for ParamsBase<OwnedRepr<A>, Dim<[usize; 1]>>
type Elem = A
type Output = A
fn backward( &mut self, input: &ArrayBase<S, Dim<[usize; 1]>>, delta: &ArrayBase<T, Dim<[usize; 0]>>, gamma: <ParamsBase<OwnedRepr<A>, Dim<[usize; 1]>> as Backward<ArrayBase<S, Dim<[usize; 1]>>, ArrayBase<T, Dim<[usize; 0]>>>>::Elem, ) -> Result<<ParamsBase<OwnedRepr<A>, Dim<[usize; 1]>> as Backward<ArrayBase<S, Dim<[usize; 1]>>, ArrayBase<T, Dim<[usize; 0]>>>>::Output, Error>
Source§impl<A, S, T> Backward<ArrayBase<S, Dim<[usize; 1]>>, ArrayBase<T, Dim<[usize; 1]>>> for ParamsBase<OwnedRepr<A>>
impl<A, S, T> Backward<ArrayBase<S, Dim<[usize; 1]>>, ArrayBase<T, Dim<[usize; 1]>>> for ParamsBase<OwnedRepr<A>>
type Elem = A
type Output = A
fn backward( &mut self, input: &ArrayBase<S, Dim<[usize; 1]>>, delta: &ArrayBase<T, Dim<[usize; 1]>>, gamma: <ParamsBase<OwnedRepr<A>> as Backward<ArrayBase<S, Dim<[usize; 1]>>, ArrayBase<T, Dim<[usize; 1]>>>>::Elem, ) -> Result<<ParamsBase<OwnedRepr<A>> as Backward<ArrayBase<S, Dim<[usize; 1]>>, ArrayBase<T, Dim<[usize; 1]>>>>::Output, Error>
Source§impl<A, S, T> Backward<ArrayBase<S, Dim<[usize; 2]>>, ArrayBase<T, Dim<[usize; 1]>>> for ParamsBase<OwnedRepr<A>, Dim<[usize; 1]>>
impl<A, S, T> Backward<ArrayBase<S, Dim<[usize; 2]>>, ArrayBase<T, Dim<[usize; 1]>>> for ParamsBase<OwnedRepr<A>, Dim<[usize; 1]>>
type Elem = A
type Output = A
fn backward( &mut self, input: &ArrayBase<S, Dim<[usize; 2]>>, delta: &ArrayBase<T, Dim<[usize; 1]>>, gamma: <ParamsBase<OwnedRepr<A>, Dim<[usize; 1]>> as Backward<ArrayBase<S, Dim<[usize; 2]>>, ArrayBase<T, Dim<[usize; 1]>>>>::Elem, ) -> Result<<ParamsBase<OwnedRepr<A>, Dim<[usize; 1]>> as Backward<ArrayBase<S, Dim<[usize; 2]>>, ArrayBase<T, Dim<[usize; 1]>>>>::Output, Error>
Source§impl<A, S, T> Backward<ArrayBase<S, Dim<[usize; 2]>>, ArrayBase<T, Dim<[usize; 2]>>> for ParamsBase<OwnedRepr<A>>
impl<A, S, T> Backward<ArrayBase<S, Dim<[usize; 2]>>, ArrayBase<T, Dim<[usize; 2]>>> for ParamsBase<OwnedRepr<A>>
type Elem = A
type Output = A
fn backward( &mut self, input: &ArrayBase<S, Dim<[usize; 2]>>, delta: &ArrayBase<T, Dim<[usize; 2]>>, gamma: <ParamsBase<OwnedRepr<A>> as Backward<ArrayBase<S, Dim<[usize; 2]>>, ArrayBase<T, Dim<[usize; 2]>>>>::Elem, ) -> Result<<ParamsBase<OwnedRepr<A>> as Backward<ArrayBase<S, Dim<[usize; 2]>>, ArrayBase<T, Dim<[usize; 2]>>>>::Output, Error>
Source§impl<S, D> Biased<S, D> for ParamsBase<S, D>
impl<S, D> Biased<S, D> for ParamsBase<S, D>
Source§fn bias_mut(&mut self) -> &mut ArrayBase<S, <D as Dimension>::Smaller>
fn bias_mut(&mut self) -> &mut ArrayBase<S, <D as Dimension>::Smaller>
Source§fn assign_bias(
&mut self,
bias: &ArrayBase<S, <D as Dimension>::Smaller>,
) -> &mut Self
fn assign_bias( &mut self, bias: &ArrayBase<S, <D as Dimension>::Smaller>, ) -> &mut Self
Source§fn replace_bias(
&mut self,
bias: ArrayBase<S, <D as Dimension>::Smaller>,
) -> ArrayBase<S, <D as Dimension>::Smaller>
fn replace_bias( &mut self, bias: ArrayBase<S, <D as Dimension>::Smaller>, ) -> ArrayBase<S, <D as Dimension>::Smaller>
Source§fn set_bias(
&mut self,
bias: ArrayBase<S, <D as Dimension>::Smaller>,
) -> &mut Self
fn set_bias( &mut self, bias: ArrayBase<S, <D as Dimension>::Smaller>, ) -> &mut Self
Source§impl<A, S, D> Clone for ParamsBase<S, D>
impl<A, S, D> Clone for ParamsBase<S, D>
Source§fn clone(&self) -> ParamsBase<S, D>
fn clone(&self) -> ParamsBase<S, D>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<A, S, D> Debug for ParamsBase<S, D>
impl<A, S, D> Debug for ParamsBase<S, D>
Source§impl<A, X, Y, Z, S, D> Forward<X> for ParamsBase<S, D>
impl<A, X, Y, Z, S, D> Forward<X> for ParamsBase<S, D>
type Output = Z
Source§fn forward(
&self,
input: &X,
) -> Result<<ParamsBase<S, D> as Forward<X>>::Output, Error>
fn forward( &self, input: &X, ) -> Result<<ParamsBase<S, D> as Forward<X>>::Output, Error>
Source§fn forward_then<F>(&self, input: &Rhs, then: F) -> Result<Self::Output, Error>
fn forward_then<F>(&self, input: &Rhs, then: F) -> Result<Self::Output, Error>
Source§impl<A, S, D> Initialize<S, D> for ParamsBase<S, D>where
D: RemoveAxis,
S: RawData<Elem = A>,
impl<A, S, D> Initialize<S, D> for ParamsBase<S, D>where
D: RemoveAxis,
S: RawData<Elem = A>,
fn rand<Sh, Ds>(shape: Sh, distr: Ds) -> ParamsBase<S, D>
fn rand_with<Sh, Ds, R>(shape: Sh, distr: Ds, rng: &mut R) -> ParamsBase<S, D>
fn bernoulli<Sh>(shape: Sh, p: f64) -> Result<Self, BernoulliError>
Source§fn glorot_normal<Sh>(shape: Sh) -> Selfwhere
Sh: ShapeBuilder<Dim = D>,
StandardNormal: Distribution<<S as RawData>::Elem>,
S: DataOwned,
<S as RawData>::Elem: Float + FromPrimitive,
fn glorot_normal<Sh>(shape: Sh) -> Selfwhere
Sh: ShapeBuilder<Dim = D>,
StandardNormal: Distribution<<S as RawData>::Elem>,
S: DataOwned,
<S as RawData>::Elem: Float + FromPrimitive,
Source§fn glorot_uniform<Sh>(shape: Sh) -> Result<Self, Error>where
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<S as RawData>::Elem: Float + FromPrimitive + SampleUniform,
<<S as RawData>::Elem as SampleUniform>::Sampler: Clone,
fn glorot_uniform<Sh>(shape: Sh) -> Result<Self, Error>where
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<S as RawData>::Elem: Float + FromPrimitive + SampleUniform,
<<S as RawData>::Elem as SampleUniform>::Sampler: Clone,
Source§fn lecun_normal<Sh>(shape: Sh) -> Selfwhere
StandardNormal: Distribution<<S as RawData>::Elem>,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<S as RawData>::Elem: Float,
fn lecun_normal<Sh>(shape: Sh) -> Selfwhere
StandardNormal: Distribution<<S as RawData>::Elem>,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<S as RawData>::Elem: Float,
Source§fn normal<Sh>(
shape: Sh,
mean: <S as RawData>::Elem,
std: <S as RawData>::Elem,
) -> Result<Self, Error>where
StandardNormal: Distribution<<S as RawData>::Elem>,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<S as RawData>::Elem: Float,
fn normal<Sh>(
shape: Sh,
mean: <S as RawData>::Elem,
std: <S as RawData>::Elem,
) -> Result<Self, Error>where
StandardNormal: Distribution<<S as RawData>::Elem>,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<S as RawData>::Elem: Float,
Source§fn stdnorm<Sh>(shape: Sh) -> Self
fn stdnorm<Sh>(shape: Sh) -> Self
Source§fn stdnorm_from_seed<Sh>(shape: Sh, seed: u64) -> Self
fn stdnorm_from_seed<Sh>(shape: Sh, seed: u64) -> Self
Source§fn truncnorm<Sh>(
shape: Sh,
mean: <S as RawData>::Elem,
std: <S as RawData>::Elem,
) -> Result<Self, Error>where
StandardNormal: Distribution<<S as RawData>::Elem>,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<S as RawData>::Elem: Float,
fn truncnorm<Sh>(
shape: Sh,
mean: <S as RawData>::Elem,
std: <S as RawData>::Elem,
) -> Result<Self, Error>where
StandardNormal: Distribution<<S as RawData>::Elem>,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<S as RawData>::Elem: Float,
Source§fn uniform<Sh>(shape: Sh, dk: <S as RawData>::Elem) -> Result<Self, Error>where
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<S as RawData>::Elem: Clone + Neg<Output = <S as RawData>::Elem> + SampleUniform,
<<S as RawData>::Elem as SampleUniform>::Sampler: Clone,
fn uniform<Sh>(shape: Sh, dk: <S as RawData>::Elem) -> Result<Self, Error>where
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<S as RawData>::Elem: Clone + Neg<Output = <S as RawData>::Elem> + SampleUniform,
<<S as RawData>::Elem as SampleUniform>::Sampler: Clone,
Uniform distribution with values bounded by +/- dkSource§fn uniform_from_seed<Sh>(
shape: Sh,
start: <S as RawData>::Elem,
stop: <S as RawData>::Elem,
key: u64,
) -> Result<Self, Error>where
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<S as RawData>::Elem: Clone + SampleUniform,
<<S as RawData>::Elem as SampleUniform>::Sampler: Clone,
fn uniform_from_seed<Sh>(
shape: Sh,
start: <S as RawData>::Elem,
stop: <S as RawData>::Elem,
key: u64,
) -> Result<Self, Error>where
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<S as RawData>::Elem: Clone + SampleUniform,
<<S as RawData>::Elem as SampleUniform>::Sampler: Clone,
Uniform distribution with values between
the start and stop params using some random seed.Source§fn uniform_along<Sh>(shape: Sh, axis: usize) -> Result<Self, Error>where
Sh: ShapeBuilder<Dim = D>,
S: DataOwned,
<S as RawData>::Elem: Float + FromPrimitive + SampleUniform,
<<S as RawData>::Elem as SampleUniform>::Sampler: Clone,
fn uniform_along<Sh>(shape: Sh, axis: usize) -> Result<Self, Error>where
Sh: ShapeBuilder<Dim = D>,
S: DataOwned,
<S as RawData>::Elem: Float + FromPrimitive + SampleUniform,
<<S as RawData>::Elem as SampleUniform>::Sampler: Clone,
Uniform distribution with values bounded by the
size of the specified axis.
The values are bounded by +/- dk where dk = 1 / size(axis).Source§fn uniform_between<Sh>(
shape: Sh,
a: <S as RawData>::Elem,
b: <S as RawData>::Elem,
) -> Result<Self, Error>where
Sh: ShapeBuilder<Dim = D>,
S: DataOwned,
<S as RawData>::Elem: Clone + SampleUniform,
<<S as RawData>::Elem as SampleUniform>::Sampler: Clone,
fn uniform_between<Sh>(
shape: Sh,
a: <S as RawData>::Elem,
b: <S as RawData>::Elem,
) -> Result<Self, Error>where
Sh: ShapeBuilder<Dim = D>,
S: DataOwned,
<S as RawData>::Elem: Clone + SampleUniform,
<<S as RawData>::Elem as SampleUniform>::Sampler: Clone,
Uniform distribution with values between then given
bounds, a and b.Source§impl<A, S, D> PartialEq for ParamsBase<S, D>
impl<A, S, D> PartialEq for ParamsBase<S, D>
Source§impl<S, D> Weighted<S, D> for ParamsBase<S, D>
impl<S, D> Weighted<S, D> for ParamsBase<S, D>
Source§fn weights_mut(&mut self) -> &mut ArrayBase<S, D>
fn weights_mut(&mut self) -> &mut ArrayBase<S, D>
Source§fn assign_weights(&mut self, weights: &ArrayBase<S, D>) -> &mut Self
fn assign_weights(&mut self, weights: &ArrayBase<S, D>) -> &mut Self
Source§fn replace_weights(&mut self, weights: ArrayBase<S, D>) -> ArrayBase<S, D>
fn replace_weights(&mut self, weights: ArrayBase<S, D>) -> ArrayBase<S, D>
Source§fn set_weights(&mut self, weights: ArrayBase<S, D>) -> &mut Self
fn set_weights(&mut self, weights: ArrayBase<S, D>) -> &mut Self
impl<A, S, D> Copy for ParamsBase<S, D>
impl<A, S, D> Eq for ParamsBase<S, D>
Auto Trait Implementations§
impl<S, D> Freeze for ParamsBase<S, D>
impl<S, D> RefUnwindSafe for ParamsBase<S, D>where
S: RefUnwindSafe,
<D as Dimension>::Smaller: RefUnwindSafe,
D: RefUnwindSafe,
<S as RawData>::Elem: RefUnwindSafe,
impl<S, D> Send for ParamsBase<S, D>
impl<S, D> Sync for ParamsBase<S, D>
impl<S, D> Unpin for ParamsBase<S, D>
impl<S, D> UnwindSafe for ParamsBase<S, D>where
S: UnwindSafe,
<D as Dimension>::Smaller: UnwindSafe,
D: UnwindSafe,
<S as RawData>::Elem: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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>
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