use optirs_core::regularizers::SpatialDropout;
use scirs2_core::ndarray::{Array, Axis};
#[allow(dead_code)]
fn main() {
let sd = SpatialDropout::new(0.0).expect("unwrap failed");
let features = Array::from_shape_fn((1, 2, 2, 2), |(b, c, h, w)| {
println!("Creating element at ({}, {}, {}, {})", b, c, h, w);
c as f64 + h as f64 + w as f64
});
println!("Original features shape: {:?}", features.shape());
println!("Original features:\n{:?}", features);
let result = sd.apply(&features, true);
println!("Result shape: {:?}", result.shape());
println!("Result:\n{:?}", result);
let sd_drop = SpatialDropout::new(0.5).expect("unwrap failed");
let result_drop = sd_drop.apply(&features, true);
println!("Result with dropout:\n{:?}", result_drop);
for c in 0..2 {
let channel = result_drop.index_axis(Axis(1), c);
println!("Channel {}: {:?}", c, channel);
}
}