logo

Function neuronika::full[][src]

pub fn full<D: Dimension, Sh: ShapeBuilder<Dim = D>>(
    shape: Sh,
    elem: f32
) -> Var<Input<D>>
Expand description

Creates a variable with data filled with a constant value.

el must be f32 and the shape of type ndarray::ShapeBuilder.

Examples

use neuronika;
let t1 = neuronika::full(1, 5.); // Filled with 5.0
let t2 = neuronika::full((1, 5), 6.); // Filled with 6.0
let t3 = neuronika::full([1, 2, 3], 8.); // Filled with 8.0

assert_eq!(t1.data().shape(), &[1]);
assert_eq!(t2.data().shape(), &[1, 5]);
assert_eq!(t3.data().shape(), &[1, 2, 3]);