Trait Initialize

Source
pub trait Initialize<A, D>
where D: Dimension,
{ type Data: RawData<Elem = A>; // Required methods fn rand<Sh, Ds>(shape: Sh, distr: Ds) -> Self where Ds: Distribution<A>, Sh: ShapeBuilder<Dim = D>, Self::Data: DataOwned; fn rand_with<Sh, Ds, R>(shape: Sh, distr: Ds, rng: &mut R) -> Self where R: Rng + ?Sized, Ds: Distribution<A>, Sh: ShapeBuilder<Dim = D>, Self::Data: DataOwned; }
Expand description

This trait facilitates the initialization of tensors with random values. Initialize

This trait provides the base methods required for initializing an ndarray with random values. Initialize is similar to RandomExt, however, it focuses on flexibility while implementing additional features geared towards machine-learning models; such as lecun_normal initialization.

Required Associated Types§

Source

type Data: RawData<Elem = A>

Required Methods§

Source

fn rand<Sh, Ds>(shape: Sh, distr: Ds) -> Self
where Ds: Distribution<A>, Sh: ShapeBuilder<Dim = D>, Self::Data: DataOwned,

Source

fn rand_with<Sh, Ds, R>(shape: Sh, distr: Ds, rng: &mut R) -> Self
where R: Rng + ?Sized, Ds: Distribution<A>, Sh: ShapeBuilder<Dim = D>, Self::Data: DataOwned,

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.

Implementations on Foreign Types§

Source§

impl<S, A, D> Initialize<A, D> for ArrayBase<S, D>
where D: Dimension, S: RawData<Elem = A>,

Source§

type Data = S

Source§

fn rand<Sh, Ds>(shape: Sh, distr: Ds) -> Self
where Ds: Distribution<A>, Sh: ShapeBuilder<Dim = D>, S: DataOwned,

Source§

fn rand_with<Sh, Ds, R>(shape: Sh, distr: Ds, rng: &mut R) -> Self
where R: Rng + ?Sized, Ds: Distribution<A>, Sh: ShapeBuilder<Dim = D>, S: DataOwned,

Implementors§

Source§

impl<A, S, D> Initialize<A, D> for ParamsBase<S, D>
where D: RemoveAxis, S: RawData<Elem = A>,

Source§

type Data = S