pub trait InitializeExt<A, D>{
Show 13 methods
// Provided methods
fn bernoulli<Sh: ShapeBuilder<Dim = D>>(
shape: Sh,
p: f64,
) -> Result<Self, BernoulliError>
where Bernoulli: Distribution<A> { ... }
fn glorot_normal<Sh>(shape: Sh, inputs: usize, outputs: usize) -> Self
where A: Float + FromPrimitive,
Sh: ShapeBuilder<Dim = D>,
StandardNormal: Distribution<A>,
Self::Data: DataOwned<Elem = A> { ... }
fn glorot_uniform<Sh>(
shape: Sh,
inputs: usize,
outputs: usize,
) -> Result<Self, Error>
where A: Float + FromPrimitive + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A> { ... }
fn lecun_normal<Sh: ShapeBuilder<Dim = D>>(shape: Sh) -> Self
where A: Float,
StandardNormal: Distribution<A>,
Self::Data: DataOwned<Elem = A> { ... }
fn normal<Sh: ShapeBuilder<Dim = D>>(
shape: Sh,
mean: A,
std: A,
) -> Result<Self, NormalError>
where A: Float,
StandardNormal: Distribution<A>,
Self::Data: DataOwned<Elem = A> { ... }
fn randc<Sh: ShapeBuilder<Dim = D>>(shape: Sh, re: A, im: A) -> Self
where ComplexDistribution<A, A>: Distribution<A>,
Self::Data: DataOwned<Elem = A> { ... }
fn stdnorm<Sh: ShapeBuilder<Dim = D>>(shape: Sh) -> Self
where StandardNormal: Distribution<A>,
Self::Data: DataOwned<Elem = A> { ... }
fn stdnorm_from_seed<Sh: ShapeBuilder<Dim = D>>(
shape: Sh,
seed: u64,
) -> Self
where StandardNormal: Distribution<A>,
Self::Data: DataOwned<Elem = A> { ... }
fn truncnorm<Sh: ShapeBuilder<Dim = D>>(
shape: Sh,
mean: A,
std: A,
) -> Result<Self, NormalError>
where A: Float,
StandardNormal: Distribution<A>,
Self::Data: DataOwned<Elem = A> { ... }
fn uniform<Sh>(shape: Sh, dk: A) -> Result<Self, Error>
where A: Copy + Neg<Output = A> + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A> { ... }
fn uniform_from_seed<Sh>(
shape: Sh,
start: A,
stop: A,
key: u64,
) -> Result<Self, Error>
where A: Clone + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A> { ... }
fn uniform_along<Sh>(shape: Sh, axis: usize) -> Result<Self, Error>
where A: Copy + Float + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A> { ... }
fn uniform_between<Sh>(shape: Sh, a: A, b: A) -> Result<Self, Error>
where A: Clone + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A> { ... }
}Expand description
This trait extends the Initialize trait with methods for generating random arrays from various distributions.
Provided Methods§
fn bernoulli<Sh: ShapeBuilder<Dim = D>>(
shape: Sh,
p: f64,
) -> Result<Self, BernoulliError>where
Bernoulli: Distribution<A>,
Sourcefn glorot_normal<Sh>(shape: Sh, inputs: usize, outputs: usize) -> Selfwhere
A: Float + FromPrimitive,
Sh: ShapeBuilder<Dim = D>,
StandardNormal: Distribution<A>,
Self::Data: DataOwned<Elem = A>,
fn glorot_normal<Sh>(shape: Sh, inputs: usize, outputs: usize) -> Selfwhere
A: Float + FromPrimitive,
Sh: ShapeBuilder<Dim = D>,
StandardNormal: Distribution<A>,
Self::Data: DataOwned<Elem = A>,
Initialize the object according to the Glorot Initialization scheme.
Sourcefn glorot_uniform<Sh>(
shape: Sh,
inputs: usize,
outputs: usize,
) -> Result<Self, Error>where
A: Float + FromPrimitive + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A>,
fn glorot_uniform<Sh>(
shape: Sh,
inputs: usize,
outputs: usize,
) -> Result<Self, Error>where
A: Float + FromPrimitive + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A>,
Initialize the object according to the Glorot Initialization scheme.
Sourcefn lecun_normal<Sh: ShapeBuilder<Dim = D>>(shape: Sh) -> Self
fn lecun_normal<Sh: ShapeBuilder<Dim = D>>(shape: Sh) -> Self
Initialize the object according to the Lecun Initialization scheme. LecunNormal distributions are truncated Normal distributions centered at 0 with a standard deviation equal to the square root of the reciprocal of the number of inputs.
Sourcefn normal<Sh: ShapeBuilder<Dim = D>>(
shape: Sh,
mean: A,
std: A,
) -> Result<Self, NormalError>
fn normal<Sh: ShapeBuilder<Dim = D>>( shape: Sh, mean: A, std: A, ) -> Result<Self, NormalError>
Given a shape, mean, and standard deviation generate a new object using the Normal distribution
fn randc<Sh: ShapeBuilder<Dim = D>>(shape: Sh, re: A, im: A) -> Self
Sourcefn stdnorm<Sh: ShapeBuilder<Dim = D>>(shape: Sh) -> Self
fn stdnorm<Sh: ShapeBuilder<Dim = D>>(shape: Sh) -> Self
Generate a random array using the StandardNormal distribution
Sourcefn stdnorm_from_seed<Sh: ShapeBuilder<Dim = D>>(shape: Sh, seed: u64) -> Self
fn stdnorm_from_seed<Sh: ShapeBuilder<Dim = D>>(shape: Sh, seed: u64) -> Self
Generate a random array using the StandardNormal distribution with a given seed
Sourcefn truncnorm<Sh: ShapeBuilder<Dim = D>>(
shape: Sh,
mean: A,
std: A,
) -> Result<Self, NormalError>
fn truncnorm<Sh: ShapeBuilder<Dim = D>>( shape: Sh, mean: A, std: A, ) -> Result<Self, NormalError>
Initialize the object using the TruncatedNormal distribution
Sourcefn uniform<Sh>(shape: Sh, dk: A) -> Result<Self, Error>where
A: Copy + Neg<Output = A> + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A>,
fn uniform<Sh>(shape: Sh, dk: A) -> Result<Self, Error>where
A: Copy + Neg<Output = A> + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A>,
A uniform generator with values between u(-dk, dk)
fn uniform_from_seed<Sh>(
shape: Sh,
start: A,
stop: A,
key: u64,
) -> Result<Self, Error>where
A: Clone + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A>,
Sourcefn uniform_along<Sh>(shape: Sh, axis: usize) -> Result<Self, Error>where
A: Copy + Float + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A>,
fn uniform_along<Sh>(shape: Sh, axis: usize) -> Result<Self, Error>where
A: Copy + Float + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A>,
Generate a random array with values between u(-a, a) where a is the reciprocal of the value at the given axis
Sourcefn uniform_between<Sh>(shape: Sh, a: A, b: A) -> Result<Self, Error>where
A: Clone + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A>,
fn uniform_between<Sh>(shape: Sh, a: A, b: A) -> Result<Self, Error>where
A: Clone + SampleUniform,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Self::Data: DataOwned<Elem = A>,
A uniform generator with values between u(-dk, dk)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.