Skip to content

Cuda not available in cargo run --release (BUG)? #291

@FilipAndersson245

Description

@FilipAndersson245

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions