burn::tensor

Trait ElementRandom

pub trait ElementRandom {
    // Required method
    fn random<R>(distribution: Distribution, rng: &mut R) -> Self
       where R: RngCore;
}
Expand description

Element trait for random value of a tensor.

Required Methods§

fn random<R>(distribution: Distribution, rng: &mut R) -> Self
where R: RngCore,

Returns a random value for the given distribution.

§Arguments
  • distribution - The distribution to sample from.
  • rng - The random number generator.
§Returns

The random value.

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§

§

impl ElementRandom for bool

§

fn random<R>(distribution: Distribution, rng: &mut R) -> bool
where R: RngCore,

§

impl ElementRandom for f32

§

fn random<R>(distribution: Distribution, rng: &mut R) -> f32
where R: RngCore,

§

impl ElementRandom for f64

§

fn random<R>(distribution: Distribution, rng: &mut R) -> f64
where R: RngCore,

§

impl ElementRandom for i8

§

fn random<R>(distribution: Distribution, rng: &mut R) -> i8
where R: RngCore,

§

impl ElementRandom for i16

§

fn random<R>(distribution: Distribution, rng: &mut R) -> i16
where R: RngCore,

§

impl ElementRandom for i32

§

fn random<R>(distribution: Distribution, rng: &mut R) -> i32
where R: RngCore,

§

impl ElementRandom for i64

§

fn random<R>(distribution: Distribution, rng: &mut R) -> i64
where R: RngCore,

§

impl ElementRandom for u8

§

fn random<R>(distribution: Distribution, rng: &mut R) -> u8
where R: RngCore,

§

impl ElementRandom for u16

§

fn random<R>(distribution: Distribution, rng: &mut R) -> u16
where R: RngCore,

§

impl ElementRandom for u32

§

fn random<R>(distribution: Distribution, rng: &mut R) -> u32
where R: RngCore,

§

impl ElementRandom for u64

§

fn random<R>(distribution: Distribution, rng: &mut R) -> u64
where R: RngCore,

Implementors§