logo

Function neuronika::linspace[][src]

pub fn linspace(start: f32, end: f32, n: usize) -> Var<Input<Ix1>>
Expand description

Creates a one-dimensional variable with n evenly spaced elements.

The elements range from start to end (exclusive).

Panics

If the length is greater than isize::MAX.

Examples

use neuronika;
use ndarray::arr1;

let tensor = neuronika::linspace(0., 1., 5);
assert!(*tensor.data() == arr1(&[0.0, 0.25, 0.5, 0.75, 1.0]))