A simple script that loads an image and moves it to cuda if available, only moves to "cuda"
I present a simple script to test this.
pub fn main() -> Result<()> {
let device = tch::Device::cuda_if_available();
let image = tch::vision::image::load("./foo.jpg")?;
let image = tch::vision::image::resize(&image, 640, 480).unwrap();
let image: Tensor = image.to_kind(tch::Kind::Float) / 255.;
let image = image.to_device(device);
dbg!(image.device());
}
when using cargo run --release only cpu is available.
but when running cargo run cuda is availalbe.
A simple script that loads an image and moves it to cuda if available, only moves to "cuda"
I present a simple script to test this.
when using
cargo run --releaseonly cpu is available.but when running
cargo runcuda is availalbe.