use super::TensorView;
pub fn tensor_fill(tensor: &mut TensorView<'_>, value: f32) {
for v in tensor.data.iter_mut() {
*v = value;
}
}
pub fn tensor_scale_in_place(tensor: &mut TensorView<'_>, scale: f32) {
for v in tensor.data.iter_mut() {
*v *= scale;
}
}
pub fn tensor_add_in_place(dst: &mut TensorView<'_>, src: &TensorView<'_>) -> bool {
if dst.shape != src.shape || dst.data.len() != src.data.len() {
return false;
}
for i in 0..dst.data.len() {
dst.data[i] += src.data[i];
}
true
}