deephealthproject / eddl

European Distributed Deep Learning (EDDL) library. A general-purpose library initially developed to cover deep learning needs in healthcare use cases within the DeepHealth project.
https://deephealthproject.github.io/eddl/
MIT License
34 stars 10 forks source link

Load dynamic inputs shapes from ONNX #313

Open salvacarrion opened 2 years ago

salvacarrion commented 2 years ago

Many ONNX models have dynamic input shapes such as 3xHxW that we cannot load.

Due to our static computational graph we cannot support these dynamic shapes, so I propose that ONNX should ask for the input shape if this is indeed required (dynamic input). Else, nothing.

Examples:

// Not dynamic input shape => Okay
Net *net = import_net_from_onnx_file(model_path);

// Dynamic input shape + No given input shape => Error message asking for an input shape
Net *net = import_net_from_onnx_file(model_path);

// Dynamic input shape + Given input shape => Okay
Net *net = import_net_from_onnx_file(model_path, {in_channels, in_height, in_width});