coreylowman / dfdx

Deep learning in Rust, with shape checked tensors and neural networks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: `as_vec` crashes for empty Tensors

emchristiansen opened this issue · comments

Code:

let dev = Cpu::default();
let x: Tensor<(usize,), f32, Cpu> = dev.ones_like(&(0,));
// This line crashes.
x.as_vec();

Crash message:

Message:  index out of bounds: the len is 0 but the index is 0
Location: dfdx/src/tensor/cpu/iterate.rs:173