Streamline the glm4 example. (#2694)

This commit is contained in:
Laurent Mazare
2024-12-31 09:21:41 +01:00
committed by GitHub
parent e38e2a85dd
commit d60eba1408
3 changed files with 97 additions and 145 deletions

View File

@ -250,7 +250,11 @@ fn run(args: Args) -> Result<()> {
};
println!("img\n{img}");
let img = ((img.clamp(-1f32, 1f32)? + 1.0)? * 127.5)?.to_dtype(candle::DType::U8)?;
candle_examples::save_image(&img.i(0)?, "out.jpg")?;
let filename = match args.seed {
None => "out.jpg".to_string(),
Some(s) => format!("out-{s}.jpg"),
};
candle_examples::save_image(&img.i(0)?, filename)?;
Ok(())
}