candle icon indicating copy to clipboard operation
candle copied to clipboard

ONNX MaxPool auto_pad missing options

Open vesuvisian opened this issue 1 year ago • 0 comments

The auto_pad attribute in candle-onnx currently only supports the default NOTSET option. It needs to be updated to include SAME_UPPER, at least, in order to run the Tiny YOLOv3 model that is available from the ONNX Model Zoo.

Here's a script that produces the Error: Msg("unsupported auto_pad SAME_UPPER") error:

use std::collections::HashMap;
use candle_core::{Device, Tensor};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let device = Device::Cpu;
    let model = candle_onnx::read_file("~/Downloads/tiny-yolov3-11.onnx")?;
    let mut input = HashMap::new();
    input.insert("input_1".to_string(), Tensor::rand(0f32, 1., (1, 3, 416, 416), &device)?);
    input.insert("image_shape".to_string(), Tensor::new(&[[120f32,400.]], &device)?);
    let result = candle_onnx::eval::simple_eval(&model, input)?;
    println!("{:?}", result);
    Ok(())
}

vesuvisian avatar Sep 24 '24 16:09 vesuvisian